/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* Attribute classes' member function definitions *| |* *| |* Automatically generated file, do not edit! *| |* From: Attr.td *| |* *| \*===----------------------------------------------------------------------===*/ static inline void DelimitAttributeArgument(raw_ostream& OS, bool& IsFirst) { if (IsFirst) { IsFirst = false; OS << "("; } else OS << ", "; } // AArch64SVEPcsAttr implementation AArch64SVEPcsAttr *AArch64SVEPcsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AArch64SVEPcsAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AArch64SVEPcsAttr *AArch64SVEPcsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AArch64SVEPcsAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AArch64SVEPcsAttr *AArch64SVEPcsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_aarch64_sve_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_aarch64_sve_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_aarch64_sve_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } AArch64SVEPcsAttr *AArch64SVEPcsAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_aarch64_sve_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_aarch64_sve_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_aarch64_sve_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_aarch64_sve_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } AArch64SVEPcsAttr::AArch64SVEPcsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AArch64SVEPcs, /*IsLateParsed=*/false, false) { } AArch64SVEPcsAttr *AArch64SVEPcsAttr::clone(ASTContext &C) const { auto *A = new (C) AArch64SVEPcsAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AArch64SVEPcsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((aarch64_sve_pcs"; OS << "))"; break; } case 1 : { OS << "[[clang::aarch64_sve_pcs"; OS << "]]"; break; } case 2 : { OS << "[[clang::aarch64_sve_pcs"; OS << "]]"; break; } } } const char *AArch64SVEPcsAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "aarch64_sve_pcs"; case 1: return "aarch64_sve_pcs"; case 2: return "aarch64_sve_pcs"; } } // AArch64VectorPcsAttr implementation AArch64VectorPcsAttr *AArch64VectorPcsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AArch64VectorPcsAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AArch64VectorPcsAttr *AArch64VectorPcsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AArch64VectorPcsAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AArch64VectorPcsAttr *AArch64VectorPcsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_aarch64_vector_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_aarch64_vector_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_aarch64_vector_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_aarch64_vector_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_aarch64_vector_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_aarch64_vector_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } AArch64VectorPcsAttr *AArch64VectorPcsAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_aarch64_vector_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_aarch64_vector_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_aarch64_vector_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_aarch64_vector_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_aarch64_vector_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_aarch64_vector_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } AArch64VectorPcsAttr::AArch64VectorPcsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AArch64VectorPcs, /*IsLateParsed=*/false, false) { } AArch64VectorPcsAttr *AArch64VectorPcsAttr::clone(ASTContext &C) const { auto *A = new (C) AArch64VectorPcsAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AArch64VectorPcsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((aarch64_vector_pcs"; OS << "))"; break; } case 1 : { OS << "[[clang::aarch64_vector_pcs"; OS << "]]"; break; } case 2 : { OS << "[[clang::aarch64_vector_pcs"; OS << "]]"; break; } } } const char *AArch64VectorPcsAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "aarch64_vector_pcs"; case 1: return "aarch64_vector_pcs"; case 2: return "aarch64_vector_pcs"; } } // AMDGPUFlatWorkGroupSizeAttr implementation AMDGPUFlatWorkGroupSizeAttr *AMDGPUFlatWorkGroupSizeAttr::CreateImplicit(ASTContext &Ctx, Expr * Min, Expr * Max, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AMDGPUFlatWorkGroupSizeAttr(Ctx, CommonInfo, Min, Max); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AMDGPUFlatWorkGroupSizeAttr *AMDGPUFlatWorkGroupSizeAttr::Create(ASTContext &Ctx, Expr * Min, Expr * Max, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AMDGPUFlatWorkGroupSizeAttr(Ctx, CommonInfo, Min, Max); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AMDGPUFlatWorkGroupSizeAttr *AMDGPUFlatWorkGroupSizeAttr::CreateImplicit(ASTContext &Ctx, Expr * Min, Expr * Max, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_amdgpu_flat_work_group_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_flat_work_group_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_amdgpu_flat_work_group_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_flat_work_group_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Min, Max, I); } AMDGPUFlatWorkGroupSizeAttr *AMDGPUFlatWorkGroupSizeAttr::Create(ASTContext &Ctx, Expr * Min, Expr * Max, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_amdgpu_flat_work_group_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_flat_work_group_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_amdgpu_flat_work_group_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_flat_work_group_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Min, Max, I); } AMDGPUFlatWorkGroupSizeAttr::AMDGPUFlatWorkGroupSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Min , Expr * Max ) : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUFlatWorkGroupSize, /*IsLateParsed=*/false, false) , min(Min) , max(Max) { } AMDGPUFlatWorkGroupSizeAttr *AMDGPUFlatWorkGroupSizeAttr::clone(ASTContext &C) const { auto *A = new (C) AMDGPUFlatWorkGroupSizeAttr(C, *this, min, max); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AMDGPUFlatWorkGroupSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((amdgpu_flat_work_group_size"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMin()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMax()->printPretty(OS, nullptr, Policy); OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::amdgpu_flat_work_group_size"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMin()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMax()->printPretty(OS, nullptr, Policy); OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AMDGPUFlatWorkGroupSizeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "amdgpu_flat_work_group_size"; case 1: return "amdgpu_flat_work_group_size"; } } // AMDGPUKernelCallAttr implementation AMDGPUKernelCallAttr *AMDGPUKernelCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AMDGPUKernelCallAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AMDGPUKernelCallAttr *AMDGPUKernelCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AMDGPUKernelCallAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AMDGPUKernelCallAttr *AMDGPUKernelCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_amdgpu_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_amdgpu_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_amdgpu_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_amdgpu_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } AMDGPUKernelCallAttr *AMDGPUKernelCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_amdgpu_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_amdgpu_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_amdgpu_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_amdgpu_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } AMDGPUKernelCallAttr::AMDGPUKernelCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUKernelCall, /*IsLateParsed=*/false, false) { } AMDGPUKernelCallAttr *AMDGPUKernelCallAttr::clone(ASTContext &C) const { auto *A = new (C) AMDGPUKernelCallAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AMDGPUKernelCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((amdgpu_kernel"; OS << "))"; break; } case 1 : { OS << "[[clang::amdgpu_kernel"; OS << "]]"; break; } case 2 : { OS << "[[clang::amdgpu_kernel"; OS << "]]"; break; } } } const char *AMDGPUKernelCallAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "amdgpu_kernel"; case 1: return "amdgpu_kernel"; case 2: return "amdgpu_kernel"; } } // AMDGPUMaxNumWorkGroupsAttr implementation AMDGPUMaxNumWorkGroupsAttr *AMDGPUMaxNumWorkGroupsAttr::CreateImplicit(ASTContext &Ctx, Expr * MaxNumWorkGroupsX, Expr * MaxNumWorkGroupsY, Expr * MaxNumWorkGroupsZ, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AMDGPUMaxNumWorkGroupsAttr(Ctx, CommonInfo, MaxNumWorkGroupsX, MaxNumWorkGroupsY, MaxNumWorkGroupsZ); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AMDGPUMaxNumWorkGroupsAttr *AMDGPUMaxNumWorkGroupsAttr::Create(ASTContext &Ctx, Expr * MaxNumWorkGroupsX, Expr * MaxNumWorkGroupsY, Expr * MaxNumWorkGroupsZ, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AMDGPUMaxNumWorkGroupsAttr(Ctx, CommonInfo, MaxNumWorkGroupsX, MaxNumWorkGroupsY, MaxNumWorkGroupsZ); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AMDGPUMaxNumWorkGroupsAttr *AMDGPUMaxNumWorkGroupsAttr::CreateImplicit(ASTContext &Ctx, Expr * MaxNumWorkGroupsX, Expr * MaxNumWorkGroupsY, Expr * MaxNumWorkGroupsZ, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_amdgpu_max_num_work_groups: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_max_num_work_groups, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_amdgpu_max_num_work_groups: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_max_num_work_groups, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, MaxNumWorkGroupsX, MaxNumWorkGroupsY, MaxNumWorkGroupsZ, I); } AMDGPUMaxNumWorkGroupsAttr *AMDGPUMaxNumWorkGroupsAttr::Create(ASTContext &Ctx, Expr * MaxNumWorkGroupsX, Expr * MaxNumWorkGroupsY, Expr * MaxNumWorkGroupsZ, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_amdgpu_max_num_work_groups: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_max_num_work_groups, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_amdgpu_max_num_work_groups: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_max_num_work_groups, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, MaxNumWorkGroupsX, MaxNumWorkGroupsY, MaxNumWorkGroupsZ, I); } AMDGPUMaxNumWorkGroupsAttr::AMDGPUMaxNumWorkGroupsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * MaxNumWorkGroupsX , Expr * MaxNumWorkGroupsY , Expr * MaxNumWorkGroupsZ ) : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUMaxNumWorkGroups, /*IsLateParsed=*/false, false) , maxNumWorkGroupsX(MaxNumWorkGroupsX) , maxNumWorkGroupsY(MaxNumWorkGroupsY) , maxNumWorkGroupsZ(MaxNumWorkGroupsZ) { } AMDGPUMaxNumWorkGroupsAttr::AMDGPUMaxNumWorkGroupsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * MaxNumWorkGroupsX ) : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUMaxNumWorkGroups, /*IsLateParsed=*/false, false) , maxNumWorkGroupsX(MaxNumWorkGroupsX) , maxNumWorkGroupsY() , maxNumWorkGroupsZ() { } AMDGPUMaxNumWorkGroupsAttr *AMDGPUMaxNumWorkGroupsAttr::clone(ASTContext &C) const { auto *A = new (C) AMDGPUMaxNumWorkGroupsAttr(C, *this, maxNumWorkGroupsX, maxNumWorkGroupsY, maxNumWorkGroupsZ); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AMDGPUMaxNumWorkGroupsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((amdgpu_max_num_work_groups"; if (!getMaxNumWorkGroupsZ()) ++TrailingOmittedArgs; if (!getMaxNumWorkGroupsY()) ++TrailingOmittedArgs; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMaxNumWorkGroupsX()->printPretty(OS, nullptr, Policy); OS << ""; if (!(!getMaxNumWorkGroupsY())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMaxNumWorkGroupsY()->printPretty(OS, nullptr, Policy); OS << ""; } if (!(!getMaxNumWorkGroupsZ())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMaxNumWorkGroupsZ()->printPretty(OS, nullptr, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::amdgpu_max_num_work_groups"; if (!getMaxNumWorkGroupsZ()) ++TrailingOmittedArgs; if (!getMaxNumWorkGroupsY()) ++TrailingOmittedArgs; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMaxNumWorkGroupsX()->printPretty(OS, nullptr, Policy); OS << ""; if (!(!getMaxNumWorkGroupsY())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMaxNumWorkGroupsY()->printPretty(OS, nullptr, Policy); OS << ""; } if (!(!getMaxNumWorkGroupsZ())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMaxNumWorkGroupsZ()->printPretty(OS, nullptr, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AMDGPUMaxNumWorkGroupsAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "amdgpu_max_num_work_groups"; case 1: return "amdgpu_max_num_work_groups"; } } // AMDGPUNumSGPRAttr implementation AMDGPUNumSGPRAttr *AMDGPUNumSGPRAttr::CreateImplicit(ASTContext &Ctx, unsigned NumSGPR, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AMDGPUNumSGPRAttr(Ctx, CommonInfo, NumSGPR); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AMDGPUNumSGPRAttr *AMDGPUNumSGPRAttr::Create(ASTContext &Ctx, unsigned NumSGPR, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AMDGPUNumSGPRAttr(Ctx, CommonInfo, NumSGPR); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AMDGPUNumSGPRAttr *AMDGPUNumSGPRAttr::CreateImplicit(ASTContext &Ctx, unsigned NumSGPR, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_amdgpu_num_sgpr: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_num_sgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_amdgpu_num_sgpr: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_num_sgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, NumSGPR, I); } AMDGPUNumSGPRAttr *AMDGPUNumSGPRAttr::Create(ASTContext &Ctx, unsigned NumSGPR, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_amdgpu_num_sgpr: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_num_sgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_amdgpu_num_sgpr: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_num_sgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, NumSGPR, I); } AMDGPUNumSGPRAttr::AMDGPUNumSGPRAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned NumSGPR ) : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUNumSGPR, /*IsLateParsed=*/false, false) , numSGPR(NumSGPR) { } AMDGPUNumSGPRAttr *AMDGPUNumSGPRAttr::clone(ASTContext &C) const { auto *A = new (C) AMDGPUNumSGPRAttr(C, *this, numSGPR); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AMDGPUNumSGPRAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((amdgpu_num_sgpr"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNumSGPR() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::amdgpu_num_sgpr"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNumSGPR() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AMDGPUNumSGPRAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "amdgpu_num_sgpr"; case 1: return "amdgpu_num_sgpr"; } } // AMDGPUNumVGPRAttr implementation AMDGPUNumVGPRAttr *AMDGPUNumVGPRAttr::CreateImplicit(ASTContext &Ctx, unsigned NumVGPR, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AMDGPUNumVGPRAttr(Ctx, CommonInfo, NumVGPR); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AMDGPUNumVGPRAttr *AMDGPUNumVGPRAttr::Create(ASTContext &Ctx, unsigned NumVGPR, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AMDGPUNumVGPRAttr(Ctx, CommonInfo, NumVGPR); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AMDGPUNumVGPRAttr *AMDGPUNumVGPRAttr::CreateImplicit(ASTContext &Ctx, unsigned NumVGPR, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_amdgpu_num_vgpr: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_num_vgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_amdgpu_num_vgpr: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_num_vgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, NumVGPR, I); } AMDGPUNumVGPRAttr *AMDGPUNumVGPRAttr::Create(ASTContext &Ctx, unsigned NumVGPR, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_amdgpu_num_vgpr: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_num_vgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_amdgpu_num_vgpr: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_num_vgpr, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, NumVGPR, I); } AMDGPUNumVGPRAttr::AMDGPUNumVGPRAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned NumVGPR ) : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUNumVGPR, /*IsLateParsed=*/false, false) , numVGPR(NumVGPR) { } AMDGPUNumVGPRAttr *AMDGPUNumVGPRAttr::clone(ASTContext &C) const { auto *A = new (C) AMDGPUNumVGPRAttr(C, *this, numVGPR); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AMDGPUNumVGPRAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((amdgpu_num_vgpr"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNumVGPR() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::amdgpu_num_vgpr"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNumVGPR() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AMDGPUNumVGPRAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "amdgpu_num_vgpr"; case 1: return "amdgpu_num_vgpr"; } } // AMDGPUWavesPerEUAttr implementation AMDGPUWavesPerEUAttr *AMDGPUWavesPerEUAttr::CreateImplicit(ASTContext &Ctx, Expr * Min, Expr * Max, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AMDGPUWavesPerEUAttr(Ctx, CommonInfo, Min, Max); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AMDGPUWavesPerEUAttr *AMDGPUWavesPerEUAttr::Create(ASTContext &Ctx, Expr * Min, Expr * Max, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AMDGPUWavesPerEUAttr(Ctx, CommonInfo, Min, Max); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AMDGPUWavesPerEUAttr *AMDGPUWavesPerEUAttr::CreateImplicit(ASTContext &Ctx, Expr * Min, Expr * Max, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_amdgpu_waves_per_eu: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_waves_per_eu, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_amdgpu_waves_per_eu: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_waves_per_eu, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Min, Max, I); } AMDGPUWavesPerEUAttr *AMDGPUWavesPerEUAttr::Create(ASTContext &Ctx, Expr * Min, Expr * Max, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_amdgpu_waves_per_eu: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_amdgpu_waves_per_eu, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_amdgpu_waves_per_eu: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_amdgpu_waves_per_eu, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Min, Max, I); } AMDGPUWavesPerEUAttr::AMDGPUWavesPerEUAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Min , Expr * Max ) : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUWavesPerEU, /*IsLateParsed=*/false, false) , min(Min) , max(Max) { } AMDGPUWavesPerEUAttr::AMDGPUWavesPerEUAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Min ) : InheritableAttr(Ctx, CommonInfo, attr::AMDGPUWavesPerEU, /*IsLateParsed=*/false, false) , min(Min) , max() { } AMDGPUWavesPerEUAttr *AMDGPUWavesPerEUAttr::clone(ASTContext &C) const { auto *A = new (C) AMDGPUWavesPerEUAttr(C, *this, min, max); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AMDGPUWavesPerEUAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((amdgpu_waves_per_eu"; if (!getMax()) ++TrailingOmittedArgs; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMin()->printPretty(OS, nullptr, Policy); OS << ""; if (!(!getMax())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMax()->printPretty(OS, nullptr, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::amdgpu_waves_per_eu"; if (!getMax()) ++TrailingOmittedArgs; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMin()->printPretty(OS, nullptr, Policy); OS << ""; if (!(!getMax())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMax()->printPretty(OS, nullptr, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AMDGPUWavesPerEUAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "amdgpu_waves_per_eu"; case 1: return "amdgpu_waves_per_eu"; } } // ARMInterruptAttr implementation ARMInterruptAttr *ARMInterruptAttr::CreateImplicit(ASTContext &Ctx, ARMInterruptAttr::InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ARMInterruptAttr(Ctx, CommonInfo, Interrupt); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ARMInterruptAttr *ARMInterruptAttr::Create(ASTContext &Ctx, ARMInterruptAttr::InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ARMInterruptAttr(Ctx, CommonInfo, Interrupt); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ARMInterruptAttr *ARMInterruptAttr::CreateImplicit(ASTContext &Ctx, ARMInterruptAttr::InterruptType Interrupt, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Interrupt, I); } ARMInterruptAttr *ARMInterruptAttr::Create(ASTContext &Ctx, ARMInterruptAttr::InterruptType Interrupt, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Interrupt, I); } ARMInterruptAttr::ARMInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , ARMInterruptAttr::InterruptType Interrupt ) : InheritableAttr(Ctx, CommonInfo, attr::ARMInterrupt, /*IsLateParsed=*/false, false) , interrupt(Interrupt) { } ARMInterruptAttr::ARMInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ARMInterrupt, /*IsLateParsed=*/false, false) , interrupt(ARMInterruptAttr::InterruptType(0)) { } bool ARMInterruptAttr::ConvertStrToInterruptType(StringRef Val, ARMInterruptAttr::InterruptType &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("IRQ", ARMInterruptAttr::InterruptType::IRQ) .Case("FIQ", ARMInterruptAttr::InterruptType::FIQ) .Case("SWI", ARMInterruptAttr::InterruptType::SWI) .Case("ABORT", ARMInterruptAttr::InterruptType::ABORT) .Case("UNDEF", ARMInterruptAttr::InterruptType::UNDEF) .Case("", ARMInterruptAttr::InterruptType::Generic) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *ARMInterruptAttr::ConvertInterruptTypeToStr(ARMInterruptAttr::InterruptType Val) { switch(Val) { case ARMInterruptAttr::InterruptType::IRQ: return "IRQ"; case ARMInterruptAttr::InterruptType::FIQ: return "FIQ"; case ARMInterruptAttr::InterruptType::SWI: return "SWI"; case ARMInterruptAttr::InterruptType::ABORT: return "ABORT"; case ARMInterruptAttr::InterruptType::UNDEF: return "UNDEF"; case ARMInterruptAttr::InterruptType::Generic: return ""; } llvm_unreachable("No enumerator with that value"); } ARMInterruptAttr *ARMInterruptAttr::clone(ASTContext &C) const { auto *A = new (C) ARMInterruptAttr(C, *this, interrupt); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ARMInterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((interrupt"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << ARMInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::interrupt"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << ARMInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::interrupt"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << ARMInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ARMInterruptAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "interrupt"; case 1: return "interrupt"; case 2: return "interrupt"; } } // AVRInterruptAttr implementation AVRInterruptAttr *AVRInterruptAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AVRInterruptAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AVRInterruptAttr *AVRInterruptAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AVRInterruptAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AVRInterruptAttr *AVRInterruptAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } AVRInterruptAttr *AVRInterruptAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } AVRInterruptAttr::AVRInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AVRInterrupt, /*IsLateParsed=*/false, false) { } AVRInterruptAttr *AVRInterruptAttr::clone(ASTContext &C) const { auto *A = new (C) AVRInterruptAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AVRInterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((interrupt"; OS << "))"; break; } case 1 : { OS << "[[gnu::interrupt"; OS << "]]"; break; } case 2 : { OS << "[[gnu::interrupt"; OS << "]]"; break; } } } const char *AVRInterruptAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "interrupt"; case 1: return "interrupt"; case 2: return "interrupt"; } } // AVRSignalAttr implementation AVRSignalAttr *AVRSignalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AVRSignalAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AVRSignalAttr *AVRSignalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AVRSignalAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AVRSignalAttr *AVRSignalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_signal: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_signal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_signal: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_signal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_signal: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_signal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } AVRSignalAttr *AVRSignalAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_signal: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_signal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_signal: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_signal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_signal: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_signal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } AVRSignalAttr::AVRSignalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AVRSignal, /*IsLateParsed=*/false, false) { } AVRSignalAttr *AVRSignalAttr::clone(ASTContext &C) const { auto *A = new (C) AVRSignalAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AVRSignalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((signal"; OS << "))"; break; } case 1 : { OS << "[[gnu::signal"; OS << "]]"; break; } case 2 : { OS << "[[gnu::signal"; OS << "]]"; break; } } } const char *AVRSignalAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "signal"; case 1: return "signal"; case 2: return "signal"; } } // AbiTagAttr implementation AbiTagAttr *AbiTagAttr::CreateImplicit(ASTContext &Ctx, StringRef *Tags, unsigned TagsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AbiTagAttr(Ctx, CommonInfo, Tags, TagsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AbiTagAttr *AbiTagAttr::Create(ASTContext &Ctx, StringRef *Tags, unsigned TagsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AbiTagAttr(Ctx, CommonInfo, Tags, TagsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AbiTagAttr *AbiTagAttr::CreateImplicit(ASTContext &Ctx, StringRef *Tags, unsigned TagsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_abi_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_abi_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_abi_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_abi_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Tags, TagsSize, I); } AbiTagAttr *AbiTagAttr::Create(ASTContext &Ctx, StringRef *Tags, unsigned TagsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_abi_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_abi_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_abi_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_abi_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Tags, TagsSize, I); } AbiTagAttr::AbiTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , StringRef *Tags, unsigned TagsSize ) : Attr(Ctx, CommonInfo, attr::AbiTag, /*IsLateParsed=*/false) , tags_Size(TagsSize), tags_(new (Ctx, 16) StringRef[tags_Size]) { for (size_t I = 0, E = tags_Size; I != E; ++I) { StringRef Ref = Tags[I]; if (!Ref.empty()) { char *Mem = new (Ctx, 1) char[Ref.size()]; std::memcpy(Mem, Ref.data(), Ref.size()); tags_[I] = StringRef(Mem, Ref.size()); } } } AbiTagAttr::AbiTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::AbiTag, /*IsLateParsed=*/false) , tags_Size(0), tags_(nullptr) { } AbiTagAttr *AbiTagAttr::clone(ASTContext &C) const { auto *A = new (C) AbiTagAttr(C, *this, tags_, tags_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AbiTagAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((abi_tag"; OS << ""; for (const auto &Val : tags()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::abi_tag"; OS << ""; for (const auto &Val : tags()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AbiTagAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "abi_tag"; case 1: return "abi_tag"; } } // AcquireCapabilityAttr implementation AcquireCapabilityAttr *AcquireCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AcquireCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AcquireCapabilityAttr *AcquireCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AcquireCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); return A; } AcquireCapabilityAttr *AcquireCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_acquire_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_acquire_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_acquire_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_acquire_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_exclusive_lock_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_exclusive_lock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_shared_lock_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared_lock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Args, ArgsSize, I); } AcquireCapabilityAttr *AcquireCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_acquire_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_acquire_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_acquire_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_acquire_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_exclusive_lock_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_exclusive_lock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_shared_lock_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared_lock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Args, ArgsSize, I); } AcquireCapabilityAttr::AcquireCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * *Args, unsigned ArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::AcquireCapability, /*IsLateParsed=*/true, true) , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) { std::copy(Args, Args + args_Size, args_); } AcquireCapabilityAttr::AcquireCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AcquireCapability, /*IsLateParsed=*/true, true) , args_Size(0), args_(nullptr) { } AcquireCapabilityAttr::Spelling AcquireCapabilityAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_acquire_capability; case 1: return CXX11_clang_acquire_capability; case 2: return GNU_acquire_shared_capability; case 3: return CXX11_clang_acquire_shared_capability; case 4: return GNU_exclusive_lock_function; case 5: return GNU_shared_lock_function; } } AcquireCapabilityAttr *AcquireCapabilityAttr::clone(ASTContext &C) const { auto *A = new (C) AcquireCapabilityAttr(C, *this, args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AcquireCapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((acquire_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::acquire_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "__attribute__((acquire_shared_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 3 : { OS << "[[clang::acquire_shared_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 4 : { OS << "__attribute__((exclusive_lock_function"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 5 : { OS << "__attribute__((shared_lock_function"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *AcquireCapabilityAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "acquire_capability"; case 1: return "acquire_capability"; case 2: return "acquire_shared_capability"; case 3: return "acquire_shared_capability"; case 4: return "exclusive_lock_function"; case 5: return "shared_lock_function"; } } // AcquireHandleAttr implementation AcquireHandleAttr *AcquireHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AcquireHandleAttr(Ctx, CommonInfo, HandleType); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AcquireHandleAttr *AcquireHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AcquireHandleAttr(Ctx, CommonInfo, HandleType); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AcquireHandleAttr *AcquireHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_acquire_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_acquire_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_acquire_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_acquire_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_acquire_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_acquire_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, HandleType, I); } AcquireHandleAttr *AcquireHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_acquire_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_acquire_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_acquire_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_acquire_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_acquire_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_acquire_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, HandleType, I); } AcquireHandleAttr::AcquireHandleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef HandleType ) : InheritableAttr(Ctx, CommonInfo, attr::AcquireHandle, /*IsLateParsed=*/false, false) , handleTypeLength(HandleType.size()),handleType(new (Ctx, 1) char[handleTypeLength]) { if (!HandleType.empty()) std::memcpy(handleType, HandleType.data(), handleTypeLength); } AcquireHandleAttr *AcquireHandleAttr::clone(ASTContext &C) const { auto *A = new (C) AcquireHandleAttr(C, *this, getHandleType()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AcquireHandleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((acquire_handle"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getHandleType() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::acquire_handle"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getHandleType() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::acquire_handle"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getHandleType() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AcquireHandleAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "acquire_handle"; case 1: return "acquire_handle"; case 2: return "acquire_handle"; } } // AcquiredAfterAttr implementation AcquiredAfterAttr *AcquiredAfterAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AcquiredAfterAttr(Ctx, CommonInfo, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AcquiredAfterAttr *AcquiredAfterAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AcquiredAfterAttr(Ctx, CommonInfo, Args, ArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AcquiredAfterAttr *AcquiredAfterAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Args, ArgsSize, I); } AcquiredAfterAttr *AcquiredAfterAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Args, ArgsSize, I); } AcquiredAfterAttr::AcquiredAfterAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * *Args, unsigned ArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::AcquiredAfter, /*IsLateParsed=*/true, true) , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) { std::copy(Args, Args + args_Size, args_); } AcquiredAfterAttr::AcquiredAfterAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AcquiredAfter, /*IsLateParsed=*/true, true) , args_Size(0), args_(nullptr) { } AcquiredAfterAttr *AcquiredAfterAttr::clone(ASTContext &C) const { auto *A = new (C) AcquiredAfterAttr(C, *this, args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AcquiredAfterAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((acquired_after"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *AcquiredAfterAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "acquired_after"; } } // AcquiredBeforeAttr implementation AcquiredBeforeAttr *AcquiredBeforeAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AcquiredBeforeAttr(Ctx, CommonInfo, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AcquiredBeforeAttr *AcquiredBeforeAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AcquiredBeforeAttr(Ctx, CommonInfo, Args, ArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AcquiredBeforeAttr *AcquiredBeforeAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Args, ArgsSize, I); } AcquiredBeforeAttr *AcquiredBeforeAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Args, ArgsSize, I); } AcquiredBeforeAttr::AcquiredBeforeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * *Args, unsigned ArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::AcquiredBefore, /*IsLateParsed=*/true, true) , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) { std::copy(Args, Args + args_Size, args_); } AcquiredBeforeAttr::AcquiredBeforeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AcquiredBefore, /*IsLateParsed=*/true, true) , args_Size(0), args_(nullptr) { } AcquiredBeforeAttr *AcquiredBeforeAttr::clone(ASTContext &C) const { auto *A = new (C) AcquiredBeforeAttr(C, *this, args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AcquiredBeforeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((acquired_before"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *AcquiredBeforeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "acquired_before"; } } // AddressSpaceAttr implementation AddressSpaceAttr *AddressSpaceAttr::CreateImplicit(ASTContext &Ctx, int AddressSpace, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AddressSpaceAttr(Ctx, CommonInfo, AddressSpace); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AddressSpaceAttr *AddressSpaceAttr::Create(ASTContext &Ctx, int AddressSpace, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AddressSpaceAttr(Ctx, CommonInfo, AddressSpace); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AddressSpaceAttr *AddressSpaceAttr::CreateImplicit(ASTContext &Ctx, int AddressSpace, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_address_space: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_address_space, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_address_space: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_address_space, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_address_space: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_address_space, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, AddressSpace, I); } AddressSpaceAttr *AddressSpaceAttr::Create(ASTContext &Ctx, int AddressSpace, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_address_space: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_address_space, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_address_space: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_address_space, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_address_space: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_address_space, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, AddressSpace, I); } AddressSpaceAttr::AddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , int AddressSpace ) : TypeAttr(Ctx, CommonInfo, attr::AddressSpace, /*IsLateParsed=*/false) , addressSpace(AddressSpace) { } AddressSpaceAttr *AddressSpaceAttr::clone(ASTContext &C) const { auto *A = new (C) AddressSpaceAttr(C, *this, addressSpace); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((address_space"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getAddressSpace() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::address_space"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getAddressSpace() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::address_space"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getAddressSpace() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AddressSpaceAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "address_space"; case 1: return "address_space"; case 2: return "address_space"; } } // AliasAttr implementation AliasAttr *AliasAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Aliasee, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AliasAttr(Ctx, CommonInfo, Aliasee); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AliasAttr *AliasAttr::Create(ASTContext &Ctx, llvm::StringRef Aliasee, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AliasAttr(Ctx, CommonInfo, Aliasee); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AliasAttr *AliasAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Aliasee, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Aliasee, I); } AliasAttr *AliasAttr::Create(ASTContext &Ctx, llvm::StringRef Aliasee, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Aliasee, I); } AliasAttr::AliasAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Aliasee ) : Attr(Ctx, CommonInfo, attr::Alias, /*IsLateParsed=*/false) , aliaseeLength(Aliasee.size()),aliasee(new (Ctx, 1) char[aliaseeLength]) { if (!Aliasee.empty()) std::memcpy(aliasee, Aliasee.data(), aliaseeLength); } AliasAttr *AliasAttr::clone(ASTContext &C) const { auto *A = new (C) AliasAttr(C, *this, getAliasee()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AliasAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((alias"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getAliasee() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::alias"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getAliasee() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::alias"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getAliasee() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AliasAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "alias"; case 1: return "alias"; case 2: return "alias"; } } // AlignMac68kAttr implementation AlignMac68kAttr *AlignMac68kAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AlignMac68kAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AlignMac68kAttr *AlignMac68kAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AlignMac68kAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AlignMac68kAttr *AlignMac68kAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, I); } AlignMac68kAttr *AlignMac68kAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, I); } AlignMac68kAttr::AlignMac68kAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AlignMac68k, /*IsLateParsed=*/false, false) { } AlignMac68kAttr *AlignMac68kAttr::clone(ASTContext &C) const { auto *A = new (C) AlignMac68kAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AlignMac68kAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *AlignMac68kAttr::getSpelling() const { return "(No spelling)"; } // AlignNaturalAttr implementation AlignNaturalAttr *AlignNaturalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AlignNaturalAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AlignNaturalAttr *AlignNaturalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AlignNaturalAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AlignNaturalAttr *AlignNaturalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, I); } AlignNaturalAttr *AlignNaturalAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, I); } AlignNaturalAttr::AlignNaturalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AlignNatural, /*IsLateParsed=*/false, false) { } AlignNaturalAttr *AlignNaturalAttr::clone(ASTContext &C) const { auto *A = new (C) AlignNaturalAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AlignNaturalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *AlignNaturalAttr::getSpelling() const { return "(No spelling)"; } // AlignValueAttr implementation AlignValueAttr *AlignValueAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AlignValueAttr(Ctx, CommonInfo, Alignment); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AlignValueAttr *AlignValueAttr::Create(ASTContext &Ctx, Expr * Alignment, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AlignValueAttr(Ctx, CommonInfo, Alignment); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AlignValueAttr *AlignValueAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Alignment, I); } AlignValueAttr *AlignValueAttr::Create(ASTContext &Ctx, Expr * Alignment, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Alignment, I); } AlignValueAttr::AlignValueAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Alignment ) : Attr(Ctx, CommonInfo, attr::AlignValue, /*IsLateParsed=*/false) , alignment(Alignment) { } AlignValueAttr *AlignValueAttr::clone(ASTContext &C) const { auto *A = new (C) AlignValueAttr(C, *this, alignment); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AlignValueAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((align_value"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getAlignment()->printPretty(OS, nullptr, Policy); OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *AlignValueAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "align_value"; } } // AlignedAttr implementation AlignedAttr *AlignedAttr::CreateImplicit(ASTContext &Ctx, bool IsAlignmentExpr, void *Alignment, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AlignedAttr(Ctx, CommonInfo, IsAlignmentExpr, Alignment); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AlignedAttr *AlignedAttr::Create(ASTContext &Ctx, bool IsAlignmentExpr, void *Alignment, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AlignedAttr(Ctx, CommonInfo, IsAlignmentExpr, Alignment); return A; } AlignedAttr *AlignedAttr::CreateImplicit(ASTContext &Ctx, bool IsAlignmentExpr, void *Alignment, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_aligned: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_aligned: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_aligned: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_align: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_alignas: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_alignas, true /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_Alignas: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_Alignas, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, IsAlignmentExpr, Alignment, I); } AlignedAttr *AlignedAttr::Create(ASTContext &Ctx, bool IsAlignmentExpr, void *Alignment, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_aligned: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_aligned: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_aligned: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_align: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_alignas: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_alignas, true /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_Alignas: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_Alignas, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, IsAlignmentExpr, Alignment, I); } AlignedAttr::AlignedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , bool IsAlignmentExpr, void *Alignment ) : InheritableAttr(Ctx, CommonInfo, attr::Aligned, /*IsLateParsed=*/false, false) , isalignmentExpr(IsAlignmentExpr) { if (isalignmentExpr) alignmentExpr = reinterpret_cast(Alignment); else alignmentType = reinterpret_cast(Alignment); } AlignedAttr::AlignedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Aligned, /*IsLateParsed=*/false, false) , isalignmentExpr(false) { } AlignedAttr::Spelling AlignedAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_aligned; case 1: return CXX11_gnu_aligned; case 2: return C23_gnu_aligned; case 3: return Declspec_align; case 4: return Keyword_alignas; case 5: return Keyword_Alignas; } } bool AlignedAttr::isAlignmentDependent() const { if (isalignmentExpr) return alignmentExpr && (alignmentExpr->isValueDependent() || alignmentExpr->isTypeDependent()); else return alignmentType->getType()->isDependentType(); } bool AlignedAttr::isAlignmentErrorDependent() const { if (isalignmentExpr) return alignmentExpr && alignmentExpr->containsErrors(); return alignmentType->getType()->containsErrors(); } AlignedAttr *AlignedAttr::clone(ASTContext &C) const { auto *A = new (C) AlignedAttr(C, *this, isalignmentExpr, isalignmentExpr ? static_cast(alignmentExpr) : alignmentType); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AlignedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((aligned"; if (!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType))) ++TrailingOmittedArgs; if (!(!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; if (isalignmentExpr && alignmentExpr) alignmentExpr->printPretty(OS, nullptr, Policy); if (!isalignmentExpr && alignmentType) alignmentType->getType().print(OS, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::aligned"; if (!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType))) ++TrailingOmittedArgs; if (!(!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; if (isalignmentExpr && alignmentExpr) alignmentExpr->printPretty(OS, nullptr, Policy); if (!isalignmentExpr && alignmentType) alignmentType->getType().print(OS, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::aligned"; if (!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType))) ++TrailingOmittedArgs; if (!(!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; if (isalignmentExpr && alignmentExpr) alignmentExpr->printPretty(OS, nullptr, Policy); if (!isalignmentExpr && alignmentType) alignmentType->getType().print(OS, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 3 : { OS << "__declspec(align"; if (!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType))) ++TrailingOmittedArgs; if (!(!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; if (isalignmentExpr && alignmentExpr) alignmentExpr->printPretty(OS, nullptr, Policy); if (!isalignmentExpr && alignmentType) alignmentType->getType().print(OS, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << ")"; break; } case 4 : { OS << "alignas"; if (!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType))) ++TrailingOmittedArgs; if (!(!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; if (isalignmentExpr && alignmentExpr) alignmentExpr->printPretty(OS, nullptr, Policy); if (!isalignmentExpr && alignmentType) alignmentType->getType().print(OS, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << ""; break; } case 5 : { OS << "_Alignas"; if (!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType))) ++TrailingOmittedArgs; if (!(!((isalignmentExpr && alignmentExpr) || (!isalignmentExpr && alignmentType)))) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; if (isalignmentExpr && alignmentExpr) alignmentExpr->printPretty(OS, nullptr, Policy); if (!isalignmentExpr && alignmentType) alignmentType->getType().print(OS, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << ""; break; } } } const char *AlignedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "aligned"; case 1: return "aligned"; case 2: return "aligned"; case 3: return "align"; case 4: return "alignas"; case 5: return "_Alignas"; } } // AllocAlignAttr implementation AllocAlignAttr *AllocAlignAttr::CreateImplicit(ASTContext &Ctx, ParamIdx ParamIndex, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AllocAlignAttr(Ctx, CommonInfo, ParamIndex); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AllocAlignAttr *AllocAlignAttr::Create(ASTContext &Ctx, ParamIdx ParamIndex, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AllocAlignAttr(Ctx, CommonInfo, ParamIndex); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AllocAlignAttr *AllocAlignAttr::CreateImplicit(ASTContext &Ctx, ParamIdx ParamIndex, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_alloc_align: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_alloc_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_alloc_align: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_alloc_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_alloc_align: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_alloc_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, ParamIndex, I); } AllocAlignAttr *AllocAlignAttr::Create(ASTContext &Ctx, ParamIdx ParamIndex, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_alloc_align: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_alloc_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_alloc_align: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_alloc_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_alloc_align: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_alloc_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, ParamIndex, I); } AllocAlignAttr::AllocAlignAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , ParamIdx ParamIndex ) : InheritableAttr(Ctx, CommonInfo, attr::AllocAlign, /*IsLateParsed=*/false, false) , paramIndex(ParamIndex) { } AllocAlignAttr *AllocAlignAttr::clone(ASTContext &C) const { auto *A = new (C) AllocAlignAttr(C, *this, paramIndex); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AllocAlignAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((alloc_align"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getParamIndex().getSourceIndex() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::alloc_align"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getParamIndex().getSourceIndex() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::alloc_align"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getParamIndex().getSourceIndex() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AllocAlignAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "alloc_align"; case 1: return "alloc_align"; case 2: return "alloc_align"; } } // AllocSizeAttr implementation AllocSizeAttr *AllocSizeAttr::CreateImplicit(ASTContext &Ctx, ParamIdx ElemSizeParam, ParamIdx NumElemsParam, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AllocSizeAttr(Ctx, CommonInfo, ElemSizeParam, NumElemsParam); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AllocSizeAttr *AllocSizeAttr::Create(ASTContext &Ctx, ParamIdx ElemSizeParam, ParamIdx NumElemsParam, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AllocSizeAttr(Ctx, CommonInfo, ElemSizeParam, NumElemsParam); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AllocSizeAttr *AllocSizeAttr::CreateImplicit(ASTContext &Ctx, ParamIdx ElemSizeParam, ParamIdx NumElemsParam, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_alloc_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_alloc_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_alloc_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_alloc_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_alloc_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_alloc_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, ElemSizeParam, NumElemsParam, I); } AllocSizeAttr *AllocSizeAttr::Create(ASTContext &Ctx, ParamIdx ElemSizeParam, ParamIdx NumElemsParam, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_alloc_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_alloc_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_alloc_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_alloc_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_alloc_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_alloc_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, ElemSizeParam, NumElemsParam, I); } AllocSizeAttr::AllocSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , ParamIdx ElemSizeParam , ParamIdx NumElemsParam ) : InheritableAttr(Ctx, CommonInfo, attr::AllocSize, /*IsLateParsed=*/false, false) , elemSizeParam(ElemSizeParam) , numElemsParam(NumElemsParam) { } AllocSizeAttr::AllocSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , ParamIdx ElemSizeParam ) : InheritableAttr(Ctx, CommonInfo, attr::AllocSize, /*IsLateParsed=*/false, false) , elemSizeParam(ElemSizeParam) , numElemsParam() { } AllocSizeAttr *AllocSizeAttr::clone(ASTContext &C) const { auto *A = new (C) AllocSizeAttr(C, *this, elemSizeParam, numElemsParam); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AllocSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((alloc_size"; if (!getNumElemsParam().isValid()) ++TrailingOmittedArgs; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getElemSizeParam().getSourceIndex() << ""; if (!(!getNumElemsParam().isValid())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNumElemsParam().getSourceIndex() << ""; } if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::alloc_size"; if (!getNumElemsParam().isValid()) ++TrailingOmittedArgs; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getElemSizeParam().getSourceIndex() << ""; if (!(!getNumElemsParam().isValid())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNumElemsParam().getSourceIndex() << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::alloc_size"; if (!getNumElemsParam().isValid()) ++TrailingOmittedArgs; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getElemSizeParam().getSourceIndex() << ""; if (!(!getNumElemsParam().isValid())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNumElemsParam().getSourceIndex() << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AllocSizeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "alloc_size"; case 1: return "alloc_size"; case 2: return "alloc_size"; } } // AllocatingAttr implementation AllocatingAttr *AllocatingAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AllocatingAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AllocatingAttr *AllocatingAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AllocatingAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AllocatingAttr *AllocatingAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_allocating: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_allocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_allocating: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_allocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_allocating: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_allocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } AllocatingAttr *AllocatingAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_allocating: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_allocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_allocating: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_allocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_allocating: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_allocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } AllocatingAttr::AllocatingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::Allocating, /*IsLateParsed=*/false) { } AllocatingAttr *AllocatingAttr::clone(ASTContext &C) const { auto *A = new (C) AllocatingAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AllocatingAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((allocating"; OS << "))"; break; } case 1 : { OS << "[[clang::allocating"; OS << "]]"; break; } case 2 : { OS << "[[clang::allocating"; OS << "]]"; break; } } } const char *AllocatingAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "allocating"; case 1: return "allocating"; case 2: return "allocating"; } } // AlwaysDestroyAttr implementation AlwaysDestroyAttr *AlwaysDestroyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AlwaysDestroyAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AlwaysDestroyAttr *AlwaysDestroyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AlwaysDestroyAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AlwaysDestroyAttr *AlwaysDestroyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_always_destroy: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_always_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_always_destroy: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_always_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } AlwaysDestroyAttr *AlwaysDestroyAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_always_destroy: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_always_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_always_destroy: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_always_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } AlwaysDestroyAttr::AlwaysDestroyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AlwaysDestroy, /*IsLateParsed=*/false, false) { } AlwaysDestroyAttr *AlwaysDestroyAttr::clone(ASTContext &C) const { auto *A = new (C) AlwaysDestroyAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AlwaysDestroyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((always_destroy"; OS << "))"; break; } case 1 : { OS << "[[clang::always_destroy"; OS << "]]"; break; } } } const char *AlwaysDestroyAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "always_destroy"; case 1: return "always_destroy"; } } // AlwaysInlineAttr implementation AlwaysInlineAttr *AlwaysInlineAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AlwaysInlineAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AlwaysInlineAttr *AlwaysInlineAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AlwaysInlineAttr(Ctx, CommonInfo); return A; } AlwaysInlineAttr *AlwaysInlineAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_always_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_always_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_always_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_always_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_always_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_forceinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_forceinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } AlwaysInlineAttr *AlwaysInlineAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_always_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_always_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_always_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_always_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_always_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_always_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_forceinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_forceinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } AlwaysInlineAttr::AlwaysInlineAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : DeclOrStmtAttr(Ctx, CommonInfo, attr::AlwaysInline, /*IsLateParsed=*/false, false) { } AlwaysInlineAttr::Spelling AlwaysInlineAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_always_inline; case 1: return CXX11_gnu_always_inline; case 2: return C23_gnu_always_inline; case 3: return CXX11_clang_always_inline; case 4: return C23_clang_always_inline; case 5: return Keyword_forceinline; } } AlwaysInlineAttr *AlwaysInlineAttr::clone(ASTContext &C) const { auto *A = new (C) AlwaysInlineAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AlwaysInlineAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((always_inline"; OS << "))"; break; } case 1 : { OS << "[[gnu::always_inline"; OS << "]]"; break; } case 2 : { OS << "[[gnu::always_inline"; OS << "]]"; break; } case 3 : { OS << "[[clang::always_inline"; OS << "]]"; break; } case 4 : { OS << "[[clang::always_inline"; OS << "]]"; break; } case 5 : { OS << "__forceinline"; OS << ""; break; } } } const char *AlwaysInlineAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "always_inline"; case 1: return "always_inline"; case 2: return "always_inline"; case 3: return "always_inline"; case 4: return "always_inline"; case 5: return "__forceinline"; } } // AnalyzerNoReturnAttr implementation AnalyzerNoReturnAttr *AnalyzerNoReturnAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnalyzerNoReturnAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AnalyzerNoReturnAttr *AnalyzerNoReturnAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnalyzerNoReturnAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AnalyzerNoReturnAttr *AnalyzerNoReturnAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } AnalyzerNoReturnAttr *AnalyzerNoReturnAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } AnalyzerNoReturnAttr::AnalyzerNoReturnAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AnalyzerNoReturn, /*IsLateParsed=*/false, false) { } AnalyzerNoReturnAttr *AnalyzerNoReturnAttr::clone(ASTContext &C) const { auto *A = new (C) AnalyzerNoReturnAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AnalyzerNoReturnAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((analyzer_noreturn"; OS << "))"; break; } } } const char *AnalyzerNoReturnAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "analyzer_noreturn"; } } // AnnotateAttr implementation AnnotateAttr *AnnotateAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnnotateAttr(Ctx, CommonInfo, Annotation, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AnnotateAttr *AnnotateAttr::Create(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnnotateAttr(Ctx, CommonInfo, Annotation, Args, ArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AnnotateAttr *AnnotateAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_annotate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_annotate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_annotate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Annotation, Args, ArgsSize, I); } AnnotateAttr *AnnotateAttr::Create(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_annotate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_annotate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_annotate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Annotation, Args, ArgsSize, I); } AnnotateAttr *AnnotateAttr::CreateImplicitWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnnotateAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); A->setDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize); return A; } AnnotateAttr *AnnotateAttr::CreateWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnnotateAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); A->setDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize); return A; } AnnotateAttr *AnnotateAttr::CreateImplicitWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_annotate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_annotate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_annotate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicitWithDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize, I); } AnnotateAttr *AnnotateAttr::CreateWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_annotate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_annotate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_annotate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateWithDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize, I); } AnnotateAttr::AnnotateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Annotation , Expr * *Args, unsigned ArgsSize ) : InheritableParamAttr(Ctx, CommonInfo, attr::Annotate, /*IsLateParsed=*/false, false) , annotationLength(Annotation.size()),annotation(new (Ctx, 1) char[annotationLength]) , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) , delayedArgs_Size(0), delayedArgs_(nullptr) { if (!Annotation.empty()) std::memcpy(annotation, Annotation.data(), annotationLength); std::copy(Args, Args + args_Size, args_); } AnnotateAttr::AnnotateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Annotation ) : InheritableParamAttr(Ctx, CommonInfo, attr::Annotate, /*IsLateParsed=*/false, false) , annotationLength(Annotation.size()),annotation(new (Ctx, 1) char[annotationLength]) , args_Size(0), args_(nullptr) , delayedArgs_Size(0), delayedArgs_(nullptr) { if (!Annotation.empty()) std::memcpy(annotation, Annotation.data(), annotationLength); } AnnotateAttr::AnnotateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableParamAttr(Ctx, CommonInfo, attr::Annotate, /*IsLateParsed=*/false, false) , annotationLength(0),annotation(nullptr) , args_Size(0), args_(nullptr) , delayedArgs_Size(0), delayedArgs_(nullptr) { } AnnotateAttr *AnnotateAttr::clone(ASTContext &C) const { auto *A = new (C) AnnotateAttr(C, *this, getAnnotation(), args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); A->setDelayedArgs(C, delayedArgs_, delayedArgs_Size); return A; } void AnnotateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((annotate"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getAnnotation() << "\""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::annotate"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getAnnotation() << "\""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::annotate"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getAnnotation() << "\""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AnnotateAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "annotate"; case 1: return "annotate"; case 2: return "annotate"; } } // AnnotateTypeAttr implementation AnnotateTypeAttr *AnnotateTypeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnnotateTypeAttr(Ctx, CommonInfo, Annotation, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AnnotateTypeAttr *AnnotateTypeAttr::Create(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnnotateTypeAttr(Ctx, CommonInfo, Annotation, Args, ArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AnnotateTypeAttr *AnnotateTypeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_clang_annotate_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_annotate_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Annotation, Args, ArgsSize, I); } AnnotateTypeAttr *AnnotateTypeAttr::Create(ASTContext &Ctx, llvm::StringRef Annotation, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_clang_annotate_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_annotate_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Annotation, Args, ArgsSize, I); } AnnotateTypeAttr *AnnotateTypeAttr::CreateImplicitWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnnotateTypeAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); A->setDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize); return A; } AnnotateTypeAttr *AnnotateTypeAttr::CreateWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnnotateTypeAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); A->setDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize); return A; } AnnotateTypeAttr *AnnotateTypeAttr::CreateImplicitWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_clang_annotate_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_annotate_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicitWithDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize, I); } AnnotateTypeAttr *AnnotateTypeAttr::CreateWithDelayedArgs(ASTContext &Ctx, Expr * *DelayedArgs, unsigned DelayedArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_clang_annotate_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_annotate_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_annotate_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateWithDelayedArgs(Ctx, DelayedArgs, DelayedArgsSize, I); } AnnotateTypeAttr::AnnotateTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Annotation , Expr * *Args, unsigned ArgsSize ) : TypeAttr(Ctx, CommonInfo, attr::AnnotateType, /*IsLateParsed=*/false) , annotationLength(Annotation.size()),annotation(new (Ctx, 1) char[annotationLength]) , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) , delayedArgs_Size(0), delayedArgs_(nullptr) { if (!Annotation.empty()) std::memcpy(annotation, Annotation.data(), annotationLength); std::copy(Args, Args + args_Size, args_); } AnnotateTypeAttr::AnnotateTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Annotation ) : TypeAttr(Ctx, CommonInfo, attr::AnnotateType, /*IsLateParsed=*/false) , annotationLength(Annotation.size()),annotation(new (Ctx, 1) char[annotationLength]) , args_Size(0), args_(nullptr) , delayedArgs_Size(0), delayedArgs_(nullptr) { if (!Annotation.empty()) std::memcpy(annotation, Annotation.data(), annotationLength); } AnnotateTypeAttr::AnnotateTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::AnnotateType, /*IsLateParsed=*/false) , annotationLength(0),annotation(nullptr) , args_Size(0), args_(nullptr) , delayedArgs_Size(0), delayedArgs_(nullptr) { } AnnotateTypeAttr *AnnotateTypeAttr::clone(ASTContext &C) const { auto *A = new (C) AnnotateTypeAttr(C, *this, getAnnotation(), args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); A->setDelayedArgs(C, delayedArgs_, delayedArgs_Size); return A; } void AnnotateTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[clang::annotate_type"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getAnnotation() << "\""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 1 : { OS << "[[clang::annotate_type"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getAnnotation() << "\""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AnnotateTypeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "annotate_type"; case 1: return "annotate_type"; } } // AnyX86InterruptAttr implementation AnyX86InterruptAttr *AnyX86InterruptAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnyX86InterruptAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AnyX86InterruptAttr *AnyX86InterruptAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnyX86InterruptAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AnyX86InterruptAttr *AnyX86InterruptAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } AnyX86InterruptAttr *AnyX86InterruptAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } AnyX86InterruptAttr::AnyX86InterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AnyX86Interrupt, /*IsLateParsed=*/false, false) { } AnyX86InterruptAttr *AnyX86InterruptAttr::clone(ASTContext &C) const { auto *A = new (C) AnyX86InterruptAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AnyX86InterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((interrupt"; OS << "))"; break; } case 1 : { OS << "[[gnu::interrupt"; OS << "]]"; break; } case 2 : { OS << "[[gnu::interrupt"; OS << "]]"; break; } } } const char *AnyX86InterruptAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "interrupt"; case 1: return "interrupt"; case 2: return "interrupt"; } } // AnyX86NoCallerSavedRegistersAttr implementation AnyX86NoCallerSavedRegistersAttr *AnyX86NoCallerSavedRegistersAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnyX86NoCallerSavedRegistersAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AnyX86NoCallerSavedRegistersAttr *AnyX86NoCallerSavedRegistersAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnyX86NoCallerSavedRegistersAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AnyX86NoCallerSavedRegistersAttr *AnyX86NoCallerSavedRegistersAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_caller_saved_registers: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_caller_saved_registers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_no_caller_saved_registers: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_caller_saved_registers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_no_caller_saved_registers: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_caller_saved_registers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } AnyX86NoCallerSavedRegistersAttr *AnyX86NoCallerSavedRegistersAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_caller_saved_registers: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_caller_saved_registers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_no_caller_saved_registers: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_caller_saved_registers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_no_caller_saved_registers: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_caller_saved_registers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } AnyX86NoCallerSavedRegistersAttr::AnyX86NoCallerSavedRegistersAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AnyX86NoCallerSavedRegisters, /*IsLateParsed=*/false, false) { } AnyX86NoCallerSavedRegistersAttr *AnyX86NoCallerSavedRegistersAttr::clone(ASTContext &C) const { auto *A = new (C) AnyX86NoCallerSavedRegistersAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AnyX86NoCallerSavedRegistersAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((no_caller_saved_registers"; OS << "))"; break; } case 1 : { OS << "[[gnu::no_caller_saved_registers"; OS << "]]"; break; } case 2 : { OS << "[[gnu::no_caller_saved_registers"; OS << "]]"; break; } } } const char *AnyX86NoCallerSavedRegistersAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "no_caller_saved_registers"; case 1: return "no_caller_saved_registers"; case 2: return "no_caller_saved_registers"; } } // AnyX86NoCfCheckAttr implementation AnyX86NoCfCheckAttr *AnyX86NoCfCheckAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnyX86NoCfCheckAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AnyX86NoCfCheckAttr *AnyX86NoCfCheckAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AnyX86NoCfCheckAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AnyX86NoCfCheckAttr *AnyX86NoCfCheckAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nocf_check: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nocf_check, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_nocf_check: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nocf_check, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_nocf_check: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nocf_check, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } AnyX86NoCfCheckAttr *AnyX86NoCfCheckAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nocf_check: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nocf_check, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_nocf_check: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nocf_check, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_nocf_check: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nocf_check, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } AnyX86NoCfCheckAttr::AnyX86NoCfCheckAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AnyX86NoCfCheck, /*IsLateParsed=*/false, false) { } AnyX86NoCfCheckAttr *AnyX86NoCfCheckAttr::clone(ASTContext &C) const { auto *A = new (C) AnyX86NoCfCheckAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AnyX86NoCfCheckAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((nocf_check"; OS << "))"; break; } case 1 : { OS << "[[gnu::nocf_check"; OS << "]]"; break; } case 2 : { OS << "[[gnu::nocf_check"; OS << "]]"; break; } } } const char *AnyX86NoCfCheckAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "nocf_check"; case 1: return "nocf_check"; case 2: return "nocf_check"; } } // ArcWeakrefUnavailableAttr implementation ArcWeakrefUnavailableAttr *ArcWeakrefUnavailableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArcWeakrefUnavailableAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArcWeakrefUnavailableAttr *ArcWeakrefUnavailableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArcWeakrefUnavailableAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArcWeakrefUnavailableAttr *ArcWeakrefUnavailableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_arc_weak_reference_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_arc_weak_reference_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_arc_weak_reference_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_arc_weak_reference_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_arc_weak_reference_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_arc_weak_reference_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ArcWeakrefUnavailableAttr *ArcWeakrefUnavailableAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_arc_weak_reference_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_arc_weak_reference_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_arc_weak_reference_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_arc_weak_reference_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_arc_weak_reference_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_arc_weak_reference_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ArcWeakrefUnavailableAttr::ArcWeakrefUnavailableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ArcWeakrefUnavailable, /*IsLateParsed=*/false, false) { } ArcWeakrefUnavailableAttr *ArcWeakrefUnavailableAttr::clone(ASTContext &C) const { auto *A = new (C) ArcWeakrefUnavailableAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ArcWeakrefUnavailableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_arc_weak_reference_unavailable"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_arc_weak_reference_unavailable"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_arc_weak_reference_unavailable"; OS << "]]"; break; } } } const char *ArcWeakrefUnavailableAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_arc_weak_reference_unavailable"; case 1: return "objc_arc_weak_reference_unavailable"; case 2: return "objc_arc_weak_reference_unavailable"; } } // ArgumentWithTypeTagAttr implementation ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, bool IsPointer, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArgumentWithTypeTagAttr(Ctx, CommonInfo, ArgumentKind, ArgumentIdx, TypeTagIdx, IsPointer); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, bool IsPointer, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArgumentWithTypeTagAttr(Ctx, CommonInfo, ArgumentKind, ArgumentIdx, TypeTagIdx, IsPointer); return A; } ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, bool IsPointer, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_argument_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_argument_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_argument_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_pointer_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_pointer_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_pointer_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, IsPointer, I); } ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, bool IsPointer, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_argument_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_argument_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_argument_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_pointer_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_pointer_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_pointer_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, IsPointer, I); } ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArgumentWithTypeTagAttr(Ctx, CommonInfo, ArgumentKind, ArgumentIdx, TypeTagIdx); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArgumentWithTypeTagAttr(Ctx, CommonInfo, ArgumentKind, ArgumentIdx, TypeTagIdx); return A; } ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_argument_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_argument_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_argument_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_pointer_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_pointer_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_pointer_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, I); } ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, ParamIdx ArgumentIdx, ParamIdx TypeTagIdx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_argument_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_argument_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_argument_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_argument_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_pointer_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_pointer_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_pointer_with_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pointer_with_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, ArgumentKind, ArgumentIdx, TypeTagIdx, I); } ArgumentWithTypeTagAttr::ArgumentWithTypeTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * ArgumentKind , ParamIdx ArgumentIdx , ParamIdx TypeTagIdx , bool IsPointer ) : InheritableAttr(Ctx, CommonInfo, attr::ArgumentWithTypeTag, /*IsLateParsed=*/false, false) , argumentKind(ArgumentKind) , argumentIdx(ArgumentIdx) , typeTagIdx(TypeTagIdx) , isPointer(IsPointer) { } ArgumentWithTypeTagAttr::ArgumentWithTypeTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * ArgumentKind , ParamIdx ArgumentIdx , ParamIdx TypeTagIdx ) : InheritableAttr(Ctx, CommonInfo, attr::ArgumentWithTypeTag, /*IsLateParsed=*/false, false) , argumentKind(ArgumentKind) , argumentIdx(ArgumentIdx) , typeTagIdx(TypeTagIdx) , isPointer() { } ArgumentWithTypeTagAttr::Spelling ArgumentWithTypeTagAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_argument_with_type_tag; case 1: return CXX11_clang_argument_with_type_tag; case 2: return C23_clang_argument_with_type_tag; case 3: return GNU_pointer_with_type_tag; case 4: return CXX11_clang_pointer_with_type_tag; case 5: return C23_clang_pointer_with_type_tag; } } ArgumentWithTypeTagAttr *ArgumentWithTypeTagAttr::clone(ASTContext &C) const { auto *A = new (C) ArgumentWithTypeTagAttr(C, *this, argumentKind, argumentIdx, typeTagIdx, isPointer); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ArgumentWithTypeTagAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((argument_with_type_tag"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getArgumentIdx().getSourceIndex() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getTypeTagIdx().getSourceIndex() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::argument_with_type_tag"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getArgumentIdx().getSourceIndex() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getTypeTagIdx().getSourceIndex() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::argument_with_type_tag"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getArgumentIdx().getSourceIndex() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getTypeTagIdx().getSourceIndex() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 3 : { OS << "__attribute__((pointer_with_type_tag"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getArgumentIdx().getSourceIndex() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getTypeTagIdx().getSourceIndex() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 4 : { OS << "[[clang::pointer_with_type_tag"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getArgumentIdx().getSourceIndex() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getTypeTagIdx().getSourceIndex() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 5 : { OS << "[[clang::pointer_with_type_tag"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getArgumentIdx().getSourceIndex() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getTypeTagIdx().getSourceIndex() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ArgumentWithTypeTagAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "argument_with_type_tag"; case 1: return "argument_with_type_tag"; case 2: return "argument_with_type_tag"; case 3: return "pointer_with_type_tag"; case 4: return "pointer_with_type_tag"; case 5: return "pointer_with_type_tag"; } } // ArmBuiltinAliasAttr implementation ArmBuiltinAliasAttr *ArmBuiltinAliasAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BuiltinName, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmBuiltinAliasAttr(Ctx, CommonInfo, BuiltinName); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmBuiltinAliasAttr *ArmBuiltinAliasAttr::Create(ASTContext &Ctx, IdentifierInfo * BuiltinName, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmBuiltinAliasAttr(Ctx, CommonInfo, BuiltinName); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmBuiltinAliasAttr *ArmBuiltinAliasAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BuiltinName, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_clang_arm_builtin_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clang_arm_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_clang_arm_builtin_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_clang_arm_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_clang_arm_builtin_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_clang_arm_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, BuiltinName, I); } ArmBuiltinAliasAttr *ArmBuiltinAliasAttr::Create(ASTContext &Ctx, IdentifierInfo * BuiltinName, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_clang_arm_builtin_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clang_arm_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_clang_arm_builtin_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_clang_arm_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_clang_arm_builtin_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_clang_arm_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, BuiltinName, I); } ArmBuiltinAliasAttr::ArmBuiltinAliasAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * BuiltinName ) : InheritableAttr(Ctx, CommonInfo, attr::ArmBuiltinAlias, /*IsLateParsed=*/false, false) , builtinName(BuiltinName) { } ArmBuiltinAliasAttr *ArmBuiltinAliasAttr::clone(ASTContext &C) const { auto *A = new (C) ArmBuiltinAliasAttr(C, *this, builtinName); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ArmBuiltinAliasAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((__clang_arm_builtin_alias"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::__clang_arm_builtin_alias"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::__clang_arm_builtin_alias"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ArmBuiltinAliasAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__clang_arm_builtin_alias"; case 1: return "__clang_arm_builtin_alias"; case 2: return "__clang_arm_builtin_alias"; } } // ArmInAttr implementation ArmInAttr *ArmInAttr::CreateImplicit(ASTContext &Ctx, StringRef *InArgs, unsigned InArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmInAttr(Ctx, CommonInfo, InArgs, InArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmInAttr *ArmInAttr::Create(ASTContext &Ctx, StringRef *InArgs, unsigned InArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmInAttr(Ctx, CommonInfo, InArgs, InArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmInAttr *ArmInAttr::CreateImplicit(ASTContext &Ctx, StringRef *InArgs, unsigned InArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, InArgs, InArgsSize, I); } ArmInAttr *ArmInAttr::Create(ASTContext &Ctx, StringRef *InArgs, unsigned InArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return Create(Ctx, InArgs, InArgsSize, I); } ArmInAttr::ArmInAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , StringRef *InArgs, unsigned InArgsSize ) : TypeAttr(Ctx, CommonInfo, attr::ArmIn, /*IsLateParsed=*/false) , inArgs_Size(InArgsSize), inArgs_(new (Ctx, 16) StringRef[inArgs_Size]) { for (size_t I = 0, E = inArgs_Size; I != E; ++I) { StringRef Ref = InArgs[I]; if (!Ref.empty()) { char *Mem = new (Ctx, 1) char[Ref.size()]; std::memcpy(Mem, Ref.data(), Ref.size()); inArgs_[I] = StringRef(Mem, Ref.size()); } } } ArmInAttr::ArmInAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::ArmIn, /*IsLateParsed=*/false) , inArgs_Size(0), inArgs_(nullptr) { } ArmInAttr *ArmInAttr::clone(ASTContext &C) const { auto *A = new (C) ArmInAttr(C, *this, inArgs_, inArgs_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ArmInAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__arm_in"; OS << ""; for (const auto &Val : inArgs()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << ""; break; } } } const char *ArmInAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__arm_in"; } } // ArmInOutAttr implementation ArmInOutAttr *ArmInOutAttr::CreateImplicit(ASTContext &Ctx, StringRef *InOutArgs, unsigned InOutArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmInOutAttr(Ctx, CommonInfo, InOutArgs, InOutArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmInOutAttr *ArmInOutAttr::Create(ASTContext &Ctx, StringRef *InOutArgs, unsigned InOutArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmInOutAttr(Ctx, CommonInfo, InOutArgs, InOutArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmInOutAttr *ArmInOutAttr::CreateImplicit(ASTContext &Ctx, StringRef *InOutArgs, unsigned InOutArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, InOutArgs, InOutArgsSize, I); } ArmInOutAttr *ArmInOutAttr::Create(ASTContext &Ctx, StringRef *InOutArgs, unsigned InOutArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return Create(Ctx, InOutArgs, InOutArgsSize, I); } ArmInOutAttr::ArmInOutAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , StringRef *InOutArgs, unsigned InOutArgsSize ) : TypeAttr(Ctx, CommonInfo, attr::ArmInOut, /*IsLateParsed=*/false) , inOutArgs_Size(InOutArgsSize), inOutArgs_(new (Ctx, 16) StringRef[inOutArgs_Size]) { for (size_t I = 0, E = inOutArgs_Size; I != E; ++I) { StringRef Ref = InOutArgs[I]; if (!Ref.empty()) { char *Mem = new (Ctx, 1) char[Ref.size()]; std::memcpy(Mem, Ref.data(), Ref.size()); inOutArgs_[I] = StringRef(Mem, Ref.size()); } } } ArmInOutAttr::ArmInOutAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::ArmInOut, /*IsLateParsed=*/false) , inOutArgs_Size(0), inOutArgs_(nullptr) { } ArmInOutAttr *ArmInOutAttr::clone(ASTContext &C) const { auto *A = new (C) ArmInOutAttr(C, *this, inOutArgs_, inOutArgs_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ArmInOutAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__arm_inout"; OS << ""; for (const auto &Val : inOutArgs()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << ""; break; } } } const char *ArmInOutAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__arm_inout"; } } // ArmLocallyStreamingAttr implementation ArmLocallyStreamingAttr *ArmLocallyStreamingAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmLocallyStreamingAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmLocallyStreamingAttr *ArmLocallyStreamingAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmLocallyStreamingAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmLocallyStreamingAttr *ArmLocallyStreamingAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } ArmLocallyStreamingAttr *ArmLocallyStreamingAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } ArmLocallyStreamingAttr::ArmLocallyStreamingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ArmLocallyStreaming, /*IsLateParsed=*/false, false) { } ArmLocallyStreamingAttr *ArmLocallyStreamingAttr::clone(ASTContext &C) const { auto *A = new (C) ArmLocallyStreamingAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ArmLocallyStreamingAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__arm_locally_streaming"; OS << ""; break; } } } const char *ArmLocallyStreamingAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__arm_locally_streaming"; } } // ArmMveStrictPolymorphismAttr implementation ArmMveStrictPolymorphismAttr *ArmMveStrictPolymorphismAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmMveStrictPolymorphismAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmMveStrictPolymorphismAttr *ArmMveStrictPolymorphismAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmMveStrictPolymorphismAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmMveStrictPolymorphismAttr *ArmMveStrictPolymorphismAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_clang_arm_mve_strict_polymorphism: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clang_arm_mve_strict_polymorphism, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_clang_arm_mve_strict_polymorphism: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_clang_arm_mve_strict_polymorphism, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_clang_arm_mve_strict_polymorphism: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_clang_arm_mve_strict_polymorphism, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ArmMveStrictPolymorphismAttr *ArmMveStrictPolymorphismAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_clang_arm_mve_strict_polymorphism: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clang_arm_mve_strict_polymorphism, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_clang_arm_mve_strict_polymorphism: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_clang_arm_mve_strict_polymorphism, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_clang_arm_mve_strict_polymorphism: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_clang_arm_mve_strict_polymorphism, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ArmMveStrictPolymorphismAttr::ArmMveStrictPolymorphismAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::ArmMveStrictPolymorphism, /*IsLateParsed=*/false) { } ArmMveStrictPolymorphismAttr *ArmMveStrictPolymorphismAttr::clone(ASTContext &C) const { auto *A = new (C) ArmMveStrictPolymorphismAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ArmMveStrictPolymorphismAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((__clang_arm_mve_strict_polymorphism"; OS << "))"; break; } case 1 : { OS << "[[clang::__clang_arm_mve_strict_polymorphism"; OS << "]]"; break; } case 2 : { OS << "[[clang::__clang_arm_mve_strict_polymorphism"; OS << "]]"; break; } } } const char *ArmMveStrictPolymorphismAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__clang_arm_mve_strict_polymorphism"; case 1: return "__clang_arm_mve_strict_polymorphism"; case 2: return "__clang_arm_mve_strict_polymorphism"; } } // ArmNewAttr implementation ArmNewAttr *ArmNewAttr::CreateImplicit(ASTContext &Ctx, StringRef *NewArgs, unsigned NewArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmNewAttr(Ctx, CommonInfo, NewArgs, NewArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmNewAttr *ArmNewAttr::Create(ASTContext &Ctx, StringRef *NewArgs, unsigned NewArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmNewAttr(Ctx, CommonInfo, NewArgs, NewArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmNewAttr *ArmNewAttr::CreateImplicit(ASTContext &Ctx, StringRef *NewArgs, unsigned NewArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, NewArgs, NewArgsSize, I); } ArmNewAttr *ArmNewAttr::Create(ASTContext &Ctx, StringRef *NewArgs, unsigned NewArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return Create(Ctx, NewArgs, NewArgsSize, I); } ArmNewAttr::ArmNewAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , StringRef *NewArgs, unsigned NewArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::ArmNew, /*IsLateParsed=*/false, false) , newArgs_Size(NewArgsSize), newArgs_(new (Ctx, 16) StringRef[newArgs_Size]) { for (size_t I = 0, E = newArgs_Size; I != E; ++I) { StringRef Ref = NewArgs[I]; if (!Ref.empty()) { char *Mem = new (Ctx, 1) char[Ref.size()]; std::memcpy(Mem, Ref.data(), Ref.size()); newArgs_[I] = StringRef(Mem, Ref.size()); } } } ArmNewAttr::ArmNewAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ArmNew, /*IsLateParsed=*/false, false) , newArgs_Size(0), newArgs_(nullptr) { } ArmNewAttr *ArmNewAttr::clone(ASTContext &C) const { auto *A = new (C) ArmNewAttr(C, *this, newArgs_, newArgs_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ArmNewAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__arm_new"; OS << ""; for (const auto &Val : newArgs()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << ""; break; } } } const char *ArmNewAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__arm_new"; } } // ArmOutAttr implementation ArmOutAttr *ArmOutAttr::CreateImplicit(ASTContext &Ctx, StringRef *OutArgs, unsigned OutArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmOutAttr(Ctx, CommonInfo, OutArgs, OutArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmOutAttr *ArmOutAttr::Create(ASTContext &Ctx, StringRef *OutArgs, unsigned OutArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmOutAttr(Ctx, CommonInfo, OutArgs, OutArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmOutAttr *ArmOutAttr::CreateImplicit(ASTContext &Ctx, StringRef *OutArgs, unsigned OutArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, OutArgs, OutArgsSize, I); } ArmOutAttr *ArmOutAttr::Create(ASTContext &Ctx, StringRef *OutArgs, unsigned OutArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return Create(Ctx, OutArgs, OutArgsSize, I); } ArmOutAttr::ArmOutAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , StringRef *OutArgs, unsigned OutArgsSize ) : TypeAttr(Ctx, CommonInfo, attr::ArmOut, /*IsLateParsed=*/false) , outArgs_Size(OutArgsSize), outArgs_(new (Ctx, 16) StringRef[outArgs_Size]) { for (size_t I = 0, E = outArgs_Size; I != E; ++I) { StringRef Ref = OutArgs[I]; if (!Ref.empty()) { char *Mem = new (Ctx, 1) char[Ref.size()]; std::memcpy(Mem, Ref.data(), Ref.size()); outArgs_[I] = StringRef(Mem, Ref.size()); } } } ArmOutAttr::ArmOutAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::ArmOut, /*IsLateParsed=*/false) , outArgs_Size(0), outArgs_(nullptr) { } ArmOutAttr *ArmOutAttr::clone(ASTContext &C) const { auto *A = new (C) ArmOutAttr(C, *this, outArgs_, outArgs_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ArmOutAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__arm_out"; OS << ""; for (const auto &Val : outArgs()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << ""; break; } } } const char *ArmOutAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__arm_out"; } } // ArmPreservesAttr implementation ArmPreservesAttr *ArmPreservesAttr::CreateImplicit(ASTContext &Ctx, StringRef *PreserveArgs, unsigned PreserveArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmPreservesAttr(Ctx, CommonInfo, PreserveArgs, PreserveArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmPreservesAttr *ArmPreservesAttr::Create(ASTContext &Ctx, StringRef *PreserveArgs, unsigned PreserveArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmPreservesAttr(Ctx, CommonInfo, PreserveArgs, PreserveArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmPreservesAttr *ArmPreservesAttr::CreateImplicit(ASTContext &Ctx, StringRef *PreserveArgs, unsigned PreserveArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, PreserveArgs, PreserveArgsSize, I); } ArmPreservesAttr *ArmPreservesAttr::Create(ASTContext &Ctx, StringRef *PreserveArgs, unsigned PreserveArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return Create(Ctx, PreserveArgs, PreserveArgsSize, I); } ArmPreservesAttr::ArmPreservesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , StringRef *PreserveArgs, unsigned PreserveArgsSize ) : TypeAttr(Ctx, CommonInfo, attr::ArmPreserves, /*IsLateParsed=*/false) , preserveArgs_Size(PreserveArgsSize), preserveArgs_(new (Ctx, 16) StringRef[preserveArgs_Size]) { for (size_t I = 0, E = preserveArgs_Size; I != E; ++I) { StringRef Ref = PreserveArgs[I]; if (!Ref.empty()) { char *Mem = new (Ctx, 1) char[Ref.size()]; std::memcpy(Mem, Ref.data(), Ref.size()); preserveArgs_[I] = StringRef(Mem, Ref.size()); } } } ArmPreservesAttr::ArmPreservesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::ArmPreserves, /*IsLateParsed=*/false) , preserveArgs_Size(0), preserveArgs_(nullptr) { } ArmPreservesAttr *ArmPreservesAttr::clone(ASTContext &C) const { auto *A = new (C) ArmPreservesAttr(C, *this, preserveArgs_, preserveArgs_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ArmPreservesAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__arm_preserves"; OS << ""; for (const auto &Val : preserveArgs()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << ""; break; } } } const char *ArmPreservesAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__arm_preserves"; } } // ArmStreamingAttr implementation ArmStreamingAttr *ArmStreamingAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmStreamingAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmStreamingAttr *ArmStreamingAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmStreamingAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmStreamingAttr *ArmStreamingAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } ArmStreamingAttr *ArmStreamingAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } ArmStreamingAttr::ArmStreamingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::ArmStreaming, /*IsLateParsed=*/false) { } ArmStreamingAttr *ArmStreamingAttr::clone(ASTContext &C) const { auto *A = new (C) ArmStreamingAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ArmStreamingAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__arm_streaming"; OS << ""; break; } } } const char *ArmStreamingAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__arm_streaming"; } } // ArmStreamingCompatibleAttr implementation ArmStreamingCompatibleAttr *ArmStreamingCompatibleAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmStreamingCompatibleAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmStreamingCompatibleAttr *ArmStreamingCompatibleAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArmStreamingCompatibleAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArmStreamingCompatibleAttr *ArmStreamingCompatibleAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } ArmStreamingCompatibleAttr *ArmStreamingCompatibleAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, true /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } ArmStreamingCompatibleAttr::ArmStreamingCompatibleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::ArmStreamingCompatible, /*IsLateParsed=*/false) { } ArmStreamingCompatibleAttr *ArmStreamingCompatibleAttr::clone(ASTContext &C) const { auto *A = new (C) ArmStreamingCompatibleAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ArmStreamingCompatibleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__arm_streaming_compatible"; OS << ""; break; } } } const char *ArmStreamingCompatibleAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__arm_streaming_compatible"; } } // ArtificialAttr implementation ArtificialAttr *ArtificialAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArtificialAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArtificialAttr *ArtificialAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ArtificialAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ArtificialAttr *ArtificialAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_artificial: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_artificial, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_artificial: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_artificial, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_artificial: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_artificial, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ArtificialAttr *ArtificialAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_artificial: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_artificial, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_artificial: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_artificial, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_artificial: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_artificial, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ArtificialAttr::ArtificialAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Artificial, /*IsLateParsed=*/false, false) { } ArtificialAttr *ArtificialAttr::clone(ASTContext &C) const { auto *A = new (C) ArtificialAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ArtificialAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((artificial"; OS << "))"; break; } case 1 : { OS << "[[gnu::artificial"; OS << "]]"; break; } case 2 : { OS << "[[gnu::artificial"; OS << "]]"; break; } } } const char *ArtificialAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "artificial"; case 1: return "artificial"; case 2: return "artificial"; } } // AsmLabelAttr implementation AsmLabelAttr *AsmLabelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Label, bool IsLiteralLabel, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AsmLabelAttr(Ctx, CommonInfo, Label, IsLiteralLabel); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AsmLabelAttr *AsmLabelAttr::Create(ASTContext &Ctx, llvm::StringRef Label, bool IsLiteralLabel, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AsmLabelAttr(Ctx, CommonInfo, Label, IsLiteralLabel); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AsmLabelAttr *AsmLabelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Label, bool IsLiteralLabel, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_asm: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_asm, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Label, IsLiteralLabel, I); } AsmLabelAttr *AsmLabelAttr::Create(ASTContext &Ctx, llvm::StringRef Label, bool IsLiteralLabel, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_asm: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_asm, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Label, IsLiteralLabel, I); } AsmLabelAttr *AsmLabelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Label, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AsmLabelAttr(Ctx, CommonInfo, Label); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AsmLabelAttr *AsmLabelAttr::Create(ASTContext &Ctx, llvm::StringRef Label, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AsmLabelAttr(Ctx, CommonInfo, Label); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AsmLabelAttr *AsmLabelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Label, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_asm: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_asm, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Label, I); } AsmLabelAttr *AsmLabelAttr::Create(ASTContext &Ctx, llvm::StringRef Label, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_asm: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_asm, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Label, I); } AsmLabelAttr::AsmLabelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Label , bool IsLiteralLabel ) : InheritableAttr(Ctx, CommonInfo, attr::AsmLabel, /*IsLateParsed=*/false, false) , labelLength(Label.size()),label(new (Ctx, 1) char[labelLength]) , isLiteralLabel(IsLiteralLabel) { if (!Label.empty()) std::memcpy(label, Label.data(), labelLength); } AsmLabelAttr::AsmLabelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Label ) : InheritableAttr(Ctx, CommonInfo, attr::AsmLabel, /*IsLateParsed=*/false, false) , labelLength(Label.size()),label(new (Ctx, 1) char[labelLength]) , isLiteralLabel() { if (!Label.empty()) std::memcpy(label, Label.data(), labelLength); } AsmLabelAttr *AsmLabelAttr::clone(ASTContext &C) const { auto *A = new (C) AsmLabelAttr(C, *this, getLabel(), isLiteralLabel); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AsmLabelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "asm"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getLabel() << "\""; if (!IsFirstArgument) OS << ")"; OS << ""; break; } case 1 : { OS << "__asm__"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getLabel() << "\""; if (!IsFirstArgument) OS << ")"; OS << ""; break; } } } const char *AsmLabelAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "asm"; case 1: return "__asm__"; } } // AssertCapabilityAttr implementation AssertCapabilityAttr *AssertCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AssertCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AssertCapabilityAttr *AssertCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AssertCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); return A; } AssertCapabilityAttr *AssertCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_assert_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assert_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_assert_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_assert_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_assert_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assert_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_assert_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_assert_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Args, ArgsSize, I); } AssertCapabilityAttr *AssertCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_assert_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assert_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_assert_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_assert_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_assert_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assert_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_assert_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_assert_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Args, ArgsSize, I); } AssertCapabilityAttr::AssertCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * *Args, unsigned ArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::AssertCapability, /*IsLateParsed=*/true, true) , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) { std::copy(Args, Args + args_Size, args_); } AssertCapabilityAttr::AssertCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AssertCapability, /*IsLateParsed=*/true, true) , args_Size(0), args_(nullptr) { } AssertCapabilityAttr::Spelling AssertCapabilityAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_assert_capability; case 1: return CXX11_clang_assert_capability; case 2: return GNU_assert_shared_capability; case 3: return CXX11_clang_assert_shared_capability; } } AssertCapabilityAttr *AssertCapabilityAttr::clone(ASTContext &C) const { auto *A = new (C) AssertCapabilityAttr(C, *this, args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AssertCapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((assert_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::assert_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "__attribute__((assert_shared_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 3 : { OS << "[[clang::assert_shared_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AssertCapabilityAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "assert_capability"; case 1: return "assert_capability"; case 2: return "assert_shared_capability"; case 3: return "assert_shared_capability"; } } // AssertExclusiveLockAttr implementation AssertExclusiveLockAttr *AssertExclusiveLockAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AssertExclusiveLockAttr(Ctx, CommonInfo, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AssertExclusiveLockAttr *AssertExclusiveLockAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AssertExclusiveLockAttr(Ctx, CommonInfo, Args, ArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AssertExclusiveLockAttr *AssertExclusiveLockAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Args, ArgsSize, I); } AssertExclusiveLockAttr *AssertExclusiveLockAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Args, ArgsSize, I); } AssertExclusiveLockAttr::AssertExclusiveLockAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * *Args, unsigned ArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::AssertExclusiveLock, /*IsLateParsed=*/true, true) , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) { std::copy(Args, Args + args_Size, args_); } AssertExclusiveLockAttr::AssertExclusiveLockAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AssertExclusiveLock, /*IsLateParsed=*/true, true) , args_Size(0), args_(nullptr) { } AssertExclusiveLockAttr *AssertExclusiveLockAttr::clone(ASTContext &C) const { auto *A = new (C) AssertExclusiveLockAttr(C, *this, args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AssertExclusiveLockAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((assert_exclusive_lock"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *AssertExclusiveLockAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "assert_exclusive_lock"; } } // AssertSharedLockAttr implementation AssertSharedLockAttr *AssertSharedLockAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AssertSharedLockAttr(Ctx, CommonInfo, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AssertSharedLockAttr *AssertSharedLockAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AssertSharedLockAttr(Ctx, CommonInfo, Args, ArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AssertSharedLockAttr *AssertSharedLockAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Args, ArgsSize, I); } AssertSharedLockAttr *AssertSharedLockAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Args, ArgsSize, I); } AssertSharedLockAttr::AssertSharedLockAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * *Args, unsigned ArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::AssertSharedLock, /*IsLateParsed=*/true, true) , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) { std::copy(Args, Args + args_Size, args_); } AssertSharedLockAttr::AssertSharedLockAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AssertSharedLock, /*IsLateParsed=*/true, true) , args_Size(0), args_(nullptr) { } AssertSharedLockAttr *AssertSharedLockAttr::clone(ASTContext &C) const { auto *A = new (C) AssertSharedLockAttr(C, *this, args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AssertSharedLockAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((assert_shared_lock"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *AssertSharedLockAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "assert_shared_lock"; } } // AssumeAlignedAttr implementation AssumeAlignedAttr *AssumeAlignedAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, Expr * Offset, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AssumeAlignedAttr(Ctx, CommonInfo, Alignment, Offset); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AssumeAlignedAttr *AssumeAlignedAttr::Create(ASTContext &Ctx, Expr * Alignment, Expr * Offset, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AssumeAlignedAttr(Ctx, CommonInfo, Alignment, Offset); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AssumeAlignedAttr *AssumeAlignedAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, Expr * Offset, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_assume_aligned: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assume_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_assume_aligned: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_assume_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_assume_aligned: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_assume_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Alignment, Offset, I); } AssumeAlignedAttr *AssumeAlignedAttr::Create(ASTContext &Ctx, Expr * Alignment, Expr * Offset, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_assume_aligned: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assume_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_assume_aligned: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_assume_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_assume_aligned: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_assume_aligned, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Alignment, Offset, I); } AssumeAlignedAttr::AssumeAlignedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Alignment , Expr * Offset ) : InheritableAttr(Ctx, CommonInfo, attr::AssumeAligned, /*IsLateParsed=*/false, false) , alignment(Alignment) , offset(Offset) { } AssumeAlignedAttr::AssumeAlignedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Alignment ) : InheritableAttr(Ctx, CommonInfo, attr::AssumeAligned, /*IsLateParsed=*/false, false) , alignment(Alignment) , offset() { } AssumeAlignedAttr *AssumeAlignedAttr::clone(ASTContext &C) const { auto *A = new (C) AssumeAlignedAttr(C, *this, alignment, offset); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AssumeAlignedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((assume_aligned"; if (!getOffset()) ++TrailingOmittedArgs; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getAlignment()->printPretty(OS, nullptr, Policy); OS << ""; if (!(!getOffset())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getOffset()->printPretty(OS, nullptr, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::assume_aligned"; if (!getOffset()) ++TrailingOmittedArgs; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getAlignment()->printPretty(OS, nullptr, Policy); OS << ""; if (!(!getOffset())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getOffset()->printPretty(OS, nullptr, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::assume_aligned"; if (!getOffset()) ++TrailingOmittedArgs; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getAlignment()->printPretty(OS, nullptr, Policy); OS << ""; if (!(!getOffset())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getOffset()->printPretty(OS, nullptr, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AssumeAlignedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "assume_aligned"; case 1: return "assume_aligned"; case 2: return "assume_aligned"; } } // AvailabilityAttr implementation 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) { auto *A = new (Ctx) AvailabilityAttr(Ctx, CommonInfo, Platform, Introduced, Deprecated, Obsoleted, Unavailable, Message, Strict, Replacement, Priority, Environment); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } 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) { auto *A = new (Ctx) AvailabilityAttr(Ctx, CommonInfo, Platform, Introduced, Deprecated, Obsoleted, Unavailable, Message, Strict, Replacement, Priority, Environment); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } 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) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_availability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_availability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_availability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_availability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_availability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_availability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Platform, Introduced, Deprecated, Obsoleted, Unavailable, Message, Strict, Replacement, Priority, Environment, I); } 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) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_availability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_availability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_availability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_availability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_availability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_availability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Platform, Introduced, Deprecated, Obsoleted, Unavailable, Message, Strict, Replacement, Priority, Environment, I); } AvailabilityAttr::AvailabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * Platform , VersionTuple Introduced , VersionTuple Deprecated , VersionTuple Obsoleted , bool Unavailable , llvm::StringRef Message , bool Strict , llvm::StringRef Replacement , int Priority , IdentifierInfo * Environment ) : InheritableAttr(Ctx, CommonInfo, attr::Availability, /*IsLateParsed=*/false, true) , platform(Platform) , introduced(Introduced) , deprecated(Deprecated) , obsoleted(Obsoleted) , unavailable(Unavailable) , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) , strict(Strict) , replacementLength(Replacement.size()),replacement(new (Ctx, 1) char[replacementLength]) , priority(Priority) , environment(Environment) { if (!Message.empty()) std::memcpy(message, Message.data(), messageLength); if (!Replacement.empty()) std::memcpy(replacement, Replacement.data(), replacementLength); } AvailabilityAttr *AvailabilityAttr::clone(ASTContext &C) const { auto *A = new (C) AvailabilityAttr(C, *this, platform, getIntroduced(), getDeprecated(), getObsoleted(), unavailable, getMessage(), strict, getReplacement(), priority, environment); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AvailabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((availability"; OS << "(" << getPlatform()->getName(); if (getStrict()) OS << ", strict"; if (!getIntroduced().empty()) OS << ", introduced=" << getIntroduced(); if (!getDeprecated().empty()) OS << ", deprecated=" << getDeprecated(); if (!getObsoleted().empty()) OS << ", obsoleted=" << getObsoleted(); if (getUnavailable()) OS << ", unavailable"; OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::availability"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getPlatform() ? getPlatform()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "introduced=" << getIntroduced() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "deprecated=" << getDeprecated() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "obsoleted=" << getObsoleted() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getUnavailable() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMessage() << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getStrict() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getReplacement() << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getPriority() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getEnvironment() ? getEnvironment()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::availability"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getPlatform() ? getPlatform()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "introduced=" << getIntroduced() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "deprecated=" << getDeprecated() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "obsoleted=" << getObsoleted() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getUnavailable() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMessage() << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getStrict() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getReplacement() << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getPriority() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getEnvironment() ? getEnvironment()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *AvailabilityAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "availability"; case 1: return "availability"; case 2: return "availability"; } } // AvailableOnlyInDefaultEvalMethodAttr implementation AvailableOnlyInDefaultEvalMethodAttr *AvailableOnlyInDefaultEvalMethodAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AvailableOnlyInDefaultEvalMethodAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AvailableOnlyInDefaultEvalMethodAttr *AvailableOnlyInDefaultEvalMethodAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) AvailableOnlyInDefaultEvalMethodAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } AvailableOnlyInDefaultEvalMethodAttr *AvailableOnlyInDefaultEvalMethodAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_available_only_in_default_eval_method: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_available_only_in_default_eval_method, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_available_only_in_default_eval_method: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_available_only_in_default_eval_method, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_available_only_in_default_eval_method: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_available_only_in_default_eval_method, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } AvailableOnlyInDefaultEvalMethodAttr *AvailableOnlyInDefaultEvalMethodAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_available_only_in_default_eval_method: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_available_only_in_default_eval_method, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_available_only_in_default_eval_method: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_available_only_in_default_eval_method, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_available_only_in_default_eval_method: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_available_only_in_default_eval_method, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } AvailableOnlyInDefaultEvalMethodAttr::AvailableOnlyInDefaultEvalMethodAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::AvailableOnlyInDefaultEvalMethod, /*IsLateParsed=*/false, false) { } AvailableOnlyInDefaultEvalMethodAttr *AvailableOnlyInDefaultEvalMethodAttr::clone(ASTContext &C) const { auto *A = new (C) AvailableOnlyInDefaultEvalMethodAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void AvailableOnlyInDefaultEvalMethodAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((available_only_in_default_eval_method"; OS << "))"; break; } case 1 : { OS << "[[clang::available_only_in_default_eval_method"; OS << "]]"; break; } case 2 : { OS << "[[clang::available_only_in_default_eval_method"; OS << "]]"; break; } } } const char *AvailableOnlyInDefaultEvalMethodAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "available_only_in_default_eval_method"; case 1: return "available_only_in_default_eval_method"; case 2: return "available_only_in_default_eval_method"; } } // BPFFastCallAttr implementation BPFFastCallAttr *BPFFastCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BPFFastCallAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BPFFastCallAttr *BPFFastCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BPFFastCallAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BPFFastCallAttr *BPFFastCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_bpf_fastcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_bpf_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_bpf_fastcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_bpf_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_bpf_fastcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_bpf_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } BPFFastCallAttr *BPFFastCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_bpf_fastcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_bpf_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_bpf_fastcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_bpf_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_bpf_fastcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_bpf_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } BPFFastCallAttr::BPFFastCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::BPFFastCall, /*IsLateParsed=*/false, false) { } BPFFastCallAttr *BPFFastCallAttr::clone(ASTContext &C) const { auto *A = new (C) BPFFastCallAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void BPFFastCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((bpf_fastcall"; OS << "))"; break; } case 1 : { OS << "[[clang::bpf_fastcall"; OS << "]]"; break; } case 2 : { OS << "[[clang::bpf_fastcall"; OS << "]]"; break; } } } const char *BPFFastCallAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "bpf_fastcall"; case 1: return "bpf_fastcall"; case 2: return "bpf_fastcall"; } } // BPFPreserveAccessIndexAttr implementation BPFPreserveAccessIndexAttr *BPFPreserveAccessIndexAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BPFPreserveAccessIndexAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BPFPreserveAccessIndexAttr *BPFPreserveAccessIndexAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BPFPreserveAccessIndexAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BPFPreserveAccessIndexAttr *BPFPreserveAccessIndexAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_preserve_access_index: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_access_index, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_preserve_access_index: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_access_index, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_preserve_access_index: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_access_index, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } BPFPreserveAccessIndexAttr *BPFPreserveAccessIndexAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_preserve_access_index: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_access_index, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_preserve_access_index: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_access_index, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_preserve_access_index: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_access_index, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } BPFPreserveAccessIndexAttr::BPFPreserveAccessIndexAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::BPFPreserveAccessIndex, /*IsLateParsed=*/false, false) { } BPFPreserveAccessIndexAttr *BPFPreserveAccessIndexAttr::clone(ASTContext &C) const { auto *A = new (C) BPFPreserveAccessIndexAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void BPFPreserveAccessIndexAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((preserve_access_index"; OS << "))"; break; } case 1 : { OS << "[[clang::preserve_access_index"; OS << "]]"; break; } case 2 : { OS << "[[clang::preserve_access_index"; OS << "]]"; break; } } } const char *BPFPreserveAccessIndexAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "preserve_access_index"; case 1: return "preserve_access_index"; case 2: return "preserve_access_index"; } } // BPFPreserveStaticOffsetAttr implementation BPFPreserveStaticOffsetAttr *BPFPreserveStaticOffsetAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BPFPreserveStaticOffsetAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BPFPreserveStaticOffsetAttr *BPFPreserveStaticOffsetAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BPFPreserveStaticOffsetAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BPFPreserveStaticOffsetAttr *BPFPreserveStaticOffsetAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_preserve_static_offset: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_static_offset, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_preserve_static_offset: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_static_offset, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_preserve_static_offset: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_static_offset, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } BPFPreserveStaticOffsetAttr *BPFPreserveStaticOffsetAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_preserve_static_offset: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_static_offset, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_preserve_static_offset: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_static_offset, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_preserve_static_offset: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_static_offset, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } BPFPreserveStaticOffsetAttr::BPFPreserveStaticOffsetAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::BPFPreserveStaticOffset, /*IsLateParsed=*/false, false) { } BPFPreserveStaticOffsetAttr *BPFPreserveStaticOffsetAttr::clone(ASTContext &C) const { auto *A = new (C) BPFPreserveStaticOffsetAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void BPFPreserveStaticOffsetAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((preserve_static_offset"; OS << "))"; break; } case 1 : { OS << "[[clang::preserve_static_offset"; OS << "]]"; break; } case 2 : { OS << "[[clang::preserve_static_offset"; OS << "]]"; break; } } } const char *BPFPreserveStaticOffsetAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "preserve_static_offset"; case 1: return "preserve_static_offset"; case 2: return "preserve_static_offset"; } } // BTFDeclTagAttr implementation BTFDeclTagAttr *BTFDeclTagAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef BTFDeclTag, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BTFDeclTagAttr(Ctx, CommonInfo, BTFDeclTag); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BTFDeclTagAttr *BTFDeclTagAttr::Create(ASTContext &Ctx, llvm::StringRef BTFDeclTag, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BTFDeclTagAttr(Ctx, CommonInfo, BTFDeclTag); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BTFDeclTagAttr *BTFDeclTagAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef BTFDeclTag, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_btf_decl_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_btf_decl_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_btf_decl_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_btf_decl_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_btf_decl_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_btf_decl_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, BTFDeclTag, I); } BTFDeclTagAttr *BTFDeclTagAttr::Create(ASTContext &Ctx, llvm::StringRef BTFDeclTag, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_btf_decl_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_btf_decl_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_btf_decl_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_btf_decl_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_btf_decl_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_btf_decl_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, BTFDeclTag, I); } BTFDeclTagAttr::BTFDeclTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef BTFDeclTag ) : InheritableAttr(Ctx, CommonInfo, attr::BTFDeclTag, /*IsLateParsed=*/false, false) , bTFDeclTagLength(BTFDeclTag.size()),bTFDeclTag(new (Ctx, 1) char[bTFDeclTagLength]) { if (!BTFDeclTag.empty()) std::memcpy(bTFDeclTag, BTFDeclTag.data(), bTFDeclTagLength); } BTFDeclTagAttr *BTFDeclTagAttr::clone(ASTContext &C) const { auto *A = new (C) BTFDeclTagAttr(C, *this, getBTFDeclTag()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void BTFDeclTagAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((btf_decl_tag"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getBTFDeclTag() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::btf_decl_tag"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getBTFDeclTag() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::btf_decl_tag"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getBTFDeclTag() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *BTFDeclTagAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "btf_decl_tag"; case 1: return "btf_decl_tag"; case 2: return "btf_decl_tag"; } } // BTFTypeTagAttr implementation BTFTypeTagAttr *BTFTypeTagAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef BTFTypeTag, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BTFTypeTagAttr(Ctx, CommonInfo, BTFTypeTag); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BTFTypeTagAttr *BTFTypeTagAttr::Create(ASTContext &Ctx, llvm::StringRef BTFTypeTag, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BTFTypeTagAttr(Ctx, CommonInfo, BTFTypeTag); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BTFTypeTagAttr *BTFTypeTagAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef BTFTypeTag, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_btf_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_btf_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_btf_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_btf_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_btf_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_btf_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, BTFTypeTag, I); } BTFTypeTagAttr *BTFTypeTagAttr::Create(ASTContext &Ctx, llvm::StringRef BTFTypeTag, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_btf_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_btf_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_btf_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_btf_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_btf_type_tag: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_btf_type_tag, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, BTFTypeTag, I); } BTFTypeTagAttr::BTFTypeTagAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef BTFTypeTag ) : TypeAttr(Ctx, CommonInfo, attr::BTFTypeTag, /*IsLateParsed=*/false) , bTFTypeTagLength(BTFTypeTag.size()),bTFTypeTag(new (Ctx, 1) char[bTFTypeTagLength]) { if (!BTFTypeTag.empty()) std::memcpy(bTFTypeTag, BTFTypeTag.data(), bTFTypeTagLength); } BTFTypeTagAttr *BTFTypeTagAttr::clone(ASTContext &C) const { auto *A = new (C) BTFTypeTagAttr(C, *this, getBTFTypeTag()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void BTFTypeTagAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((btf_type_tag"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getBTFTypeTag() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::btf_type_tag"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getBTFTypeTag() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::btf_type_tag"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getBTFTypeTag() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *BTFTypeTagAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "btf_type_tag"; case 1: return "btf_type_tag"; case 2: return "btf_type_tag"; } } // BlockingAttr implementation BlockingAttr *BlockingAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BlockingAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BlockingAttr *BlockingAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BlockingAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BlockingAttr *BlockingAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_blocking: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_blocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_blocking: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_blocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_blocking: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_blocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } BlockingAttr *BlockingAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_blocking: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_blocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_blocking: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_blocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_blocking: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_blocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } BlockingAttr::BlockingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::Blocking, /*IsLateParsed=*/false) { } BlockingAttr *BlockingAttr::clone(ASTContext &C) const { auto *A = new (C) BlockingAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void BlockingAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((blocking"; OS << "))"; break; } case 1 : { OS << "[[clang::blocking"; OS << "]]"; break; } case 2 : { OS << "[[clang::blocking"; OS << "]]"; break; } } } const char *BlockingAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "blocking"; case 1: return "blocking"; case 2: return "blocking"; } } // BlocksAttr implementation BlocksAttr *BlocksAttr::CreateImplicit(ASTContext &Ctx, BlocksAttr::BlockType Type, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BlocksAttr(Ctx, CommonInfo, Type); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BlocksAttr *BlocksAttr::Create(ASTContext &Ctx, BlocksAttr::BlockType Type, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BlocksAttr(Ctx, CommonInfo, Type); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BlocksAttr *BlocksAttr::CreateImplicit(ASTContext &Ctx, BlocksAttr::BlockType Type, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_blocks: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_blocks, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_blocks: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_blocks, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_blocks: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_blocks, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Type, I); } BlocksAttr *BlocksAttr::Create(ASTContext &Ctx, BlocksAttr::BlockType Type, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_blocks: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_blocks, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_blocks: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_blocks, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_blocks: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_blocks, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Type, I); } BlocksAttr::BlocksAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , BlocksAttr::BlockType Type ) : InheritableAttr(Ctx, CommonInfo, attr::Blocks, /*IsLateParsed=*/false, false) , type(Type) { } bool BlocksAttr::ConvertStrToBlockType(StringRef Val, BlocksAttr::BlockType &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("byref", BlocksAttr::BlockType::ByRef) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *BlocksAttr::ConvertBlockTypeToStr(BlocksAttr::BlockType Val) { switch(Val) { case BlocksAttr::BlockType::ByRef: return "byref"; } llvm_unreachable("No enumerator with that value"); } BlocksAttr *BlocksAttr::clone(ASTContext &C) const { auto *A = new (C) BlocksAttr(C, *this, type); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void BlocksAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((blocks"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << BlocksAttr::ConvertBlockTypeToStr(getType()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::blocks"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << BlocksAttr::ConvertBlockTypeToStr(getType()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::blocks"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << BlocksAttr::ConvertBlockTypeToStr(getType()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *BlocksAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "blocks"; case 1: return "blocks"; case 2: return "blocks"; } } // BuiltinAttr implementation BuiltinAttr *BuiltinAttr::CreateImplicit(ASTContext &Ctx, unsigned ID, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BuiltinAttr(Ctx, CommonInfo, ID); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BuiltinAttr *BuiltinAttr::Create(ASTContext &Ctx, unsigned ID, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BuiltinAttr(Ctx, CommonInfo, ID); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BuiltinAttr *BuiltinAttr::CreateImplicit(ASTContext &Ctx, unsigned ID, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, ID, I); } BuiltinAttr *BuiltinAttr::Create(ASTContext &Ctx, unsigned ID, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, ID, I); } BuiltinAttr::BuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned ID ) : InheritableAttr(Ctx, CommonInfo, attr::Builtin, /*IsLateParsed=*/false, false) , iD(ID) { } BuiltinAttr *BuiltinAttr::clone(ASTContext &C) const { auto *A = new (C) BuiltinAttr(C, *this, iD); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void BuiltinAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *BuiltinAttr::getSpelling() const { return "(No spelling)"; } // BuiltinAliasAttr implementation BuiltinAliasAttr *BuiltinAliasAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BuiltinName, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BuiltinAliasAttr(Ctx, CommonInfo, BuiltinName); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } BuiltinAliasAttr *BuiltinAliasAttr::Create(ASTContext &Ctx, IdentifierInfo * BuiltinName, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) BuiltinAliasAttr(Ctx, CommonInfo, BuiltinName); return A; } BuiltinAliasAttr *BuiltinAliasAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BuiltinName, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_clang_builtin_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_builtin_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_clang_builtin_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clang_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, BuiltinName, I); } BuiltinAliasAttr *BuiltinAliasAttr::Create(ASTContext &Ctx, IdentifierInfo * BuiltinName, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_clang_builtin_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_builtin_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_clang_builtin_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clang_builtin_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, BuiltinName, I); } BuiltinAliasAttr::BuiltinAliasAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * BuiltinName ) : Attr(Ctx, CommonInfo, attr::BuiltinAlias, /*IsLateParsed=*/false) , builtinName(BuiltinName) { } BuiltinAliasAttr::Spelling BuiltinAliasAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return CXX11_clang_builtin_alias; case 1: return C23_clang_builtin_alias; case 2: return GNU_clang_builtin_alias; } } BuiltinAliasAttr *BuiltinAliasAttr::clone(ASTContext &C) const { auto *A = new (C) BuiltinAliasAttr(C, *this, builtinName); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void BuiltinAliasAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[clang::builtin_alias"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 1 : { OS << "[[clang::builtin_alias"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "__attribute__((clang_builtin_alias"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getBuiltinName() ? getBuiltinName()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *BuiltinAliasAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "builtin_alias"; case 1: return "builtin_alias"; case 2: return "clang_builtin_alias"; } } // C11NoReturnAttr implementation C11NoReturnAttr *C11NoReturnAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) C11NoReturnAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } C11NoReturnAttr *C11NoReturnAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) C11NoReturnAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } C11NoReturnAttr *C11NoReturnAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } C11NoReturnAttr *C11NoReturnAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } C11NoReturnAttr::C11NoReturnAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::C11NoReturn, /*IsLateParsed=*/false, false) { } C11NoReturnAttr *C11NoReturnAttr::clone(ASTContext &C) const { auto *A = new (C) C11NoReturnAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void C11NoReturnAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "_Noreturn"; OS << ""; break; } } } const char *C11NoReturnAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "_Noreturn"; } } // CDeclAttr implementation CDeclAttr *CDeclAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CDeclAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CDeclAttr *CDeclAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CDeclAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CDeclAttr *CDeclAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cdecl: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_cdecl: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_cdecl: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_cdecl: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CDeclAttr *CDeclAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cdecl: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_cdecl: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_cdecl: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_cdecl: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_cdecl, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CDeclAttr::CDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CDecl, /*IsLateParsed=*/false, false) { } CDeclAttr *CDeclAttr::clone(ASTContext &C) const { auto *A = new (C) CDeclAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CDeclAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((cdecl"; OS << "))"; break; } case 1 : { OS << "[[gnu::cdecl"; OS << "]]"; break; } case 2 : { OS << "[[gnu::cdecl"; OS << "]]"; break; } case 3 : { OS << "__cdecl"; OS << ""; break; } case 4 : { OS << "_cdecl"; OS << ""; break; } } } const char *CDeclAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "cdecl"; case 1: return "cdecl"; case 2: return "cdecl"; case 3: return "__cdecl"; case 4: return "_cdecl"; } } // CFAuditedTransferAttr implementation CFAuditedTransferAttr *CFAuditedTransferAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CFAuditedTransferAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CFAuditedTransferAttr *CFAuditedTransferAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CFAuditedTransferAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CFAuditedTransferAttr *CFAuditedTransferAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cf_audited_transfer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_audited_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cf_audited_transfer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_audited_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cf_audited_transfer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_audited_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CFAuditedTransferAttr *CFAuditedTransferAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cf_audited_transfer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_audited_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cf_audited_transfer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_audited_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cf_audited_transfer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_audited_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CFAuditedTransferAttr::CFAuditedTransferAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CFAuditedTransfer, /*IsLateParsed=*/false, false) { } CFAuditedTransferAttr *CFAuditedTransferAttr::clone(ASTContext &C) const { auto *A = new (C) CFAuditedTransferAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CFAuditedTransferAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((cf_audited_transfer"; OS << "))"; break; } case 1 : { OS << "[[clang::cf_audited_transfer"; OS << "]]"; break; } case 2 : { OS << "[[clang::cf_audited_transfer"; OS << "]]"; break; } } } const char *CFAuditedTransferAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "cf_audited_transfer"; case 1: return "cf_audited_transfer"; case 2: return "cf_audited_transfer"; } } // CFConsumedAttr implementation CFConsumedAttr *CFConsumedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CFConsumedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CFConsumedAttr *CFConsumedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CFConsumedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CFConsumedAttr *CFConsumedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cf_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cf_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cf_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CFConsumedAttr *CFConsumedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cf_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cf_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cf_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CFConsumedAttr::CFConsumedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableParamAttr(Ctx, CommonInfo, attr::CFConsumed, /*IsLateParsed=*/false, false) { } CFConsumedAttr *CFConsumedAttr::clone(ASTContext &C) const { auto *A = new (C) CFConsumedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CFConsumedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((cf_consumed"; OS << "))"; break; } case 1 : { OS << "[[clang::cf_consumed"; OS << "]]"; break; } case 2 : { OS << "[[clang::cf_consumed"; OS << "]]"; break; } } } const char *CFConsumedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "cf_consumed"; case 1: return "cf_consumed"; case 2: return "cf_consumed"; } } // CFGuardAttr implementation CFGuardAttr *CFGuardAttr::CreateImplicit(ASTContext &Ctx, CFGuardAttr::GuardArg Guard, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CFGuardAttr(Ctx, CommonInfo, Guard); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CFGuardAttr *CFGuardAttr::Create(ASTContext &Ctx, CFGuardAttr::GuardArg Guard, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CFGuardAttr(Ctx, CommonInfo, Guard); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CFGuardAttr *CFGuardAttr::CreateImplicit(ASTContext &Ctx, CFGuardAttr::GuardArg Guard, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_guard: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_guard: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_guard: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_guard: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Guard, I); } CFGuardAttr *CFGuardAttr::Create(ASTContext &Ctx, CFGuardAttr::GuardArg Guard, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_guard: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_guard: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_guard: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_guard: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_guard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Guard, I); } CFGuardAttr::CFGuardAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , CFGuardAttr::GuardArg Guard ) : InheritableAttr(Ctx, CommonInfo, attr::CFGuard, /*IsLateParsed=*/false, false) , guard(Guard) { } bool CFGuardAttr::ConvertStrToGuardArg(StringRef Val, CFGuardAttr::GuardArg &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("nocf", CFGuardAttr::GuardArg::nocf) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *CFGuardAttr::ConvertGuardArgToStr(CFGuardAttr::GuardArg Val) { switch(Val) { case CFGuardAttr::GuardArg::nocf: return "nocf"; } llvm_unreachable("No enumerator with that value"); } CFGuardAttr *CFGuardAttr::clone(ASTContext &C) const { auto *A = new (C) CFGuardAttr(C, *this, guard); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CFGuardAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__declspec(guard"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << CFGuardAttr::ConvertGuardArgToStr(getGuard()) << "\""; if (!IsFirstArgument) OS << ")"; OS << ")"; break; } case 1 : { OS << "__attribute__((guard"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << CFGuardAttr::ConvertGuardArgToStr(getGuard()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 2 : { OS << "[[clang::guard"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << CFGuardAttr::ConvertGuardArgToStr(getGuard()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 3 : { OS << "[[clang::guard"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << CFGuardAttr::ConvertGuardArgToStr(getGuard()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *CFGuardAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "guard"; case 1: return "guard"; case 2: return "guard"; case 3: return "guard"; } } // CFICanonicalJumpTableAttr implementation CFICanonicalJumpTableAttr *CFICanonicalJumpTableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CFICanonicalJumpTableAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CFICanonicalJumpTableAttr *CFICanonicalJumpTableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CFICanonicalJumpTableAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CFICanonicalJumpTableAttr *CFICanonicalJumpTableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cfi_canonical_jump_table: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cfi_canonical_jump_table, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cfi_canonical_jump_table: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cfi_canonical_jump_table, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cfi_canonical_jump_table: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cfi_canonical_jump_table, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CFICanonicalJumpTableAttr *CFICanonicalJumpTableAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cfi_canonical_jump_table: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cfi_canonical_jump_table, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cfi_canonical_jump_table: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cfi_canonical_jump_table, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cfi_canonical_jump_table: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cfi_canonical_jump_table, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CFICanonicalJumpTableAttr::CFICanonicalJumpTableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CFICanonicalJumpTable, /*IsLateParsed=*/false, false) { } CFICanonicalJumpTableAttr *CFICanonicalJumpTableAttr::clone(ASTContext &C) const { auto *A = new (C) CFICanonicalJumpTableAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CFICanonicalJumpTableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((cfi_canonical_jump_table"; OS << "))"; break; } case 1 : { OS << "[[clang::cfi_canonical_jump_table"; OS << "]]"; break; } case 2 : { OS << "[[clang::cfi_canonical_jump_table"; OS << "]]"; break; } } } const char *CFICanonicalJumpTableAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "cfi_canonical_jump_table"; case 1: return "cfi_canonical_jump_table"; case 2: return "cfi_canonical_jump_table"; } } // CFReturnsNotRetainedAttr implementation CFReturnsNotRetainedAttr *CFReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CFReturnsNotRetainedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CFReturnsNotRetainedAttr *CFReturnsNotRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CFReturnsNotRetainedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CFReturnsNotRetainedAttr *CFReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cf_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cf_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cf_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CFReturnsNotRetainedAttr *CFReturnsNotRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cf_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cf_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cf_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CFReturnsNotRetainedAttr::CFReturnsNotRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CFReturnsNotRetained, /*IsLateParsed=*/false, false) { } CFReturnsNotRetainedAttr *CFReturnsNotRetainedAttr::clone(ASTContext &C) const { auto *A = new (C) CFReturnsNotRetainedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CFReturnsNotRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((cf_returns_not_retained"; OS << "))"; break; } case 1 : { OS << "[[clang::cf_returns_not_retained"; OS << "]]"; break; } case 2 : { OS << "[[clang::cf_returns_not_retained"; OS << "]]"; break; } } } const char *CFReturnsNotRetainedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "cf_returns_not_retained"; case 1: return "cf_returns_not_retained"; case 2: return "cf_returns_not_retained"; } } // CFReturnsRetainedAttr implementation CFReturnsRetainedAttr *CFReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CFReturnsRetainedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CFReturnsRetainedAttr *CFReturnsRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CFReturnsRetainedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CFReturnsRetainedAttr *CFReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cf_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cf_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cf_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CFReturnsRetainedAttr *CFReturnsRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cf_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cf_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cf_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CFReturnsRetainedAttr::CFReturnsRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CFReturnsRetained, /*IsLateParsed=*/false, false) { } CFReturnsRetainedAttr *CFReturnsRetainedAttr::clone(ASTContext &C) const { auto *A = new (C) CFReturnsRetainedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CFReturnsRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((cf_returns_retained"; OS << "))"; break; } case 1 : { OS << "[[clang::cf_returns_retained"; OS << "]]"; break; } case 2 : { OS << "[[clang::cf_returns_retained"; OS << "]]"; break; } } } const char *CFReturnsRetainedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "cf_returns_retained"; case 1: return "cf_returns_retained"; case 2: return "cf_returns_retained"; } } // CFUnknownTransferAttr implementation CFUnknownTransferAttr *CFUnknownTransferAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CFUnknownTransferAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CFUnknownTransferAttr *CFUnknownTransferAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CFUnknownTransferAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CFUnknownTransferAttr *CFUnknownTransferAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cf_unknown_transfer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_unknown_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cf_unknown_transfer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_unknown_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cf_unknown_transfer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_unknown_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CFUnknownTransferAttr *CFUnknownTransferAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cf_unknown_transfer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cf_unknown_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cf_unknown_transfer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cf_unknown_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cf_unknown_transfer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cf_unknown_transfer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CFUnknownTransferAttr::CFUnknownTransferAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CFUnknownTransfer, /*IsLateParsed=*/false, false) { } CFUnknownTransferAttr *CFUnknownTransferAttr::clone(ASTContext &C) const { auto *A = new (C) CFUnknownTransferAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CFUnknownTransferAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((cf_unknown_transfer"; OS << "))"; break; } case 1 : { OS << "[[clang::cf_unknown_transfer"; OS << "]]"; break; } case 2 : { OS << "[[clang::cf_unknown_transfer"; OS << "]]"; break; } } } const char *CFUnknownTransferAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "cf_unknown_transfer"; case 1: return "cf_unknown_transfer"; case 2: return "cf_unknown_transfer"; } } // CPUDispatchAttr implementation CPUDispatchAttr *CPUDispatchAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CPUDispatchAttr(Ctx, CommonInfo, Cpus, CpusSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CPUDispatchAttr *CPUDispatchAttr::Create(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CPUDispatchAttr(Ctx, CommonInfo, Cpus, CpusSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CPUDispatchAttr *CPUDispatchAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cpu_dispatch: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cpu_dispatch: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cpu_dispatch: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_cpu_dispatch: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Cpus, CpusSize, I); } CPUDispatchAttr *CPUDispatchAttr::Create(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cpu_dispatch: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cpu_dispatch: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cpu_dispatch: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_cpu_dispatch: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_cpu_dispatch, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Cpus, CpusSize, I); } CPUDispatchAttr::CPUDispatchAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * *Cpus, unsigned CpusSize ) : InheritableAttr(Ctx, CommonInfo, attr::CPUDispatch, /*IsLateParsed=*/false, false) , cpus_Size(CpusSize), cpus_(new (Ctx, 16) IdentifierInfo *[cpus_Size]) { std::copy(Cpus, Cpus + cpus_Size, cpus_); } CPUDispatchAttr::CPUDispatchAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CPUDispatch, /*IsLateParsed=*/false, false) , cpus_Size(0), cpus_(nullptr) { } CPUDispatchAttr *CPUDispatchAttr::clone(ASTContext &C) const { auto *A = new (C) CPUDispatchAttr(C, *this, cpus_, cpus_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CPUDispatchAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((cpu_dispatch"; OS << ""; for (const auto &Val : cpus()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::cpu_dispatch"; OS << ""; for (const auto &Val : cpus()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::cpu_dispatch"; OS << ""; for (const auto &Val : cpus()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 3 : { OS << "__declspec(cpu_dispatch"; OS << ""; for (const auto &Val : cpus()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << ")"; break; } } } const char *CPUDispatchAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "cpu_dispatch"; case 1: return "cpu_dispatch"; case 2: return "cpu_dispatch"; case 3: return "cpu_dispatch"; } } // CPUSpecificAttr implementation CPUSpecificAttr *CPUSpecificAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CPUSpecificAttr(Ctx, CommonInfo, Cpus, CpusSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CPUSpecificAttr *CPUSpecificAttr::Create(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CPUSpecificAttr(Ctx, CommonInfo, Cpus, CpusSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CPUSpecificAttr *CPUSpecificAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cpu_specific: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cpu_specific: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cpu_specific: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_cpu_specific: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Cpus, CpusSize, I); } CPUSpecificAttr *CPUSpecificAttr::Create(ASTContext &Ctx, IdentifierInfo * *Cpus, unsigned CpusSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cpu_specific: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_cpu_specific: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_cpu_specific: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_cpu_specific: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_cpu_specific, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Cpus, CpusSize, I); } CPUSpecificAttr::CPUSpecificAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * *Cpus, unsigned CpusSize ) : InheritableAttr(Ctx, CommonInfo, attr::CPUSpecific, /*IsLateParsed=*/false, false) , cpus_Size(CpusSize), cpus_(new (Ctx, 16) IdentifierInfo *[cpus_Size]) { std::copy(Cpus, Cpus + cpus_Size, cpus_); } CPUSpecificAttr::CPUSpecificAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CPUSpecific, /*IsLateParsed=*/false, false) , cpus_Size(0), cpus_(nullptr) { } CPUSpecificAttr *CPUSpecificAttr::clone(ASTContext &C) const { auto *A = new (C) CPUSpecificAttr(C, *this, cpus_, cpus_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CPUSpecificAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((cpu_specific"; OS << ""; for (const auto &Val : cpus()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::cpu_specific"; OS << ""; for (const auto &Val : cpus()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::cpu_specific"; OS << ""; for (const auto &Val : cpus()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 3 : { OS << "__declspec(cpu_specific"; OS << ""; for (const auto &Val : cpus()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << ")"; break; } } } const char *CPUSpecificAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "cpu_specific"; case 1: return "cpu_specific"; case 2: return "cpu_specific"; case 3: return "cpu_specific"; } } // CUDAConstantAttr implementation CUDAConstantAttr *CUDAConstantAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDAConstantAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDAConstantAttr *CUDAConstantAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDAConstantAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDAConstantAttr *CUDAConstantAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_constant: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_constant: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CUDAConstantAttr *CUDAConstantAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_constant: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_constant: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CUDAConstantAttr::CUDAConstantAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CUDAConstant, /*IsLateParsed=*/false, false) { } CUDAConstantAttr *CUDAConstantAttr::clone(ASTContext &C) const { auto *A = new (C) CUDAConstantAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CUDAConstantAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((constant"; OS << "))"; break; } case 1 : { OS << "__declspec(__constant__"; OS << ")"; break; } } } const char *CUDAConstantAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "constant"; case 1: return "__constant__"; } } // CUDADeviceAttr implementation CUDADeviceAttr *CUDADeviceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDADeviceAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDADeviceAttr *CUDADeviceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDADeviceAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDADeviceAttr *CUDADeviceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_device: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_device: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CUDADeviceAttr *CUDADeviceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_device: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_device: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CUDADeviceAttr::CUDADeviceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CUDADevice, /*IsLateParsed=*/false, false) { } CUDADeviceAttr *CUDADeviceAttr::clone(ASTContext &C) const { auto *A = new (C) CUDADeviceAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CUDADeviceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((device"; OS << "))"; break; } case 1 : { OS << "__declspec(__device__"; OS << ")"; break; } } } const char *CUDADeviceAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "device"; case 1: return "__device__"; } } // CUDADeviceBuiltinSurfaceTypeAttr implementation CUDADeviceBuiltinSurfaceTypeAttr *CUDADeviceBuiltinSurfaceTypeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDADeviceBuiltinSurfaceTypeAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDADeviceBuiltinSurfaceTypeAttr *CUDADeviceBuiltinSurfaceTypeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDADeviceBuiltinSurfaceTypeAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDADeviceBuiltinSurfaceTypeAttr *CUDADeviceBuiltinSurfaceTypeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_device_builtin_surface_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_device_builtin_surface_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_device_builtin_surface_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_device_builtin_surface_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CUDADeviceBuiltinSurfaceTypeAttr *CUDADeviceBuiltinSurfaceTypeAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_device_builtin_surface_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_device_builtin_surface_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_device_builtin_surface_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_device_builtin_surface_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CUDADeviceBuiltinSurfaceTypeAttr::CUDADeviceBuiltinSurfaceTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CUDADeviceBuiltinSurfaceType, /*IsLateParsed=*/false, false) { } CUDADeviceBuiltinSurfaceTypeAttr *CUDADeviceBuiltinSurfaceTypeAttr::clone(ASTContext &C) const { auto *A = new (C) CUDADeviceBuiltinSurfaceTypeAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CUDADeviceBuiltinSurfaceTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((device_builtin_surface_type"; OS << "))"; break; } case 1 : { OS << "__declspec(__device_builtin_surface_type__"; OS << ")"; break; } } } const char *CUDADeviceBuiltinSurfaceTypeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "device_builtin_surface_type"; case 1: return "__device_builtin_surface_type__"; } } // CUDADeviceBuiltinTextureTypeAttr implementation CUDADeviceBuiltinTextureTypeAttr *CUDADeviceBuiltinTextureTypeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDADeviceBuiltinTextureTypeAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDADeviceBuiltinTextureTypeAttr *CUDADeviceBuiltinTextureTypeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDADeviceBuiltinTextureTypeAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDADeviceBuiltinTextureTypeAttr *CUDADeviceBuiltinTextureTypeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_device_builtin_texture_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_device_builtin_texture_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_device_builtin_texture_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_device_builtin_texture_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CUDADeviceBuiltinTextureTypeAttr *CUDADeviceBuiltinTextureTypeAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_device_builtin_texture_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_device_builtin_texture_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_device_builtin_texture_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_device_builtin_texture_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CUDADeviceBuiltinTextureTypeAttr::CUDADeviceBuiltinTextureTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CUDADeviceBuiltinTextureType, /*IsLateParsed=*/false, false) { } CUDADeviceBuiltinTextureTypeAttr *CUDADeviceBuiltinTextureTypeAttr::clone(ASTContext &C) const { auto *A = new (C) CUDADeviceBuiltinTextureTypeAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CUDADeviceBuiltinTextureTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((device_builtin_texture_type"; OS << "))"; break; } case 1 : { OS << "__declspec(__device_builtin_texture_type__"; OS << ")"; break; } } } const char *CUDADeviceBuiltinTextureTypeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "device_builtin_texture_type"; case 1: return "__device_builtin_texture_type__"; } } // CUDAGlobalAttr implementation CUDAGlobalAttr *CUDAGlobalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDAGlobalAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDAGlobalAttr *CUDAGlobalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDAGlobalAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDAGlobalAttr *CUDAGlobalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_global: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_global: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CUDAGlobalAttr *CUDAGlobalAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_global: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_global: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CUDAGlobalAttr::CUDAGlobalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CUDAGlobal, /*IsLateParsed=*/false, false) { } CUDAGlobalAttr *CUDAGlobalAttr::clone(ASTContext &C) const { auto *A = new (C) CUDAGlobalAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CUDAGlobalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((global"; OS << "))"; break; } case 1 : { OS << "__declspec(__global__"; OS << ")"; break; } } } const char *CUDAGlobalAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "global"; case 1: return "__global__"; } } // CUDAHostAttr implementation CUDAHostAttr *CUDAHostAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDAHostAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDAHostAttr *CUDAHostAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDAHostAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDAHostAttr *CUDAHostAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_host: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_host: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CUDAHostAttr *CUDAHostAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_host: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_host: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CUDAHostAttr::CUDAHostAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CUDAHost, /*IsLateParsed=*/false, false) { } CUDAHostAttr *CUDAHostAttr::clone(ASTContext &C) const { auto *A = new (C) CUDAHostAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CUDAHostAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((host"; OS << "))"; break; } case 1 : { OS << "__declspec(__host__"; OS << ")"; break; } } } const char *CUDAHostAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "host"; case 1: return "__host__"; } } // CUDAInvalidTargetAttr implementation CUDAInvalidTargetAttr *CUDAInvalidTargetAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDAInvalidTargetAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDAInvalidTargetAttr *CUDAInvalidTargetAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDAInvalidTargetAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDAInvalidTargetAttr *CUDAInvalidTargetAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, I); } CUDAInvalidTargetAttr *CUDAInvalidTargetAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, I); } CUDAInvalidTargetAttr::CUDAInvalidTargetAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CUDAInvalidTarget, /*IsLateParsed=*/false, false) { } CUDAInvalidTargetAttr *CUDAInvalidTargetAttr::clone(ASTContext &C) const { auto *A = new (C) CUDAInvalidTargetAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CUDAInvalidTargetAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *CUDAInvalidTargetAttr::getSpelling() const { return "(No spelling)"; } // CUDALaunchBoundsAttr implementation CUDALaunchBoundsAttr *CUDALaunchBoundsAttr::CreateImplicit(ASTContext &Ctx, Expr * MaxThreads, Expr * MinBlocks, Expr * MaxBlocks, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDALaunchBoundsAttr(Ctx, CommonInfo, MaxThreads, MinBlocks, MaxBlocks); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDALaunchBoundsAttr *CUDALaunchBoundsAttr::Create(ASTContext &Ctx, Expr * MaxThreads, Expr * MinBlocks, Expr * MaxBlocks, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDALaunchBoundsAttr(Ctx, CommonInfo, MaxThreads, MinBlocks, MaxBlocks); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDALaunchBoundsAttr *CUDALaunchBoundsAttr::CreateImplicit(ASTContext &Ctx, Expr * MaxThreads, Expr * MinBlocks, Expr * MaxBlocks, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_launch_bounds: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_launch_bounds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_launch_bounds: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_launch_bounds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, MaxThreads, MinBlocks, MaxBlocks, I); } CUDALaunchBoundsAttr *CUDALaunchBoundsAttr::Create(ASTContext &Ctx, Expr * MaxThreads, Expr * MinBlocks, Expr * MaxBlocks, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_launch_bounds: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_launch_bounds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_launch_bounds: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_launch_bounds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, MaxThreads, MinBlocks, MaxBlocks, I); } CUDALaunchBoundsAttr::CUDALaunchBoundsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * MaxThreads , Expr * MinBlocks , Expr * MaxBlocks ) : InheritableAttr(Ctx, CommonInfo, attr::CUDALaunchBounds, /*IsLateParsed=*/false, false) , maxThreads(MaxThreads) , minBlocks(MinBlocks) , maxBlocks(MaxBlocks) { } CUDALaunchBoundsAttr::CUDALaunchBoundsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * MaxThreads ) : InheritableAttr(Ctx, CommonInfo, attr::CUDALaunchBounds, /*IsLateParsed=*/false, false) , maxThreads(MaxThreads) , minBlocks() , maxBlocks() { } CUDALaunchBoundsAttr *CUDALaunchBoundsAttr::clone(ASTContext &C) const { auto *A = new (C) CUDALaunchBoundsAttr(C, *this, maxThreads, minBlocks, maxBlocks); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CUDALaunchBoundsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((launch_bounds"; if (!getMaxBlocks()) ++TrailingOmittedArgs; if (!getMinBlocks()) ++TrailingOmittedArgs; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMaxThreads()->printPretty(OS, nullptr, Policy); OS << ""; if (!(!getMinBlocks())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMinBlocks()->printPretty(OS, nullptr, Policy); OS << ""; } if (!(!getMaxBlocks())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMaxBlocks()->printPretty(OS, nullptr, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "__declspec(__launch_bounds__"; if (!getMaxBlocks()) ++TrailingOmittedArgs; if (!getMinBlocks()) ++TrailingOmittedArgs; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMaxThreads()->printPretty(OS, nullptr, Policy); OS << ""; if (!(!getMinBlocks())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMinBlocks()->printPretty(OS, nullptr, Policy); OS << ""; } if (!(!getMaxBlocks())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getMaxBlocks()->printPretty(OS, nullptr, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << ")"; break; } } } const char *CUDALaunchBoundsAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "launch_bounds"; case 1: return "__launch_bounds__"; } } // CUDASharedAttr implementation CUDASharedAttr *CUDASharedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDASharedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDASharedAttr *CUDASharedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CUDASharedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CUDASharedAttr *CUDASharedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_shared: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_shared: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_shared, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CUDASharedAttr *CUDASharedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_shared: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_shared: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_shared, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CUDASharedAttr::CUDASharedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CUDAShared, /*IsLateParsed=*/false, false) { } CUDASharedAttr *CUDASharedAttr::clone(ASTContext &C) const { auto *A = new (C) CUDASharedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CUDASharedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((shared"; OS << "))"; break; } case 1 : { OS << "__declspec(__shared__"; OS << ")"; break; } } } const char *CUDASharedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "shared"; case 1: return "__shared__"; } } // CXX11NoReturnAttr implementation CXX11NoReturnAttr *CXX11NoReturnAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CXX11NoReturnAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CXX11NoReturnAttr *CXX11NoReturnAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CXX11NoReturnAttr(Ctx, CommonInfo); return A; } CXX11NoReturnAttr *CXX11NoReturnAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_noreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_noreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_Noreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_Noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CXX11NoReturnAttr *CXX11NoReturnAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_noreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_noreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_Noreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_Noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CXX11NoReturnAttr::CXX11NoReturnAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CXX11NoReturn, /*IsLateParsed=*/false, false) { } CXX11NoReturnAttr::Spelling CXX11NoReturnAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return CXX11_noreturn; case 1: return C23_noreturn; case 2: return C23_Noreturn; } } CXX11NoReturnAttr *CXX11NoReturnAttr::clone(ASTContext &C) const { auto *A = new (C) CXX11NoReturnAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CXX11NoReturnAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[noreturn"; OS << "]]"; break; } case 1 : { OS << "[[noreturn"; OS << "]]"; break; } case 2 : { OS << "[[_Noreturn"; OS << "]]"; break; } } } const char *CXX11NoReturnAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "noreturn"; case 1: return "noreturn"; case 2: return "_Noreturn"; } } // CXXAssumeAttr implementation CXXAssumeAttr *CXXAssumeAttr::CreateImplicit(ASTContext &Ctx, Expr * Assumption, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CXXAssumeAttr(Ctx, CommonInfo, Assumption); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CXXAssumeAttr *CXXAssumeAttr::Create(ASTContext &Ctx, Expr * Assumption, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CXXAssumeAttr(Ctx, CommonInfo, Assumption); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CXXAssumeAttr *CXXAssumeAttr::CreateImplicit(ASTContext &Ctx, Expr * Assumption, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_assume: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_assume: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_assume: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_assume: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Assumption, I); } CXXAssumeAttr *CXXAssumeAttr::Create(ASTContext &Ctx, Expr * Assumption, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_assume: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_assume: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_assume: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_assume: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_assume, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Assumption, I); } CXXAssumeAttr::CXXAssumeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Assumption ) : StmtAttr(Ctx, CommonInfo, attr::CXXAssume, /*IsLateParsed=*/false) , assumption(Assumption) { } CXXAssumeAttr *CXXAssumeAttr::clone(ASTContext &C) const { auto *A = new (C) CXXAssumeAttr(C, *this, assumption); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CXXAssumeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[assume"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getAssumption()->printPretty(OS, nullptr, Policy); OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 1 : { OS << "__attribute__((assume"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getAssumption()->printPretty(OS, nullptr, Policy); OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 2 : { OS << "[[clang::assume"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getAssumption()->printPretty(OS, nullptr, Policy); OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 3 : { OS << "[[clang::assume"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getAssumption()->printPretty(OS, nullptr, Policy); OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *CXXAssumeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "assume"; case 1: return "assume"; case 2: return "assume"; case 3: return "assume"; } } // CallableWhenAttr implementation CallableWhenAttr *CallableWhenAttr::CreateImplicit(ASTContext &Ctx, ConsumedState *CallableStates, unsigned CallableStatesSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CallableWhenAttr(Ctx, CommonInfo, CallableStates, CallableStatesSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CallableWhenAttr *CallableWhenAttr::Create(ASTContext &Ctx, ConsumedState *CallableStates, unsigned CallableStatesSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CallableWhenAttr(Ctx, CommonInfo, CallableStates, CallableStatesSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CallableWhenAttr *CallableWhenAttr::CreateImplicit(ASTContext &Ctx, ConsumedState *CallableStates, unsigned CallableStatesSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_callable_when: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_callable_when, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_callable_when: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_callable_when, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, CallableStates, CallableStatesSize, I); } CallableWhenAttr *CallableWhenAttr::Create(ASTContext &Ctx, ConsumedState *CallableStates, unsigned CallableStatesSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_callable_when: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_callable_when, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_callable_when: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_callable_when, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, CallableStates, CallableStatesSize, I); } CallableWhenAttr::CallableWhenAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , ConsumedState *CallableStates, unsigned CallableStatesSize ) : InheritableAttr(Ctx, CommonInfo, attr::CallableWhen, /*IsLateParsed=*/false, false) , callableStates_Size(CallableStatesSize), callableStates_(new (Ctx, 16) ConsumedState[callableStates_Size]) { std::copy(CallableStates, CallableStates + callableStates_Size, callableStates_); } CallableWhenAttr::CallableWhenAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CallableWhen, /*IsLateParsed=*/false, false) , callableStates_Size(0), callableStates_(nullptr) { } bool CallableWhenAttr::ConvertStrToConsumedState(StringRef Val, CallableWhenAttr::ConsumedState &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("unknown", CallableWhenAttr::ConsumedState::Unknown) .Case("consumed", CallableWhenAttr::ConsumedState::Consumed) .Case("unconsumed", CallableWhenAttr::ConsumedState::Unconsumed) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *CallableWhenAttr::ConvertConsumedStateToStr(CallableWhenAttr::ConsumedState Val) { switch(Val) { case CallableWhenAttr::ConsumedState::Unknown: return "unknown"; case CallableWhenAttr::ConsumedState::Consumed: return "consumed"; case CallableWhenAttr::ConsumedState::Unconsumed: return "unconsumed"; } llvm_unreachable("No enumerator with that value"); } CallableWhenAttr *CallableWhenAttr::clone(ASTContext &C) const { auto *A = new (C) CallableWhenAttr(C, *this, callableStates_, callableStates_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CallableWhenAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((callable_when"; OS << ""; for (const auto &Val : callableStates()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << CallableWhenAttr::ConvertConsumedStateToStr(Val)<< "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::callable_when"; OS << ""; for (const auto &Val : callableStates()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << CallableWhenAttr::ConvertConsumedStateToStr(Val)<< "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *CallableWhenAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "callable_when"; case 1: return "callable_when"; } } // CallbackAttr implementation CallbackAttr *CallbackAttr::CreateImplicit(ASTContext &Ctx, int *Encoding, unsigned EncodingSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CallbackAttr(Ctx, CommonInfo, Encoding, EncodingSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CallbackAttr *CallbackAttr::Create(ASTContext &Ctx, int *Encoding, unsigned EncodingSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CallbackAttr(Ctx, CommonInfo, Encoding, EncodingSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CallbackAttr *CallbackAttr::CreateImplicit(ASTContext &Ctx, int *Encoding, unsigned EncodingSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_callback: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_callback, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_callback: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_callback, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_callback: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_callback, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Encoding, EncodingSize, I); } CallbackAttr *CallbackAttr::Create(ASTContext &Ctx, int *Encoding, unsigned EncodingSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_callback: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_callback, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_callback: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_callback, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_callback: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_callback, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Encoding, EncodingSize, I); } CallbackAttr::CallbackAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , int *Encoding, unsigned EncodingSize ) : InheritableAttr(Ctx, CommonInfo, attr::Callback, /*IsLateParsed=*/false, false) , encoding_Size(EncodingSize), encoding_(new (Ctx, 16) int[encoding_Size]) { std::copy(Encoding, Encoding + encoding_Size, encoding_); } CallbackAttr::CallbackAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Callback, /*IsLateParsed=*/false, false) , encoding_Size(0), encoding_(nullptr) { } CallbackAttr *CallbackAttr::clone(ASTContext &C) const { auto *A = new (C) CallbackAttr(C, *this, encoding_, encoding_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CallbackAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((callback"; OS << ""; for (const auto &Val : encoding()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::callback"; OS << ""; for (const auto &Val : encoding()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::callback"; OS << ""; for (const auto &Val : encoding()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *CallbackAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "callback"; case 1: return "callback"; case 2: return "callback"; } } // CalledOnceAttr implementation CalledOnceAttr *CalledOnceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CalledOnceAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CalledOnceAttr *CalledOnceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CalledOnceAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CalledOnceAttr *CalledOnceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_called_once: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_called_once, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_called_once: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_called_once, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_called_once: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_called_once, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CalledOnceAttr *CalledOnceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_called_once: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_called_once, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_called_once: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_called_once, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_called_once: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_called_once, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CalledOnceAttr::CalledOnceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::CalledOnce, /*IsLateParsed=*/false) { } CalledOnceAttr *CalledOnceAttr::clone(ASTContext &C) const { auto *A = new (C) CalledOnceAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CalledOnceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((called_once"; OS << "))"; break; } case 1 : { OS << "[[clang::called_once"; OS << "]]"; break; } case 2 : { OS << "[[clang::called_once"; OS << "]]"; break; } } } const char *CalledOnceAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "called_once"; case 1: return "called_once"; case 2: return "called_once"; } } // CapabilityAttr implementation CapabilityAttr *CapabilityAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CapabilityAttr(Ctx, CommonInfo, Name); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CapabilityAttr *CapabilityAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CapabilityAttr(Ctx, CommonInfo, Name); return A; } CapabilityAttr *CapabilityAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Name, I); } CapabilityAttr *CapabilityAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Name, I); } CapabilityAttr::CapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Name ) : InheritableAttr(Ctx, CommonInfo, attr::Capability, /*IsLateParsed=*/false, false) , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) { if (!Name.empty()) std::memcpy(name, Name.data(), nameLength); } CapabilityAttr::Spelling CapabilityAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_capability; case 1: return CXX11_clang_capability; case 2: return GNU_shared_capability; case 3: return CXX11_clang_shared_capability; } } CapabilityAttr *CapabilityAttr::clone(ASTContext &C) const { auto *A = new (C) CapabilityAttr(C, *this, getName()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((capability"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::capability"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "__attribute__((shared_capability"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 3 : { OS << "[[clang::shared_capability"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *CapabilityAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "capability"; case 1: return "capability"; case 2: return "shared_capability"; case 3: return "shared_capability"; } } // CapturedRecordAttr implementation CapturedRecordAttr *CapturedRecordAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CapturedRecordAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CapturedRecordAttr *CapturedRecordAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CapturedRecordAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CapturedRecordAttr *CapturedRecordAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, I); } CapturedRecordAttr *CapturedRecordAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, I); } CapturedRecordAttr::CapturedRecordAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CapturedRecord, /*IsLateParsed=*/false, false) { } CapturedRecordAttr *CapturedRecordAttr::clone(ASTContext &C) const { auto *A = new (C) CapturedRecordAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CapturedRecordAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *CapturedRecordAttr::getSpelling() const { return "(No spelling)"; } // CarriesDependencyAttr implementation CarriesDependencyAttr *CarriesDependencyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CarriesDependencyAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CarriesDependencyAttr *CarriesDependencyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CarriesDependencyAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CarriesDependencyAttr *CarriesDependencyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_carries_dependency: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_carries_dependency, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_carries_dependency: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_carries_dependency, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CarriesDependencyAttr *CarriesDependencyAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_carries_dependency: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_carries_dependency, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_carries_dependency: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_carries_dependency, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CarriesDependencyAttr::CarriesDependencyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableParamAttr(Ctx, CommonInfo, attr::CarriesDependency, /*IsLateParsed=*/false, false) { } CarriesDependencyAttr *CarriesDependencyAttr::clone(ASTContext &C) const { auto *A = new (C) CarriesDependencyAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CarriesDependencyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((carries_dependency"; OS << "))"; break; } case 1 : { OS << "[[carries_dependency"; OS << "]]"; break; } } } const char *CarriesDependencyAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "carries_dependency"; case 1: return "carries_dependency"; } } // CleanupAttr implementation CleanupAttr *CleanupAttr::CreateImplicit(ASTContext &Ctx, FunctionDecl * FunctionDecl, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CleanupAttr(Ctx, CommonInfo, FunctionDecl); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CleanupAttr *CleanupAttr::Create(ASTContext &Ctx, FunctionDecl * FunctionDecl, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CleanupAttr(Ctx, CommonInfo, FunctionDecl); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CleanupAttr *CleanupAttr::CreateImplicit(ASTContext &Ctx, FunctionDecl * FunctionDecl, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cleanup: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cleanup, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_cleanup: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_cleanup, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_cleanup: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_cleanup, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, FunctionDecl, I); } CleanupAttr *CleanupAttr::Create(ASTContext &Ctx, FunctionDecl * FunctionDecl, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cleanup: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cleanup, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_cleanup: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_cleanup, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_cleanup: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_cleanup, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, FunctionDecl, I); } CleanupAttr::CleanupAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , FunctionDecl * FunctionDecl ) : InheritableAttr(Ctx, CommonInfo, attr::Cleanup, /*IsLateParsed=*/false, false) , functionDecl(FunctionDecl) { } CleanupAttr *CleanupAttr::clone(ASTContext &C) const { auto *A = new (C) CleanupAttr(C, *this, functionDecl); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CleanupAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((cleanup"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getFunctionDecl()->getNameInfo().getAsString() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::cleanup"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getFunctionDecl()->getNameInfo().getAsString() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::cleanup"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getFunctionDecl()->getNameInfo().getAsString() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *CleanupAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "cleanup"; case 1: return "cleanup"; case 2: return "cleanup"; } } // ClspvLibclcBuiltinAttr implementation ClspvLibclcBuiltinAttr *ClspvLibclcBuiltinAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ClspvLibclcBuiltinAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ClspvLibclcBuiltinAttr *ClspvLibclcBuiltinAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ClspvLibclcBuiltinAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ClspvLibclcBuiltinAttr *ClspvLibclcBuiltinAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_clspv_libclc_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clspv_libclc_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_clspv_libclc_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_clspv_libclc_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_clspv_libclc_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_clspv_libclc_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ClspvLibclcBuiltinAttr *ClspvLibclcBuiltinAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_clspv_libclc_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_clspv_libclc_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_clspv_libclc_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_clspv_libclc_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_clspv_libclc_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_clspv_libclc_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ClspvLibclcBuiltinAttr::ClspvLibclcBuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ClspvLibclcBuiltin, /*IsLateParsed=*/false, false) { } ClspvLibclcBuiltinAttr *ClspvLibclcBuiltinAttr::clone(ASTContext &C) const { auto *A = new (C) ClspvLibclcBuiltinAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ClspvLibclcBuiltinAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((clspv_libclc_builtin"; OS << "))"; break; } case 1 : { OS << "[[clang::clspv_libclc_builtin"; OS << "]]"; break; } case 2 : { OS << "[[clang::clspv_libclc_builtin"; OS << "]]"; break; } } } const char *ClspvLibclcBuiltinAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "clspv_libclc_builtin"; case 1: return "clspv_libclc_builtin"; case 2: return "clspv_libclc_builtin"; } } // CmseNSCallAttr implementation CmseNSCallAttr *CmseNSCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CmseNSCallAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CmseNSCallAttr *CmseNSCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CmseNSCallAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CmseNSCallAttr *CmseNSCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } CmseNSCallAttr *CmseNSCallAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } CmseNSCallAttr::CmseNSCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::CmseNSCall, /*IsLateParsed=*/false) { } CmseNSCallAttr *CmseNSCallAttr::clone(ASTContext &C) const { auto *A = new (C) CmseNSCallAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CmseNSCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((cmse_nonsecure_call"; OS << "))"; break; } } } const char *CmseNSCallAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "cmse_nonsecure_call"; } } // CmseNSEntryAttr implementation CmseNSEntryAttr *CmseNSEntryAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CmseNSEntryAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CmseNSEntryAttr *CmseNSEntryAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CmseNSEntryAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CmseNSEntryAttr *CmseNSEntryAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } CmseNSEntryAttr *CmseNSEntryAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } CmseNSEntryAttr::CmseNSEntryAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CmseNSEntry, /*IsLateParsed=*/false, false) { } CmseNSEntryAttr *CmseNSEntryAttr::clone(ASTContext &C) const { auto *A = new (C) CmseNSEntryAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CmseNSEntryAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((cmse_nonsecure_entry"; OS << "))"; break; } } } const char *CmseNSEntryAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "cmse_nonsecure_entry"; } } // CodeAlignAttr implementation CodeAlignAttr *CodeAlignAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CodeAlignAttr(Ctx, CommonInfo, Alignment); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CodeAlignAttr *CodeAlignAttr::Create(ASTContext &Ctx, Expr * Alignment, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CodeAlignAttr(Ctx, CommonInfo, Alignment); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CodeAlignAttr *CodeAlignAttr::CreateImplicit(ASTContext &Ctx, Expr * Alignment, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_code_align: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_code_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_code_align: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_code_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_code_align: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_code_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Alignment, I); } CodeAlignAttr *CodeAlignAttr::Create(ASTContext &Ctx, Expr * Alignment, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_code_align: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_code_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_code_align: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_code_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_code_align: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_code_align, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Alignment, I); } CodeAlignAttr::CodeAlignAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Alignment ) : StmtAttr(Ctx, CommonInfo, attr::CodeAlign, /*IsLateParsed=*/false) , alignment(Alignment) { } CodeAlignAttr *CodeAlignAttr::clone(ASTContext &C) const { auto *A = new (C) CodeAlignAttr(C, *this, alignment); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CodeAlignAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((code_align"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getAlignment()->printPretty(OS, nullptr, Policy); OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::code_align"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getAlignment()->printPretty(OS, nullptr, Policy); OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::code_align"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getAlignment()->printPretty(OS, nullptr, Policy); OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *CodeAlignAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "code_align"; case 1: return "code_align"; case 2: return "code_align"; } } // CodeModelAttr implementation CodeModelAttr *CodeModelAttr::CreateImplicit(ASTContext &Ctx, llvm::CodeModel::Model Model, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CodeModelAttr(Ctx, CommonInfo, Model); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CodeModelAttr *CodeModelAttr::Create(ASTContext &Ctx, llvm::CodeModel::Model Model, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CodeModelAttr(Ctx, CommonInfo, Model); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CodeModelAttr *CodeModelAttr::CreateImplicit(ASTContext &Ctx, llvm::CodeModel::Model Model, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_model: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_model: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_model: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Model, I); } CodeModelAttr *CodeModelAttr::Create(ASTContext &Ctx, llvm::CodeModel::Model Model, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_model: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_model: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_model: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Model, I); } CodeModelAttr::CodeModelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::CodeModel::Model Model ) : InheritableAttr(Ctx, CommonInfo, attr::CodeModel, /*IsLateParsed=*/false, false) , model(Model) { } bool CodeModelAttr::ConvertStrToModel(StringRef Val, llvm::CodeModel::Model &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("normal", llvm::CodeModel::Model::Small) .Case("medium", llvm::CodeModel::Model::Medium) .Case("extreme", llvm::CodeModel::Model::Large) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *CodeModelAttr::ConvertModelToStr(llvm::CodeModel::Model Val) { switch(Val) { case llvm::CodeModel::Model::Small: return "normal"; case llvm::CodeModel::Model::Medium: return "medium"; case llvm::CodeModel::Model::Large: return "extreme"; default: llvm_unreachable("Invalid attribute value"); } llvm_unreachable("No enumerator with that value"); } CodeModelAttr *CodeModelAttr::clone(ASTContext &C) const { auto *A = new (C) CodeModelAttr(C, *this, model); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CodeModelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((model"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << CodeModelAttr::ConvertModelToStr(getModel()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::model"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << CodeModelAttr::ConvertModelToStr(getModel()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::model"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << CodeModelAttr::ConvertModelToStr(getModel()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *CodeModelAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "model"; case 1: return "model"; case 2: return "model"; } } // CodeSegAttr implementation CodeSegAttr *CodeSegAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CodeSegAttr(Ctx, CommonInfo, Name); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CodeSegAttr *CodeSegAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CodeSegAttr(Ctx, CommonInfo, Name); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CodeSegAttr *CodeSegAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Name, I); } CodeSegAttr *CodeSegAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Name, I); } CodeSegAttr::CodeSegAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Name ) : InheritableAttr(Ctx, CommonInfo, attr::CodeSeg, /*IsLateParsed=*/false, false) , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) { if (!Name.empty()) std::memcpy(name, Name.data(), nameLength); } CodeSegAttr *CodeSegAttr::clone(ASTContext &C) const { auto *A = new (C) CodeSegAttr(C, *this, getName()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CodeSegAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__declspec(code_seg"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getName() << "\""; if (!IsFirstArgument) OS << ")"; OS << ")"; break; } } } const char *CodeSegAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "code_seg"; } } // ColdAttr implementation ColdAttr *ColdAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ColdAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ColdAttr *ColdAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ColdAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ColdAttr *ColdAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cold: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cold, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_cold: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_cold, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_cold: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_cold, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ColdAttr *ColdAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_cold: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_cold, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_cold: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_cold, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_cold: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_cold, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ColdAttr::ColdAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Cold, /*IsLateParsed=*/false, false) { } ColdAttr *ColdAttr::clone(ASTContext &C) const { auto *A = new (C) ColdAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ColdAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((cold"; OS << "))"; break; } case 1 : { OS << "[[gnu::cold"; OS << "]]"; break; } case 2 : { OS << "[[gnu::cold"; OS << "]]"; break; } } } const char *ColdAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "cold"; case 1: return "cold"; case 2: return "cold"; } } // CommonAttr implementation CommonAttr *CommonAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CommonAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CommonAttr *CommonAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CommonAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CommonAttr *CommonAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_common: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_common, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_common: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_common, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_common: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_common, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CommonAttr *CommonAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_common: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_common, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_common: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_common, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_common: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_common, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CommonAttr::CommonAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Common, /*IsLateParsed=*/false, false) { } CommonAttr *CommonAttr::clone(ASTContext &C) const { auto *A = new (C) CommonAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CommonAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((common"; OS << "))"; break; } case 1 : { OS << "[[gnu::common"; OS << "]]"; break; } case 2 : { OS << "[[gnu::common"; OS << "]]"; break; } } } const char *CommonAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "common"; case 1: return "common"; case 2: return "common"; } } // ConstAttr implementation ConstAttr *ConstAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ConstAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ConstAttr *ConstAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ConstAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ConstAttr *ConstAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_const: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_const, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_const: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_const, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_const: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_const, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ConstAttr *ConstAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_const: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_const, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_const: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_const, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_const: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_const, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ConstAttr::ConstAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Const, /*IsLateParsed=*/false, false) { } ConstAttr *ConstAttr::clone(ASTContext &C) const { auto *A = new (C) ConstAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ConstAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((const"; OS << "))"; break; } case 1 : { OS << "[[gnu::const"; OS << "]]"; break; } case 2 : { OS << "[[gnu::const"; OS << "]]"; break; } case 3 : { OS << "__attribute__((__const"; OS << "))"; break; } case 4 : { OS << "[[gnu::__const"; OS << "]]"; break; } case 5 : { OS << "[[gnu::__const"; OS << "]]"; break; } } } const char *ConstAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "const"; case 1: return "const"; case 2: return "const"; case 3: return "__const"; case 4: return "__const"; case 5: return "__const"; } } // ConstInitAttr implementation ConstInitAttr *ConstInitAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ConstInitAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ConstInitAttr *ConstInitAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ConstInitAttr(Ctx, CommonInfo); return A; } ConstInitAttr *ConstInitAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_constinit: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_constinit, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_require_constant_initialization: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_require_constant_initialization, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_require_constant_initialization: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_require_constant_initialization, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ConstInitAttr *ConstInitAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_constinit: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_constinit, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_require_constant_initialization: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_require_constant_initialization, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_require_constant_initialization: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_require_constant_initialization, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ConstInitAttr::ConstInitAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ConstInit, /*IsLateParsed=*/false, false) { } ConstInitAttr::Spelling ConstInitAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return Keyword_constinit; case 1: return GNU_require_constant_initialization; case 2: return CXX11_clang_require_constant_initialization; } } ConstInitAttr *ConstInitAttr::clone(ASTContext &C) const { auto *A = new (C) ConstInitAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ConstInitAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "constinit"; OS << ""; break; } case 1 : { OS << "__attribute__((require_constant_initialization"; OS << "))"; break; } case 2 : { OS << "[[clang::require_constant_initialization"; OS << "]]"; break; } } } const char *ConstInitAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "constinit"; case 1: return "require_constant_initialization"; case 2: return "require_constant_initialization"; } } // ConstructorAttr implementation ConstructorAttr *ConstructorAttr::CreateImplicit(ASTContext &Ctx, int Priority, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ConstructorAttr(Ctx, CommonInfo, Priority); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ConstructorAttr *ConstructorAttr::Create(ASTContext &Ctx, int Priority, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ConstructorAttr(Ctx, CommonInfo, Priority); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ConstructorAttr *ConstructorAttr::CreateImplicit(ASTContext &Ctx, int Priority, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_constructor: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_constructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_constructor: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_constructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_constructor: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_constructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Priority, I); } ConstructorAttr *ConstructorAttr::Create(ASTContext &Ctx, int Priority, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_constructor: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_constructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_constructor: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_constructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_constructor: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_constructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Priority, I); } ConstructorAttr::ConstructorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , int Priority ) : InheritableAttr(Ctx, CommonInfo, attr::Constructor, /*IsLateParsed=*/false, false) , priority(Priority) { } ConstructorAttr::ConstructorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Constructor, /*IsLateParsed=*/false, false) , priority() { } ConstructorAttr *ConstructorAttr::clone(ASTContext &C) const { auto *A = new (C) ConstructorAttr(C, *this, priority); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ConstructorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((constructor"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getPriority() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::constructor"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getPriority() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::constructor"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getPriority() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ConstructorAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "constructor"; case 1: return "constructor"; case 2: return "constructor"; } } // ConsumableAttr implementation ConsumableAttr *ConsumableAttr::CreateImplicit(ASTContext &Ctx, ConsumableAttr::ConsumedState DefaultState, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ConsumableAttr(Ctx, CommonInfo, DefaultState); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ConsumableAttr *ConsumableAttr::Create(ASTContext &Ctx, ConsumableAttr::ConsumedState DefaultState, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ConsumableAttr(Ctx, CommonInfo, DefaultState); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ConsumableAttr *ConsumableAttr::CreateImplicit(ASTContext &Ctx, ConsumableAttr::ConsumedState DefaultState, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_consumable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_consumable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_consumable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_consumable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, DefaultState, I); } ConsumableAttr *ConsumableAttr::Create(ASTContext &Ctx, ConsumableAttr::ConsumedState DefaultState, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_consumable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_consumable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_consumable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_consumable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, DefaultState, I); } ConsumableAttr::ConsumableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , ConsumableAttr::ConsumedState DefaultState ) : InheritableAttr(Ctx, CommonInfo, attr::Consumable, /*IsLateParsed=*/false, false) , defaultState(DefaultState) { } bool ConsumableAttr::ConvertStrToConsumedState(StringRef Val, ConsumableAttr::ConsumedState &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("unknown", ConsumableAttr::ConsumedState::Unknown) .Case("consumed", ConsumableAttr::ConsumedState::Consumed) .Case("unconsumed", ConsumableAttr::ConsumedState::Unconsumed) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *ConsumableAttr::ConvertConsumedStateToStr(ConsumableAttr::ConsumedState Val) { switch(Val) { case ConsumableAttr::ConsumedState::Unknown: return "unknown"; case ConsumableAttr::ConsumedState::Consumed: return "consumed"; case ConsumableAttr::ConsumedState::Unconsumed: return "unconsumed"; } llvm_unreachable("No enumerator with that value"); } ConsumableAttr *ConsumableAttr::clone(ASTContext &C) const { auto *A = new (C) ConsumableAttr(C, *this, defaultState); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ConsumableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((consumable"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << ConsumableAttr::ConvertConsumedStateToStr(getDefaultState()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::consumable"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << ConsumableAttr::ConvertConsumedStateToStr(getDefaultState()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ConsumableAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "consumable"; case 1: return "consumable"; } } // ConsumableAutoCastAttr implementation ConsumableAutoCastAttr *ConsumableAutoCastAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ConsumableAutoCastAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ConsumableAutoCastAttr *ConsumableAutoCastAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ConsumableAutoCastAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ConsumableAutoCastAttr *ConsumableAutoCastAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_consumable_auto_cast_state: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_consumable_auto_cast_state, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_consumable_auto_cast_state: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_consumable_auto_cast_state, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ConsumableAutoCastAttr *ConsumableAutoCastAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_consumable_auto_cast_state: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_consumable_auto_cast_state, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_consumable_auto_cast_state: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_consumable_auto_cast_state, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ConsumableAutoCastAttr::ConsumableAutoCastAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ConsumableAutoCast, /*IsLateParsed=*/false, false) { } ConsumableAutoCastAttr *ConsumableAutoCastAttr::clone(ASTContext &C) const { auto *A = new (C) ConsumableAutoCastAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ConsumableAutoCastAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((consumable_auto_cast_state"; OS << "))"; break; } case 1 : { OS << "[[clang::consumable_auto_cast_state"; OS << "]]"; break; } } } const char *ConsumableAutoCastAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "consumable_auto_cast_state"; case 1: return "consumable_auto_cast_state"; } } // ConsumableSetOnReadAttr implementation ConsumableSetOnReadAttr *ConsumableSetOnReadAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ConsumableSetOnReadAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ConsumableSetOnReadAttr *ConsumableSetOnReadAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ConsumableSetOnReadAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ConsumableSetOnReadAttr *ConsumableSetOnReadAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_consumable_set_state_on_read: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_consumable_set_state_on_read, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_consumable_set_state_on_read: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_consumable_set_state_on_read, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ConsumableSetOnReadAttr *ConsumableSetOnReadAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_consumable_set_state_on_read: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_consumable_set_state_on_read, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_consumable_set_state_on_read: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_consumable_set_state_on_read, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ConsumableSetOnReadAttr::ConsumableSetOnReadAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ConsumableSetOnRead, /*IsLateParsed=*/false, false) { } ConsumableSetOnReadAttr *ConsumableSetOnReadAttr::clone(ASTContext &C) const { auto *A = new (C) ConsumableSetOnReadAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ConsumableSetOnReadAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((consumable_set_state_on_read"; OS << "))"; break; } case 1 : { OS << "[[clang::consumable_set_state_on_read"; OS << "]]"; break; } } } const char *ConsumableSetOnReadAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "consumable_set_state_on_read"; case 1: return "consumable_set_state_on_read"; } } // ConvergentAttr implementation ConvergentAttr *ConvergentAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ConvergentAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ConvergentAttr *ConvergentAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ConvergentAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ConvergentAttr *ConvergentAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_convergent: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_convergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_convergent: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_convergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_convergent: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_convergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ConvergentAttr *ConvergentAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_convergent: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_convergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_convergent: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_convergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_convergent: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_convergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ConvergentAttr::ConvergentAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Convergent, /*IsLateParsed=*/false, false) { } ConvergentAttr *ConvergentAttr::clone(ASTContext &C) const { auto *A = new (C) ConvergentAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ConvergentAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((convergent"; OS << "))"; break; } case 1 : { OS << "[[clang::convergent"; OS << "]]"; break; } case 2 : { OS << "[[clang::convergent"; OS << "]]"; break; } } } const char *ConvergentAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "convergent"; case 1: return "convergent"; case 2: return "convergent"; } } // CoroDisableLifetimeBoundAttr implementation CoroDisableLifetimeBoundAttr *CoroDisableLifetimeBoundAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CoroDisableLifetimeBoundAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CoroDisableLifetimeBoundAttr *CoroDisableLifetimeBoundAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CoroDisableLifetimeBoundAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CoroDisableLifetimeBoundAttr *CoroDisableLifetimeBoundAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_coro_disable_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_disable_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_coro_disable_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_disable_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_coro_disable_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_disable_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CoroDisableLifetimeBoundAttr *CoroDisableLifetimeBoundAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_coro_disable_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_disable_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_coro_disable_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_disable_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_coro_disable_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_disable_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CoroDisableLifetimeBoundAttr::CoroDisableLifetimeBoundAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CoroDisableLifetimeBound, /*IsLateParsed=*/false, false) { } CoroDisableLifetimeBoundAttr *CoroDisableLifetimeBoundAttr::clone(ASTContext &C) const { auto *A = new (C) CoroDisableLifetimeBoundAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CoroDisableLifetimeBoundAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((coro_disable_lifetimebound"; OS << "))"; break; } case 1 : { OS << "[[clang::coro_disable_lifetimebound"; OS << "]]"; break; } case 2 : { OS << "[[clang::coro_disable_lifetimebound"; OS << "]]"; break; } } } const char *CoroDisableLifetimeBoundAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "coro_disable_lifetimebound"; case 1: return "coro_disable_lifetimebound"; case 2: return "coro_disable_lifetimebound"; } } // CoroLifetimeBoundAttr implementation CoroLifetimeBoundAttr *CoroLifetimeBoundAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CoroLifetimeBoundAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CoroLifetimeBoundAttr *CoroLifetimeBoundAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CoroLifetimeBoundAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CoroLifetimeBoundAttr *CoroLifetimeBoundAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_coro_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_coro_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_coro_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CoroLifetimeBoundAttr *CoroLifetimeBoundAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_coro_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_coro_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_coro_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CoroLifetimeBoundAttr::CoroLifetimeBoundAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CoroLifetimeBound, /*IsLateParsed=*/false, false) { } CoroLifetimeBoundAttr *CoroLifetimeBoundAttr::clone(ASTContext &C) const { auto *A = new (C) CoroLifetimeBoundAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CoroLifetimeBoundAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((coro_lifetimebound"; OS << "))"; break; } case 1 : { OS << "[[clang::coro_lifetimebound"; OS << "]]"; break; } case 2 : { OS << "[[clang::coro_lifetimebound"; OS << "]]"; break; } } } const char *CoroLifetimeBoundAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "coro_lifetimebound"; case 1: return "coro_lifetimebound"; case 2: return "coro_lifetimebound"; } } // CoroOnlyDestroyWhenCompleteAttr implementation CoroOnlyDestroyWhenCompleteAttr *CoroOnlyDestroyWhenCompleteAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CoroOnlyDestroyWhenCompleteAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CoroOnlyDestroyWhenCompleteAttr *CoroOnlyDestroyWhenCompleteAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CoroOnlyDestroyWhenCompleteAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CoroOnlyDestroyWhenCompleteAttr *CoroOnlyDestroyWhenCompleteAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_coro_only_destroy_when_complete: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_only_destroy_when_complete, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_coro_only_destroy_when_complete: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_only_destroy_when_complete, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_coro_only_destroy_when_complete: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_only_destroy_when_complete, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CoroOnlyDestroyWhenCompleteAttr *CoroOnlyDestroyWhenCompleteAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_coro_only_destroy_when_complete: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_only_destroy_when_complete, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_coro_only_destroy_when_complete: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_only_destroy_when_complete, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_coro_only_destroy_when_complete: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_only_destroy_when_complete, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CoroOnlyDestroyWhenCompleteAttr::CoroOnlyDestroyWhenCompleteAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CoroOnlyDestroyWhenComplete, /*IsLateParsed=*/false, false) { } CoroOnlyDestroyWhenCompleteAttr *CoroOnlyDestroyWhenCompleteAttr::clone(ASTContext &C) const { auto *A = new (C) CoroOnlyDestroyWhenCompleteAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CoroOnlyDestroyWhenCompleteAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((coro_only_destroy_when_complete"; OS << "))"; break; } case 1 : { OS << "[[clang::coro_only_destroy_when_complete"; OS << "]]"; break; } case 2 : { OS << "[[clang::coro_only_destroy_when_complete"; OS << "]]"; break; } } } const char *CoroOnlyDestroyWhenCompleteAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "coro_only_destroy_when_complete"; case 1: return "coro_only_destroy_when_complete"; case 2: return "coro_only_destroy_when_complete"; } } // CoroReturnTypeAttr implementation CoroReturnTypeAttr *CoroReturnTypeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CoroReturnTypeAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CoroReturnTypeAttr *CoroReturnTypeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CoroReturnTypeAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CoroReturnTypeAttr *CoroReturnTypeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_coro_return_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_return_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_coro_return_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_return_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_coro_return_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_return_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CoroReturnTypeAttr *CoroReturnTypeAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_coro_return_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_return_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_coro_return_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_return_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_coro_return_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_return_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CoroReturnTypeAttr::CoroReturnTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CoroReturnType, /*IsLateParsed=*/false, false) { } CoroReturnTypeAttr *CoroReturnTypeAttr::clone(ASTContext &C) const { auto *A = new (C) CoroReturnTypeAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CoroReturnTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((coro_return_type"; OS << "))"; break; } case 1 : { OS << "[[clang::coro_return_type"; OS << "]]"; break; } case 2 : { OS << "[[clang::coro_return_type"; OS << "]]"; break; } } } const char *CoroReturnTypeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "coro_return_type"; case 1: return "coro_return_type"; case 2: return "coro_return_type"; } } // CoroWrapperAttr implementation CoroWrapperAttr *CoroWrapperAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CoroWrapperAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CoroWrapperAttr *CoroWrapperAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CoroWrapperAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CoroWrapperAttr *CoroWrapperAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_coro_wrapper: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_coro_wrapper: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_coro_wrapper: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } CoroWrapperAttr *CoroWrapperAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_coro_wrapper: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_coro_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_coro_wrapper: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_coro_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_coro_wrapper: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_coro_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } CoroWrapperAttr::CoroWrapperAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::CoroWrapper, /*IsLateParsed=*/false, false) { } CoroWrapperAttr *CoroWrapperAttr::clone(ASTContext &C) const { auto *A = new (C) CoroWrapperAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CoroWrapperAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((coro_wrapper"; OS << "))"; break; } case 1 : { OS << "[[clang::coro_wrapper"; OS << "]]"; break; } case 2 : { OS << "[[clang::coro_wrapper"; OS << "]]"; break; } } } const char *CoroWrapperAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "coro_wrapper"; case 1: return "coro_wrapper"; case 2: return "coro_wrapper"; } } // CountedByAttr implementation CountedByAttr *CountedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Count, int NestedLevel, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CountedByAttr(Ctx, CommonInfo, Count, NestedLevel); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CountedByAttr *CountedByAttr::Create(ASTContext &Ctx, Expr * Count, int NestedLevel, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CountedByAttr(Ctx, CommonInfo, Count, NestedLevel); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CountedByAttr *CountedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Count, int NestedLevel, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_counted_by: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_counted_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_counted_by: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_counted_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_counted_by: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_counted_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Count, NestedLevel, I); } CountedByAttr *CountedByAttr::Create(ASTContext &Ctx, Expr * Count, int NestedLevel, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_counted_by: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_counted_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_counted_by: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_counted_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_counted_by: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_counted_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Count, NestedLevel, I); } CountedByAttr::CountedByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Count , int NestedLevel ) : InheritableAttr(Ctx, CommonInfo, attr::CountedBy, /*IsLateParsed=*/true, false) , count(Count) , nestedLevel(NestedLevel) { } CountedByAttr::CountedByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Count ) : InheritableAttr(Ctx, CommonInfo, attr::CountedBy, /*IsLateParsed=*/true, false) , count(Count) , nestedLevel() { } CountedByAttr *CountedByAttr::clone(ASTContext &C) const { auto *A = new (C) CountedByAttr(C, *this, count, nestedLevel); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CountedByAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((counted_by"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getCount()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNestedLevel() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::counted_by"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getCount()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNestedLevel() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::counted_by"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getCount()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNestedLevel() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *CountedByAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "counted_by"; case 1: return "counted_by"; case 2: return "counted_by"; } } // CountedByOrNullAttr implementation CountedByOrNullAttr *CountedByOrNullAttr::CreateImplicit(ASTContext &Ctx, Expr * Count, int NestedLevel, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CountedByOrNullAttr(Ctx, CommonInfo, Count, NestedLevel); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CountedByOrNullAttr *CountedByOrNullAttr::Create(ASTContext &Ctx, Expr * Count, int NestedLevel, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) CountedByOrNullAttr(Ctx, CommonInfo, Count, NestedLevel); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } CountedByOrNullAttr *CountedByOrNullAttr::CreateImplicit(ASTContext &Ctx, Expr * Count, int NestedLevel, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_counted_by_or_null: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_counted_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_counted_by_or_null: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_counted_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_counted_by_or_null: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_counted_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Count, NestedLevel, I); } CountedByOrNullAttr *CountedByOrNullAttr::Create(ASTContext &Ctx, Expr * Count, int NestedLevel, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_counted_by_or_null: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_counted_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_counted_by_or_null: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_counted_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_counted_by_or_null: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_counted_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Count, NestedLevel, I); } CountedByOrNullAttr::CountedByOrNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Count , int NestedLevel ) : InheritableAttr(Ctx, CommonInfo, attr::CountedByOrNull, /*IsLateParsed=*/true, false) , count(Count) , nestedLevel(NestedLevel) { } CountedByOrNullAttr::CountedByOrNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Count ) : InheritableAttr(Ctx, CommonInfo, attr::CountedByOrNull, /*IsLateParsed=*/true, false) , count(Count) , nestedLevel() { } CountedByOrNullAttr *CountedByOrNullAttr::clone(ASTContext &C) const { auto *A = new (C) CountedByOrNullAttr(C, *this, count, nestedLevel); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void CountedByOrNullAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((counted_by_or_null"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getCount()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNestedLevel() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::counted_by_or_null"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getCount()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNestedLevel() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::counted_by_or_null"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getCount()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNestedLevel() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *CountedByOrNullAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "counted_by_or_null"; case 1: return "counted_by_or_null"; case 2: return "counted_by_or_null"; } } // DLLExportAttr implementation DLLExportAttr *DLLExportAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DLLExportAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DLLExportAttr *DLLExportAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DLLExportAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DLLExportAttr *DLLExportAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_dllexport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_dllexport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_dllexport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_dllexport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } DLLExportAttr *DLLExportAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_dllexport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_dllexport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_dllexport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_dllexport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_dllexport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } DLLExportAttr::DLLExportAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::DLLExport, /*IsLateParsed=*/false, false) { } DLLExportAttr *DLLExportAttr::clone(ASTContext &C) const { auto *A = new (C) DLLExportAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void DLLExportAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__declspec(dllexport"; OS << ")"; break; } case 1 : { OS << "__attribute__((dllexport"; OS << "))"; break; } case 2 : { OS << "[[gnu::dllexport"; OS << "]]"; break; } case 3 : { OS << "[[gnu::dllexport"; OS << "]]"; break; } } } const char *DLLExportAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "dllexport"; case 1: return "dllexport"; case 2: return "dllexport"; case 3: return "dllexport"; } } // DLLExportStaticLocalAttr implementation DLLExportStaticLocalAttr *DLLExportStaticLocalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DLLExportStaticLocalAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DLLExportStaticLocalAttr *DLLExportStaticLocalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DLLExportStaticLocalAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DLLExportStaticLocalAttr *DLLExportStaticLocalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, I); } DLLExportStaticLocalAttr *DLLExportStaticLocalAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, I); } DLLExportStaticLocalAttr::DLLExportStaticLocalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::DLLExportStaticLocal, /*IsLateParsed=*/false, false) { } DLLExportStaticLocalAttr *DLLExportStaticLocalAttr::clone(ASTContext &C) const { auto *A = new (C) DLLExportStaticLocalAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void DLLExportStaticLocalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *DLLExportStaticLocalAttr::getSpelling() const { return "(No spelling)"; } // DLLImportAttr implementation DLLImportAttr *DLLImportAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DLLImportAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DLLImportAttr *DLLImportAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DLLImportAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DLLImportAttr *DLLImportAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_dllimport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_dllimport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_dllimport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_dllimport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } DLLImportAttr *DLLImportAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_dllimport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_dllimport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_dllimport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_dllimport: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_dllimport, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } DLLImportAttr::DLLImportAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::DLLImport, /*IsLateParsed=*/false, false) { } DLLImportAttr *DLLImportAttr::clone(ASTContext &C) const { auto *A = new (C) DLLImportAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void DLLImportAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__declspec(dllimport"; OS << ")"; break; } case 1 : { OS << "__attribute__((dllimport"; OS << "))"; break; } case 2 : { OS << "[[gnu::dllimport"; OS << "]]"; break; } case 3 : { OS << "[[gnu::dllimport"; OS << "]]"; break; } } } const char *DLLImportAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "dllimport"; case 1: return "dllimport"; case 2: return "dllimport"; case 3: return "dllimport"; } } // DLLImportStaticLocalAttr implementation DLLImportStaticLocalAttr *DLLImportStaticLocalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DLLImportStaticLocalAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DLLImportStaticLocalAttr *DLLImportStaticLocalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DLLImportStaticLocalAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DLLImportStaticLocalAttr *DLLImportStaticLocalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, I); } DLLImportStaticLocalAttr *DLLImportStaticLocalAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, I); } DLLImportStaticLocalAttr::DLLImportStaticLocalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::DLLImportStaticLocal, /*IsLateParsed=*/false, false) { } DLLImportStaticLocalAttr *DLLImportStaticLocalAttr::clone(ASTContext &C) const { auto *A = new (C) DLLImportStaticLocalAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void DLLImportStaticLocalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *DLLImportStaticLocalAttr::getSpelling() const { return "(No spelling)"; } // DeprecatedAttr implementation DeprecatedAttr *DeprecatedAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, llvm::StringRef Replacement, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DeprecatedAttr(Ctx, CommonInfo, Message, Replacement); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DeprecatedAttr *DeprecatedAttr::Create(ASTContext &Ctx, llvm::StringRef Message, llvm::StringRef Replacement, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DeprecatedAttr(Ctx, CommonInfo, Message, Replacement); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DeprecatedAttr *DeprecatedAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, llvm::StringRef Replacement, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_deprecated: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_deprecated: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_deprecated: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_deprecated: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_deprecated: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_deprecated: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Message, Replacement, I); } DeprecatedAttr *DeprecatedAttr::Create(ASTContext &Ctx, llvm::StringRef Message, llvm::StringRef Replacement, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_deprecated: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_deprecated: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_deprecated: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_deprecated: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_deprecated: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_deprecated: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_deprecated, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Message, Replacement, I); } DeprecatedAttr::DeprecatedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Message , llvm::StringRef Replacement ) : InheritableAttr(Ctx, CommonInfo, attr::Deprecated, /*IsLateParsed=*/false, false) , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) , replacementLength(Replacement.size()),replacement(new (Ctx, 1) char[replacementLength]) { if (!Message.empty()) std::memcpy(message, Message.data(), messageLength); if (!Replacement.empty()) std::memcpy(replacement, Replacement.data(), replacementLength); } DeprecatedAttr::DeprecatedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Deprecated, /*IsLateParsed=*/false, false) , messageLength(0),message(nullptr) , replacementLength(0),replacement(nullptr) { } DeprecatedAttr *DeprecatedAttr::clone(ASTContext &C) const { auto *A = new (C) DeprecatedAttr(C, *this, getMessage(), getReplacement()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void DeprecatedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((deprecated"; OS << "(\"" << getMessage() << "\""; if (!getReplacement().empty()) OS << ", \"" << getReplacement() << "\""; OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::deprecated"; OS << "(\"" << getMessage() << "\""; OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::deprecated"; OS << "(\"" << getMessage() << "\""; OS << ")"; OS << "]]"; break; } case 3 : { OS << "__declspec(deprecated"; OS << "(\"" << getMessage() << "\""; OS << ")"; OS << ")"; break; } case 4 : { OS << "[[deprecated"; OS << "(\"" << getMessage() << "\""; OS << ")"; OS << "]]"; break; } case 5 : { OS << "[[deprecated"; OS << "(\"" << getMessage() << "\""; OS << ")"; OS << "]]"; break; } } } const char *DeprecatedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "deprecated"; case 1: return "deprecated"; case 2: return "deprecated"; case 3: return "deprecated"; case 4: return "deprecated"; case 5: return "deprecated"; } } // DestructorAttr implementation DestructorAttr *DestructorAttr::CreateImplicit(ASTContext &Ctx, int Priority, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DestructorAttr(Ctx, CommonInfo, Priority); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DestructorAttr *DestructorAttr::Create(ASTContext &Ctx, int Priority, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DestructorAttr(Ctx, CommonInfo, Priority); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DestructorAttr *DestructorAttr::CreateImplicit(ASTContext &Ctx, int Priority, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_destructor: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_destructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_destructor: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_destructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_destructor: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_destructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Priority, I); } DestructorAttr *DestructorAttr::Create(ASTContext &Ctx, int Priority, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_destructor: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_destructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_destructor: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_destructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_destructor: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_destructor, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Priority, I); } DestructorAttr::DestructorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , int Priority ) : InheritableAttr(Ctx, CommonInfo, attr::Destructor, /*IsLateParsed=*/false, false) , priority(Priority) { } DestructorAttr::DestructorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Destructor, /*IsLateParsed=*/false, false) , priority() { } DestructorAttr *DestructorAttr::clone(ASTContext &C) const { auto *A = new (C) DestructorAttr(C, *this, priority); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void DestructorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((destructor"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getPriority() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::destructor"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getPriority() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::destructor"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getPriority() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *DestructorAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "destructor"; case 1: return "destructor"; case 2: return "destructor"; } } // DiagnoseAsBuiltinAttr implementation DiagnoseAsBuiltinAttr *DiagnoseAsBuiltinAttr::CreateImplicit(ASTContext &Ctx, FunctionDecl * Function, unsigned *ArgIndices, unsigned ArgIndicesSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DiagnoseAsBuiltinAttr(Ctx, CommonInfo, Function, ArgIndices, ArgIndicesSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DiagnoseAsBuiltinAttr *DiagnoseAsBuiltinAttr::Create(ASTContext &Ctx, FunctionDecl * Function, unsigned *ArgIndices, unsigned ArgIndicesSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DiagnoseAsBuiltinAttr(Ctx, CommonInfo, Function, ArgIndices, ArgIndicesSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DiagnoseAsBuiltinAttr *DiagnoseAsBuiltinAttr::CreateImplicit(ASTContext &Ctx, FunctionDecl * Function, unsigned *ArgIndices, unsigned ArgIndicesSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_diagnose_as_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_diagnose_as_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_diagnose_as_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_diagnose_as_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_diagnose_as_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_diagnose_as_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Function, ArgIndices, ArgIndicesSize, I); } DiagnoseAsBuiltinAttr *DiagnoseAsBuiltinAttr::Create(ASTContext &Ctx, FunctionDecl * Function, unsigned *ArgIndices, unsigned ArgIndicesSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_diagnose_as_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_diagnose_as_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_diagnose_as_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_diagnose_as_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_diagnose_as_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_diagnose_as_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Function, ArgIndices, ArgIndicesSize, I); } DiagnoseAsBuiltinAttr::DiagnoseAsBuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , FunctionDecl * Function , unsigned *ArgIndices, unsigned ArgIndicesSize ) : InheritableAttr(Ctx, CommonInfo, attr::DiagnoseAsBuiltin, /*IsLateParsed=*/false, false) , function(Function) , argIndices_Size(ArgIndicesSize), argIndices_(new (Ctx, 16) unsigned[argIndices_Size]) { std::copy(ArgIndices, ArgIndices + argIndices_Size, argIndices_); } DiagnoseAsBuiltinAttr::DiagnoseAsBuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , FunctionDecl * Function ) : InheritableAttr(Ctx, CommonInfo, attr::DiagnoseAsBuiltin, /*IsLateParsed=*/false, false) , function(Function) , argIndices_Size(0), argIndices_(nullptr) { } DiagnoseAsBuiltinAttr *DiagnoseAsBuiltinAttr::clone(ASTContext &C) const { auto *A = new (C) DiagnoseAsBuiltinAttr(C, *this, function, argIndices_, argIndices_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void DiagnoseAsBuiltinAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((diagnose_as_builtin"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getFunction()->getNameInfo().getAsString() << ""; OS << ""; for (const auto &Val : argIndices()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::diagnose_as_builtin"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getFunction()->getNameInfo().getAsString() << ""; OS << ""; for (const auto &Val : argIndices()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::diagnose_as_builtin"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getFunction()->getNameInfo().getAsString() << ""; OS << ""; for (const auto &Val : argIndices()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *DiagnoseAsBuiltinAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "diagnose_as_builtin"; case 1: return "diagnose_as_builtin"; case 2: return "diagnose_as_builtin"; } } // DiagnoseIfAttr implementation DiagnoseIfAttr *DiagnoseIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DiagnosticType DiagnosticType, bool ArgDependent, NamedDecl * Parent, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DiagnoseIfAttr(Ctx, CommonInfo, Cond, Message, DiagnosticType, ArgDependent, Parent); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DiagnoseIfAttr *DiagnoseIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DiagnosticType DiagnosticType, bool ArgDependent, NamedDecl * Parent, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DiagnoseIfAttr(Ctx, CommonInfo, Cond, Message, DiagnosticType, ArgDependent, Parent); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DiagnoseIfAttr *DiagnoseIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DiagnosticType DiagnosticType, bool ArgDependent, NamedDecl * Parent, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Cond, Message, DiagnosticType, ArgDependent, Parent, I); } DiagnoseIfAttr *DiagnoseIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DiagnosticType DiagnosticType, bool ArgDependent, NamedDecl * Parent, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Cond, Message, DiagnosticType, ArgDependent, Parent, I); } DiagnoseIfAttr *DiagnoseIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DiagnosticType DiagnosticType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DiagnoseIfAttr(Ctx, CommonInfo, Cond, Message, DiagnosticType); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DiagnoseIfAttr *DiagnoseIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DiagnosticType DiagnosticType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DiagnoseIfAttr(Ctx, CommonInfo, Cond, Message, DiagnosticType); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DiagnoseIfAttr *DiagnoseIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DiagnosticType DiagnosticType, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Cond, Message, DiagnosticType, I); } DiagnoseIfAttr *DiagnoseIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, DiagnoseIfAttr::DiagnosticType DiagnosticType, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Cond, Message, DiagnosticType, I); } DiagnoseIfAttr::DiagnoseIfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Cond , llvm::StringRef Message , DiagnoseIfAttr::DiagnosticType DiagnosticType , bool ArgDependent , NamedDecl * Parent ) : InheritableAttr(Ctx, CommonInfo, attr::DiagnoseIf, /*IsLateParsed=*/true, true) , cond(Cond) , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) , diagnosticType(DiagnosticType) , argDependent(ArgDependent) , parent(Parent) { if (!Message.empty()) std::memcpy(message, Message.data(), messageLength); } DiagnoseIfAttr::DiagnoseIfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Cond , llvm::StringRef Message , DiagnoseIfAttr::DiagnosticType DiagnosticType ) : InheritableAttr(Ctx, CommonInfo, attr::DiagnoseIf, /*IsLateParsed=*/true, true) , cond(Cond) , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) , diagnosticType(DiagnosticType) , argDependent() , parent() { if (!Message.empty()) std::memcpy(message, Message.data(), messageLength); } bool DiagnoseIfAttr::ConvertStrToDiagnosticType(StringRef Val, DiagnoseIfAttr::DiagnosticType &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("error", DiagnoseIfAttr::DiagnosticType::DT_Error) .Case("warning", DiagnoseIfAttr::DiagnosticType::DT_Warning) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *DiagnoseIfAttr::ConvertDiagnosticTypeToStr(DiagnoseIfAttr::DiagnosticType Val) { switch(Val) { case DiagnoseIfAttr::DiagnosticType::DT_Error: return "error"; case DiagnoseIfAttr::DiagnosticType::DT_Warning: return "warning"; } llvm_unreachable("No enumerator with that value"); } DiagnoseIfAttr *DiagnoseIfAttr::clone(ASTContext &C) const { auto *A = new (C) DiagnoseIfAttr(C, *this, cond, getMessage(), diagnosticType, argDependent, parent); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void DiagnoseIfAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((diagnose_if"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getCond()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMessage() << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << DiagnoseIfAttr::ConvertDiagnosticTypeToStr(getDiagnosticType()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *DiagnoseIfAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "diagnose_if"; } } // DisableSanitizerInstrumentationAttr implementation DisableSanitizerInstrumentationAttr *DisableSanitizerInstrumentationAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DisableSanitizerInstrumentationAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DisableSanitizerInstrumentationAttr *DisableSanitizerInstrumentationAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DisableSanitizerInstrumentationAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DisableSanitizerInstrumentationAttr *DisableSanitizerInstrumentationAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_disable_sanitizer_instrumentation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_disable_sanitizer_instrumentation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_disable_sanitizer_instrumentation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_disable_sanitizer_instrumentation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_disable_sanitizer_instrumentation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_disable_sanitizer_instrumentation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } DisableSanitizerInstrumentationAttr *DisableSanitizerInstrumentationAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_disable_sanitizer_instrumentation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_disable_sanitizer_instrumentation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_disable_sanitizer_instrumentation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_disable_sanitizer_instrumentation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_disable_sanitizer_instrumentation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_disable_sanitizer_instrumentation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } DisableSanitizerInstrumentationAttr::DisableSanitizerInstrumentationAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::DisableSanitizerInstrumentation, /*IsLateParsed=*/false, false) { } DisableSanitizerInstrumentationAttr *DisableSanitizerInstrumentationAttr::clone(ASTContext &C) const { auto *A = new (C) DisableSanitizerInstrumentationAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void DisableSanitizerInstrumentationAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((disable_sanitizer_instrumentation"; OS << "))"; break; } case 1 : { OS << "[[clang::disable_sanitizer_instrumentation"; OS << "]]"; break; } case 2 : { OS << "[[clang::disable_sanitizer_instrumentation"; OS << "]]"; break; } } } const char *DisableSanitizerInstrumentationAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "disable_sanitizer_instrumentation"; case 1: return "disable_sanitizer_instrumentation"; case 2: return "disable_sanitizer_instrumentation"; } } // DisableTailCallsAttr implementation DisableTailCallsAttr *DisableTailCallsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DisableTailCallsAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DisableTailCallsAttr *DisableTailCallsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) DisableTailCallsAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } DisableTailCallsAttr *DisableTailCallsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_disable_tail_calls: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_disable_tail_calls, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_disable_tail_calls: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_disable_tail_calls, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_disable_tail_calls: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_disable_tail_calls, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } DisableTailCallsAttr *DisableTailCallsAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_disable_tail_calls: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_disable_tail_calls, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_disable_tail_calls: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_disable_tail_calls, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_disable_tail_calls: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_disable_tail_calls, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } DisableTailCallsAttr::DisableTailCallsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::DisableTailCalls, /*IsLateParsed=*/false, false) { } DisableTailCallsAttr *DisableTailCallsAttr::clone(ASTContext &C) const { auto *A = new (C) DisableTailCallsAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void DisableTailCallsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((disable_tail_calls"; OS << "))"; break; } case 1 : { OS << "[[clang::disable_tail_calls"; OS << "]]"; break; } case 2 : { OS << "[[clang::disable_tail_calls"; OS << "]]"; break; } } } const char *DisableTailCallsAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "disable_tail_calls"; case 1: return "disable_tail_calls"; case 2: return "disable_tail_calls"; } } // EmptyBasesAttr implementation EmptyBasesAttr *EmptyBasesAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) EmptyBasesAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } EmptyBasesAttr *EmptyBasesAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) EmptyBasesAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } EmptyBasesAttr *EmptyBasesAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } EmptyBasesAttr *EmptyBasesAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } EmptyBasesAttr::EmptyBasesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::EmptyBases, /*IsLateParsed=*/false, false) { } EmptyBasesAttr *EmptyBasesAttr::clone(ASTContext &C) const { auto *A = new (C) EmptyBasesAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void EmptyBasesAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__declspec(empty_bases"; OS << ")"; break; } } } const char *EmptyBasesAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "empty_bases"; } } // EnableIfAttr implementation EnableIfAttr *EnableIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) EnableIfAttr(Ctx, CommonInfo, Cond, Message); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } EnableIfAttr *EnableIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) EnableIfAttr(Ctx, CommonInfo, Cond, Message); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } EnableIfAttr *EnableIfAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Cond, Message, I); } EnableIfAttr *EnableIfAttr::Create(ASTContext &Ctx, Expr * Cond, llvm::StringRef Message, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Cond, Message, I); } EnableIfAttr::EnableIfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Cond , llvm::StringRef Message ) : InheritableAttr(Ctx, CommonInfo, attr::EnableIf, /*IsLateParsed=*/false, false) , cond(Cond) , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) { if (!Message.empty()) std::memcpy(message, Message.data(), messageLength); } EnableIfAttr *EnableIfAttr::clone(ASTContext &C) const { auto *A = new (C) EnableIfAttr(C, *this, cond, getMessage()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void EnableIfAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((enable_if"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getCond()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMessage() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *EnableIfAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "enable_if"; } } // EnforceTCBAttr implementation EnforceTCBAttr *EnforceTCBAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef TCBName, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) EnforceTCBAttr(Ctx, CommonInfo, TCBName); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } EnforceTCBAttr *EnforceTCBAttr::Create(ASTContext &Ctx, llvm::StringRef TCBName, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) EnforceTCBAttr(Ctx, CommonInfo, TCBName); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } EnforceTCBAttr *EnforceTCBAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef TCBName, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_enforce_tcb: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enforce_tcb, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_enforce_tcb: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enforce_tcb, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_enforce_tcb: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enforce_tcb, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, TCBName, I); } EnforceTCBAttr *EnforceTCBAttr::Create(ASTContext &Ctx, llvm::StringRef TCBName, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_enforce_tcb: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enforce_tcb, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_enforce_tcb: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enforce_tcb, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_enforce_tcb: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enforce_tcb, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, TCBName, I); } EnforceTCBAttr::EnforceTCBAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef TCBName ) : InheritableAttr(Ctx, CommonInfo, attr::EnforceTCB, /*IsLateParsed=*/false, true) , tCBNameLength(TCBName.size()),tCBName(new (Ctx, 1) char[tCBNameLength]) { if (!TCBName.empty()) std::memcpy(tCBName, TCBName.data(), tCBNameLength); } EnforceTCBAttr *EnforceTCBAttr::clone(ASTContext &C) const { auto *A = new (C) EnforceTCBAttr(C, *this, getTCBName()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void EnforceTCBAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((enforce_tcb"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getTCBName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::enforce_tcb"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getTCBName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::enforce_tcb"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getTCBName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *EnforceTCBAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "enforce_tcb"; case 1: return "enforce_tcb"; case 2: return "enforce_tcb"; } } // EnforceTCBLeafAttr implementation EnforceTCBLeafAttr *EnforceTCBLeafAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef TCBName, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) EnforceTCBLeafAttr(Ctx, CommonInfo, TCBName); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } EnforceTCBLeafAttr *EnforceTCBLeafAttr::Create(ASTContext &Ctx, llvm::StringRef TCBName, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) EnforceTCBLeafAttr(Ctx, CommonInfo, TCBName); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } EnforceTCBLeafAttr *EnforceTCBLeafAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef TCBName, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_enforce_tcb_leaf: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enforce_tcb_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_enforce_tcb_leaf: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enforce_tcb_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_enforce_tcb_leaf: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enforce_tcb_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, TCBName, I); } EnforceTCBLeafAttr *EnforceTCBLeafAttr::Create(ASTContext &Ctx, llvm::StringRef TCBName, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_enforce_tcb_leaf: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enforce_tcb_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_enforce_tcb_leaf: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enforce_tcb_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_enforce_tcb_leaf: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enforce_tcb_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, TCBName, I); } EnforceTCBLeafAttr::EnforceTCBLeafAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef TCBName ) : InheritableAttr(Ctx, CommonInfo, attr::EnforceTCBLeaf, /*IsLateParsed=*/false, true) , tCBNameLength(TCBName.size()),tCBName(new (Ctx, 1) char[tCBNameLength]) { if (!TCBName.empty()) std::memcpy(tCBName, TCBName.data(), tCBNameLength); } EnforceTCBLeafAttr *EnforceTCBLeafAttr::clone(ASTContext &C) const { auto *A = new (C) EnforceTCBLeafAttr(C, *this, getTCBName()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void EnforceTCBLeafAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((enforce_tcb_leaf"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getTCBName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::enforce_tcb_leaf"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getTCBName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::enforce_tcb_leaf"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getTCBName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *EnforceTCBLeafAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "enforce_tcb_leaf"; case 1: return "enforce_tcb_leaf"; case 2: return "enforce_tcb_leaf"; } } // EnumExtensibilityAttr implementation EnumExtensibilityAttr *EnumExtensibilityAttr::CreateImplicit(ASTContext &Ctx, EnumExtensibilityAttr::Kind Extensibility, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) EnumExtensibilityAttr(Ctx, CommonInfo, Extensibility); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } EnumExtensibilityAttr *EnumExtensibilityAttr::Create(ASTContext &Ctx, EnumExtensibilityAttr::Kind Extensibility, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) EnumExtensibilityAttr(Ctx, CommonInfo, Extensibility); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } EnumExtensibilityAttr *EnumExtensibilityAttr::CreateImplicit(ASTContext &Ctx, EnumExtensibilityAttr::Kind Extensibility, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_enum_extensibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enum_extensibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_enum_extensibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enum_extensibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_enum_extensibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enum_extensibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Extensibility, I); } EnumExtensibilityAttr *EnumExtensibilityAttr::Create(ASTContext &Ctx, EnumExtensibilityAttr::Kind Extensibility, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_enum_extensibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enum_extensibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_enum_extensibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enum_extensibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_enum_extensibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enum_extensibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Extensibility, I); } EnumExtensibilityAttr::EnumExtensibilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , EnumExtensibilityAttr::Kind Extensibility ) : InheritableAttr(Ctx, CommonInfo, attr::EnumExtensibility, /*IsLateParsed=*/false, false) , extensibility(Extensibility) { } bool EnumExtensibilityAttr::ConvertStrToKind(StringRef Val, EnumExtensibilityAttr::Kind &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("closed", EnumExtensibilityAttr::Kind::Closed) .Case("open", EnumExtensibilityAttr::Kind::Open) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *EnumExtensibilityAttr::ConvertKindToStr(EnumExtensibilityAttr::Kind Val) { switch(Val) { case EnumExtensibilityAttr::Kind::Closed: return "closed"; case EnumExtensibilityAttr::Kind::Open: return "open"; } llvm_unreachable("No enumerator with that value"); } EnumExtensibilityAttr *EnumExtensibilityAttr::clone(ASTContext &C) const { auto *A = new (C) EnumExtensibilityAttr(C, *this, extensibility); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void EnumExtensibilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((enum_extensibility"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << EnumExtensibilityAttr::ConvertKindToStr(getExtensibility()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::enum_extensibility"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << EnumExtensibilityAttr::ConvertKindToStr(getExtensibility()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::enum_extensibility"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << EnumExtensibilityAttr::ConvertKindToStr(getExtensibility()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *EnumExtensibilityAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "enum_extensibility"; case 1: return "enum_extensibility"; case 2: return "enum_extensibility"; } } // ErrorAttr implementation ErrorAttr *ErrorAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef UserDiagnostic, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ErrorAttr(Ctx, CommonInfo, UserDiagnostic); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ErrorAttr *ErrorAttr::Create(ASTContext &Ctx, llvm::StringRef UserDiagnostic, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ErrorAttr(Ctx, CommonInfo, UserDiagnostic); return A; } ErrorAttr *ErrorAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef UserDiagnostic, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_error: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_error: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_error: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_warning: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_warning, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_warning: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_warning, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_warning: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_warning, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, UserDiagnostic, I); } ErrorAttr *ErrorAttr::Create(ASTContext &Ctx, llvm::StringRef UserDiagnostic, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_error: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_error: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_error: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_warning: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_warning, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_warning: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_warning, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_warning: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_warning, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, UserDiagnostic, I); } ErrorAttr::ErrorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef UserDiagnostic ) : InheritableAttr(Ctx, CommonInfo, attr::Error, /*IsLateParsed=*/false, false) , userDiagnosticLength(UserDiagnostic.size()),userDiagnostic(new (Ctx, 1) char[userDiagnosticLength]) { if (!UserDiagnostic.empty()) std::memcpy(userDiagnostic, UserDiagnostic.data(), userDiagnosticLength); } ErrorAttr::Spelling ErrorAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_error; case 1: return CXX11_gnu_error; case 2: return C23_gnu_error; case 3: return GNU_warning; case 4: return CXX11_gnu_warning; case 5: return C23_gnu_warning; } } ErrorAttr *ErrorAttr::clone(ASTContext &C) const { auto *A = new (C) ErrorAttr(C, *this, getUserDiagnostic()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ErrorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((error"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getUserDiagnostic() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::error"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getUserDiagnostic() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::error"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getUserDiagnostic() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 3 : { OS << "__attribute__((warning"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getUserDiagnostic() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 4 : { OS << "[[gnu::warning"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getUserDiagnostic() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 5 : { OS << "[[gnu::warning"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getUserDiagnostic() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ErrorAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "error"; case 1: return "error"; case 2: return "error"; case 3: return "warning"; case 4: return "warning"; case 5: return "warning"; } } // ExcludeFromExplicitInstantiationAttr implementation ExcludeFromExplicitInstantiationAttr *ExcludeFromExplicitInstantiationAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ExcludeFromExplicitInstantiationAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ExcludeFromExplicitInstantiationAttr *ExcludeFromExplicitInstantiationAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ExcludeFromExplicitInstantiationAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ExcludeFromExplicitInstantiationAttr *ExcludeFromExplicitInstantiationAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_exclude_from_explicit_instantiation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_exclude_from_explicit_instantiation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_exclude_from_explicit_instantiation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_exclude_from_explicit_instantiation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_exclude_from_explicit_instantiation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_exclude_from_explicit_instantiation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ExcludeFromExplicitInstantiationAttr *ExcludeFromExplicitInstantiationAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_exclude_from_explicit_instantiation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_exclude_from_explicit_instantiation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_exclude_from_explicit_instantiation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_exclude_from_explicit_instantiation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_exclude_from_explicit_instantiation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_exclude_from_explicit_instantiation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ExcludeFromExplicitInstantiationAttr::ExcludeFromExplicitInstantiationAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ExcludeFromExplicitInstantiation, /*IsLateParsed=*/false, false) { } ExcludeFromExplicitInstantiationAttr *ExcludeFromExplicitInstantiationAttr::clone(ASTContext &C) const { auto *A = new (C) ExcludeFromExplicitInstantiationAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ExcludeFromExplicitInstantiationAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((exclude_from_explicit_instantiation"; OS << "))"; break; } case 1 : { OS << "[[clang::exclude_from_explicit_instantiation"; OS << "]]"; break; } case 2 : { OS << "[[clang::exclude_from_explicit_instantiation"; OS << "]]"; break; } } } const char *ExcludeFromExplicitInstantiationAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "exclude_from_explicit_instantiation"; case 1: return "exclude_from_explicit_instantiation"; case 2: return "exclude_from_explicit_instantiation"; } } // ExclusiveTrylockFunctionAttr implementation ExclusiveTrylockFunctionAttr *ExclusiveTrylockFunctionAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ExclusiveTrylockFunctionAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ExclusiveTrylockFunctionAttr *ExclusiveTrylockFunctionAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ExclusiveTrylockFunctionAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ExclusiveTrylockFunctionAttr *ExclusiveTrylockFunctionAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, SuccessValue, Args, ArgsSize, I); } ExclusiveTrylockFunctionAttr *ExclusiveTrylockFunctionAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, SuccessValue, Args, ArgsSize, I); } ExclusiveTrylockFunctionAttr::ExclusiveTrylockFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * SuccessValue , Expr * *Args, unsigned ArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::ExclusiveTrylockFunction, /*IsLateParsed=*/true, true) , successValue(SuccessValue) , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) { std::copy(Args, Args + args_Size, args_); } ExclusiveTrylockFunctionAttr::ExclusiveTrylockFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * SuccessValue ) : InheritableAttr(Ctx, CommonInfo, attr::ExclusiveTrylockFunction, /*IsLateParsed=*/true, true) , successValue(SuccessValue) , args_Size(0), args_(nullptr) { } ExclusiveTrylockFunctionAttr *ExclusiveTrylockFunctionAttr::clone(ASTContext &C) const { auto *A = new (C) ExclusiveTrylockFunctionAttr(C, *this, successValue, args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ExclusiveTrylockFunctionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((exclusive_trylock_function"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getSuccessValue()->printPretty(OS, nullptr, Policy); OS << ""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *ExclusiveTrylockFunctionAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "exclusive_trylock_function"; } } // ExternalSourceSymbolAttr implementation ExternalSourceSymbolAttr *ExternalSourceSymbolAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Language, llvm::StringRef DefinedIn, bool GeneratedDeclaration, llvm::StringRef USR, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ExternalSourceSymbolAttr(Ctx, CommonInfo, Language, DefinedIn, GeneratedDeclaration, USR); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ExternalSourceSymbolAttr *ExternalSourceSymbolAttr::Create(ASTContext &Ctx, llvm::StringRef Language, llvm::StringRef DefinedIn, bool GeneratedDeclaration, llvm::StringRef USR, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ExternalSourceSymbolAttr(Ctx, CommonInfo, Language, DefinedIn, GeneratedDeclaration, USR); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ExternalSourceSymbolAttr *ExternalSourceSymbolAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Language, llvm::StringRef DefinedIn, bool GeneratedDeclaration, llvm::StringRef USR, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_external_source_symbol: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_external_source_symbol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_external_source_symbol: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_external_source_symbol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_external_source_symbol: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_external_source_symbol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Language, DefinedIn, GeneratedDeclaration, USR, I); } ExternalSourceSymbolAttr *ExternalSourceSymbolAttr::Create(ASTContext &Ctx, llvm::StringRef Language, llvm::StringRef DefinedIn, bool GeneratedDeclaration, llvm::StringRef USR, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_external_source_symbol: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_external_source_symbol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_external_source_symbol: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_external_source_symbol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_external_source_symbol: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_external_source_symbol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Language, DefinedIn, GeneratedDeclaration, USR, I); } ExternalSourceSymbolAttr::ExternalSourceSymbolAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Language , llvm::StringRef DefinedIn , bool GeneratedDeclaration , llvm::StringRef USR ) : InheritableAttr(Ctx, CommonInfo, attr::ExternalSourceSymbol, /*IsLateParsed=*/false, false) , languageLength(Language.size()),language(new (Ctx, 1) char[languageLength]) , definedInLength(DefinedIn.size()),definedIn(new (Ctx, 1) char[definedInLength]) , generatedDeclaration(GeneratedDeclaration) , uSRLength(USR.size()),uSR(new (Ctx, 1) char[uSRLength]) { if (!Language.empty()) std::memcpy(language, Language.data(), languageLength); if (!DefinedIn.empty()) std::memcpy(definedIn, DefinedIn.data(), definedInLength); if (!USR.empty()) std::memcpy(uSR, USR.data(), uSRLength); } ExternalSourceSymbolAttr::ExternalSourceSymbolAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ExternalSourceSymbol, /*IsLateParsed=*/false, false) , languageLength(0),language(nullptr) , definedInLength(0),definedIn(nullptr) , generatedDeclaration() , uSRLength(0),uSR(nullptr) { } ExternalSourceSymbolAttr *ExternalSourceSymbolAttr::clone(ASTContext &C) const { auto *A = new (C) ExternalSourceSymbolAttr(C, *this, getLanguage(), getDefinedIn(), generatedDeclaration, getUSR()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ExternalSourceSymbolAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((external_source_symbol"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getLanguage() << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getDefinedIn() << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getGeneratedDeclaration() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getUSR() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::external_source_symbol"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getLanguage() << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getDefinedIn() << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getGeneratedDeclaration() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getUSR() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::external_source_symbol"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getLanguage() << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getDefinedIn() << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getGeneratedDeclaration() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getUSR() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ExternalSourceSymbolAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "external_source_symbol"; case 1: return "external_source_symbol"; case 2: return "external_source_symbol"; } } // FallThroughAttr implementation FallThroughAttr *FallThroughAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FallThroughAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } FallThroughAttr *FallThroughAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FallThroughAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } FallThroughAttr *FallThroughAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_fallthrough: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_fallthrough: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_fallthrough: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_fallthrough: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_fallthrough: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_fallthrough: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } FallThroughAttr *FallThroughAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_fallthrough: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_fallthrough: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_fallthrough: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_fallthrough: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_fallthrough: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_fallthrough: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_fallthrough, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } FallThroughAttr::FallThroughAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : StmtAttr(Ctx, CommonInfo, attr::FallThrough, /*IsLateParsed=*/false) { } FallThroughAttr *FallThroughAttr::clone(ASTContext &C) const { auto *A = new (C) FallThroughAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void FallThroughAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[fallthrough"; OS << "]]"; break; } case 1 : { OS << "[[fallthrough"; OS << "]]"; break; } case 2 : { OS << "[[clang::fallthrough"; OS << "]]"; break; } case 3 : { OS << "__attribute__((fallthrough"; OS << "))"; break; } case 4 : { OS << "[[gnu::fallthrough"; OS << "]]"; break; } case 5 : { OS << "[[gnu::fallthrough"; OS << "]]"; break; } } } const char *FallThroughAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "fallthrough"; case 1: return "fallthrough"; case 2: return "fallthrough"; case 3: return "fallthrough"; case 4: return "fallthrough"; case 5: return "fallthrough"; } } // FastCallAttr implementation FastCallAttr *FastCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FastCallAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } FastCallAttr *FastCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FastCallAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } FastCallAttr *FastCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_fastcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_fastcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_fastcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_fastcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } FastCallAttr *FastCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_fastcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_fastcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_fastcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_fastcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_fastcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } FastCallAttr::FastCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::FastCall, /*IsLateParsed=*/false, false) { } FastCallAttr *FastCallAttr::clone(ASTContext &C) const { auto *A = new (C) FastCallAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void FastCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((fastcall"; OS << "))"; break; } case 1 : { OS << "[[gnu::fastcall"; OS << "]]"; break; } case 2 : { OS << "[[gnu::fastcall"; OS << "]]"; break; } case 3 : { OS << "__fastcall"; OS << ""; break; } case 4 : { OS << "_fastcall"; OS << ""; break; } } } const char *FastCallAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "fastcall"; case 1: return "fastcall"; case 2: return "fastcall"; case 3: return "__fastcall"; case 4: return "_fastcall"; } } // FinalAttr implementation FinalAttr *FinalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FinalAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } FinalAttr *FinalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FinalAttr(Ctx, CommonInfo); return A; } FinalAttr *FinalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_final: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_final, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_sealed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_sealed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } FinalAttr *FinalAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_final: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_final, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_sealed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_sealed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } FinalAttr::FinalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Final, /*IsLateParsed=*/false, false) { } FinalAttr::Spelling FinalAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return Keyword_final; case 1: return Keyword_sealed; } } FinalAttr *FinalAttr::clone(ASTContext &C) const { auto *A = new (C) FinalAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void FinalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "final"; OS << ""; break; } case 1 : { OS << "sealed"; OS << ""; break; } } } const char *FinalAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "final"; case 1: return "sealed"; } } // FlagEnumAttr implementation FlagEnumAttr *FlagEnumAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FlagEnumAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } FlagEnumAttr *FlagEnumAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FlagEnumAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } FlagEnumAttr *FlagEnumAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_flag_enum: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_flag_enum, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_flag_enum: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_flag_enum, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_flag_enum: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_flag_enum, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } FlagEnumAttr *FlagEnumAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_flag_enum: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_flag_enum, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_flag_enum: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_flag_enum, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_flag_enum: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_flag_enum, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } FlagEnumAttr::FlagEnumAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::FlagEnum, /*IsLateParsed=*/false, false) { } FlagEnumAttr *FlagEnumAttr::clone(ASTContext &C) const { auto *A = new (C) FlagEnumAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void FlagEnumAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((flag_enum"; OS << "))"; break; } case 1 : { OS << "[[clang::flag_enum"; OS << "]]"; break; } case 2 : { OS << "[[clang::flag_enum"; OS << "]]"; break; } } } const char *FlagEnumAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "flag_enum"; case 1: return "flag_enum"; case 2: return "flag_enum"; } } // FlattenAttr implementation FlattenAttr *FlattenAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FlattenAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } FlattenAttr *FlattenAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FlattenAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } FlattenAttr *FlattenAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_flatten: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_flatten, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_flatten: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_flatten, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_flatten: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_flatten, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } FlattenAttr *FlattenAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_flatten: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_flatten, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_flatten: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_flatten, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_flatten: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_flatten, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } FlattenAttr::FlattenAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Flatten, /*IsLateParsed=*/false, false) { } FlattenAttr *FlattenAttr::clone(ASTContext &C) const { auto *A = new (C) FlattenAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void FlattenAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((flatten"; OS << "))"; break; } case 1 : { OS << "[[gnu::flatten"; OS << "]]"; break; } case 2 : { OS << "[[gnu::flatten"; OS << "]]"; break; } } } const char *FlattenAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "flatten"; case 1: return "flatten"; case 2: return "flatten"; } } // FormatAttr implementation FormatAttr *FormatAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Type, int FormatIdx, int FirstArg, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FormatAttr(Ctx, CommonInfo, Type, FormatIdx, FirstArg); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } FormatAttr *FormatAttr::Create(ASTContext &Ctx, IdentifierInfo * Type, int FormatIdx, int FirstArg, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FormatAttr(Ctx, CommonInfo, Type, FormatIdx, FirstArg); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } FormatAttr *FormatAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Type, int FormatIdx, int FirstArg, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_format: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_format, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_format: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_format, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_format: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_format, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Type, FormatIdx, FirstArg, I); } FormatAttr *FormatAttr::Create(ASTContext &Ctx, IdentifierInfo * Type, int FormatIdx, int FirstArg, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_format: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_format, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_format: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_format, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_format: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_format, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Type, FormatIdx, FirstArg, I); } FormatAttr::FormatAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * Type , int FormatIdx , int FirstArg ) : InheritableAttr(Ctx, CommonInfo, attr::Format, /*IsLateParsed=*/false, false) , type(Type) , formatIdx(FormatIdx) , firstArg(FirstArg) { } FormatAttr *FormatAttr::clone(ASTContext &C) const { auto *A = new (C) FormatAttr(C, *this, type, formatIdx, firstArg); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void FormatAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((format"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getType() ? getType()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getFormatIdx() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getFirstArg() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::format"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getType() ? getType()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getFormatIdx() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getFirstArg() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::format"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getType() ? getType()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getFormatIdx() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getFirstArg() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *FormatAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "format"; case 1: return "format"; case 2: return "format"; } } // FormatArgAttr implementation FormatArgAttr *FormatArgAttr::CreateImplicit(ASTContext &Ctx, ParamIdx FormatIdx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FormatArgAttr(Ctx, CommonInfo, FormatIdx); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } FormatArgAttr *FormatArgAttr::Create(ASTContext &Ctx, ParamIdx FormatIdx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FormatArgAttr(Ctx, CommonInfo, FormatIdx); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } FormatArgAttr *FormatArgAttr::CreateImplicit(ASTContext &Ctx, ParamIdx FormatIdx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_format_arg: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_format_arg, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_format_arg: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_format_arg, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_format_arg: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_format_arg, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, FormatIdx, I); } FormatArgAttr *FormatArgAttr::Create(ASTContext &Ctx, ParamIdx FormatIdx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_format_arg: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_format_arg, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_format_arg: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_format_arg, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_format_arg: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_format_arg, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, FormatIdx, I); } FormatArgAttr::FormatArgAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , ParamIdx FormatIdx ) : InheritableAttr(Ctx, CommonInfo, attr::FormatArg, /*IsLateParsed=*/false, false) , formatIdx(FormatIdx) { } FormatArgAttr *FormatArgAttr::clone(ASTContext &C) const { auto *A = new (C) FormatArgAttr(C, *this, formatIdx); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void FormatArgAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((format_arg"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getFormatIdx().getSourceIndex() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::format_arg"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getFormatIdx().getSourceIndex() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::format_arg"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getFormatIdx().getSourceIndex() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *FormatArgAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "format_arg"; case 1: return "format_arg"; case 2: return "format_arg"; } } // FunctionReturnThunksAttr implementation FunctionReturnThunksAttr *FunctionReturnThunksAttr::CreateImplicit(ASTContext &Ctx, FunctionReturnThunksAttr::Kind ThunkType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FunctionReturnThunksAttr(Ctx, CommonInfo, ThunkType); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } FunctionReturnThunksAttr *FunctionReturnThunksAttr::Create(ASTContext &Ctx, FunctionReturnThunksAttr::Kind ThunkType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) FunctionReturnThunksAttr(Ctx, CommonInfo, ThunkType); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } FunctionReturnThunksAttr *FunctionReturnThunksAttr::CreateImplicit(ASTContext &Ctx, FunctionReturnThunksAttr::Kind ThunkType, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_function_return: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_function_return, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_function_return: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_function_return, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_function_return: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_function_return, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, ThunkType, I); } FunctionReturnThunksAttr *FunctionReturnThunksAttr::Create(ASTContext &Ctx, FunctionReturnThunksAttr::Kind ThunkType, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_function_return: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_function_return, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_function_return: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_function_return, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_function_return: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_function_return, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, ThunkType, I); } FunctionReturnThunksAttr::FunctionReturnThunksAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , FunctionReturnThunksAttr::Kind ThunkType ) : InheritableAttr(Ctx, CommonInfo, attr::FunctionReturnThunks, /*IsLateParsed=*/false, false) , thunkType(ThunkType) { } bool FunctionReturnThunksAttr::ConvertStrToKind(StringRef Val, FunctionReturnThunksAttr::Kind &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("keep", FunctionReturnThunksAttr::Kind::Keep) .Case("thunk-extern", FunctionReturnThunksAttr::Kind::Extern) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *FunctionReturnThunksAttr::ConvertKindToStr(FunctionReturnThunksAttr::Kind Val) { switch(Val) { case FunctionReturnThunksAttr::Kind::Keep: return "keep"; case FunctionReturnThunksAttr::Kind::Extern: return "thunk-extern"; } llvm_unreachable("No enumerator with that value"); } FunctionReturnThunksAttr *FunctionReturnThunksAttr::clone(ASTContext &C) const { auto *A = new (C) FunctionReturnThunksAttr(C, *this, thunkType); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void FunctionReturnThunksAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((function_return"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << FunctionReturnThunksAttr::ConvertKindToStr(getThunkType()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::function_return"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << FunctionReturnThunksAttr::ConvertKindToStr(getThunkType()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::function_return"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << FunctionReturnThunksAttr::ConvertKindToStr(getThunkType()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *FunctionReturnThunksAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "function_return"; case 1: return "function_return"; case 2: return "function_return"; } } // GNUInlineAttr implementation GNUInlineAttr *GNUInlineAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) GNUInlineAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } GNUInlineAttr *GNUInlineAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) GNUInlineAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } GNUInlineAttr *GNUInlineAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_gnu_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_gnu_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_gnu_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_gnu_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_gnu_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_gnu_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } GNUInlineAttr *GNUInlineAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_gnu_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_gnu_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_gnu_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_gnu_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_gnu_inline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_gnu_inline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } GNUInlineAttr::GNUInlineAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::GNUInline, /*IsLateParsed=*/false, false) { } GNUInlineAttr *GNUInlineAttr::clone(ASTContext &C) const { auto *A = new (C) GNUInlineAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void GNUInlineAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((gnu_inline"; OS << "))"; break; } case 1 : { OS << "[[gnu::gnu_inline"; OS << "]]"; break; } case 2 : { OS << "[[gnu::gnu_inline"; OS << "]]"; break; } } } const char *GNUInlineAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "gnu_inline"; case 1: return "gnu_inline"; case 2: return "gnu_inline"; } } // GuardedByAttr implementation GuardedByAttr *GuardedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) GuardedByAttr(Ctx, CommonInfo, Arg); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } GuardedByAttr *GuardedByAttr::Create(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) GuardedByAttr(Ctx, CommonInfo, Arg); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } GuardedByAttr *GuardedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Arg, I); } GuardedByAttr *GuardedByAttr::Create(ASTContext &Ctx, Expr * Arg, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Arg, I); } GuardedByAttr::GuardedByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Arg ) : InheritableAttr(Ctx, CommonInfo, attr::GuardedBy, /*IsLateParsed=*/true, true) , arg(Arg) { } GuardedByAttr *GuardedByAttr::clone(ASTContext &C) const { auto *A = new (C) GuardedByAttr(C, *this, arg); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void GuardedByAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((guarded_by"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getArg()->printPretty(OS, nullptr, Policy); OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *GuardedByAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "guarded_by"; } } // GuardedVarAttr implementation GuardedVarAttr *GuardedVarAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) GuardedVarAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } GuardedVarAttr *GuardedVarAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) GuardedVarAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } GuardedVarAttr *GuardedVarAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_guarded_var: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_guarded_var: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } GuardedVarAttr *GuardedVarAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_guarded_var: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_guarded_var: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } GuardedVarAttr::GuardedVarAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::GuardedVar, /*IsLateParsed=*/false, false) { } GuardedVarAttr *GuardedVarAttr::clone(ASTContext &C) const { auto *A = new (C) GuardedVarAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void GuardedVarAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((guarded_var"; OS << "))"; break; } case 1 : { OS << "[[clang::guarded_var"; OS << "]]"; break; } } } const char *GuardedVarAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "guarded_var"; case 1: return "guarded_var"; } } // HIPManagedAttr implementation HIPManagedAttr *HIPManagedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HIPManagedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HIPManagedAttr *HIPManagedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HIPManagedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HIPManagedAttr *HIPManagedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_managed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_managed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_managed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_managed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } HIPManagedAttr *HIPManagedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_managed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_managed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_managed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_managed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } HIPManagedAttr::HIPManagedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::HIPManaged, /*IsLateParsed=*/false, false) { } HIPManagedAttr *HIPManagedAttr::clone(ASTContext &C) const { auto *A = new (C) HIPManagedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void HIPManagedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((managed"; OS << "))"; break; } case 1 : { OS << "__declspec(__managed__"; OS << ")"; break; } } } const char *HIPManagedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "managed"; case 1: return "__managed__"; } } // HLSLGroupSharedAddressSpaceAttr implementation HLSLGroupSharedAddressSpaceAttr *HLSLGroupSharedAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLGroupSharedAddressSpaceAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLGroupSharedAddressSpaceAttr *HLSLGroupSharedAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLGroupSharedAddressSpaceAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLGroupSharedAddressSpaceAttr *HLSLGroupSharedAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } HLSLGroupSharedAddressSpaceAttr *HLSLGroupSharedAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } HLSLGroupSharedAddressSpaceAttr::HLSLGroupSharedAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::HLSLGroupSharedAddressSpace, /*IsLateParsed=*/false) { } HLSLGroupSharedAddressSpaceAttr *HLSLGroupSharedAddressSpaceAttr::clone(ASTContext &C) const { auto *A = new (C) HLSLGroupSharedAddressSpaceAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void HLSLGroupSharedAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "groupshared"; OS << ""; break; } } } const char *HLSLGroupSharedAddressSpaceAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "groupshared"; } } // HLSLLoopHintAttr implementation HLSLLoopHintAttr *HLSLLoopHintAttr::CreateImplicit(ASTContext &Ctx, unsigned Directive, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLLoopHintAttr(Ctx, CommonInfo, Directive); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLLoopHintAttr *HLSLLoopHintAttr::Create(ASTContext &Ctx, unsigned Directive, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLLoopHintAttr(Ctx, CommonInfo, Directive); return A; } HLSLLoopHintAttr *HLSLLoopHintAttr::CreateImplicit(ASTContext &Ctx, unsigned Directive, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Microsoft_unroll: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_unroll, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Microsoft_loop: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_loop, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Directive, I); } HLSLLoopHintAttr *HLSLLoopHintAttr::Create(ASTContext &Ctx, unsigned Directive, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Microsoft_unroll: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_unroll, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Microsoft_loop: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_loop, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Directive, I); } HLSLLoopHintAttr::HLSLLoopHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned Directive ) : StmtAttr(Ctx, CommonInfo, attr::HLSLLoopHint, /*IsLateParsed=*/false) , directive(Directive) { } HLSLLoopHintAttr::HLSLLoopHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : StmtAttr(Ctx, CommonInfo, attr::HLSLLoopHint, /*IsLateParsed=*/false) , directive() { } HLSLLoopHintAttr::Spelling HLSLLoopHintAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return Microsoft_unroll; case 1: return Microsoft_loop; } } HLSLLoopHintAttr *HLSLLoopHintAttr::clone(ASTContext &C) const { auto *A = new (C) HLSLLoopHintAttr(C, *this, directive); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void HLSLLoopHintAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[unroll"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getDirective() << ""; if (!IsFirstArgument) OS << ")"; OS << "]"; break; } case 1 : { OS << "[loop"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getDirective() << ""; if (!IsFirstArgument) OS << ")"; OS << "]"; break; } } } const char *HLSLLoopHintAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "unroll"; case 1: return "loop"; } } // HLSLNumThreadsAttr implementation HLSLNumThreadsAttr *HLSLNumThreadsAttr::CreateImplicit(ASTContext &Ctx, int X, int Y, int Z, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLNumThreadsAttr(Ctx, CommonInfo, X, Y, Z); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLNumThreadsAttr *HLSLNumThreadsAttr::Create(ASTContext &Ctx, int X, int Y, int Z, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLNumThreadsAttr(Ctx, CommonInfo, X, Y, Z); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLNumThreadsAttr *HLSLNumThreadsAttr::CreateImplicit(ASTContext &Ctx, int X, int Y, int Z, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, X, Y, Z, I); } HLSLNumThreadsAttr *HLSLNumThreadsAttr::Create(ASTContext &Ctx, int X, int Y, int Z, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, X, Y, Z, I); } HLSLNumThreadsAttr::HLSLNumThreadsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , int X , int Y , int Z ) : InheritableAttr(Ctx, CommonInfo, attr::HLSLNumThreads, /*IsLateParsed=*/false, false) , x(X) , y(Y) , z(Z) { } HLSLNumThreadsAttr *HLSLNumThreadsAttr::clone(ASTContext &C) const { auto *A = new (C) HLSLNumThreadsAttr(C, *this, x, y, z); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void HLSLNumThreadsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[numthreads"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getX() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getY() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getZ() << ""; if (!IsFirstArgument) OS << ")"; OS << "]"; break; } } } const char *HLSLNumThreadsAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "numthreads"; } } // HLSLPackOffsetAttr implementation HLSLPackOffsetAttr *HLSLPackOffsetAttr::CreateImplicit(ASTContext &Ctx, int Subcomponent, int Component, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLPackOffsetAttr(Ctx, CommonInfo, Subcomponent, Component); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLPackOffsetAttr *HLSLPackOffsetAttr::Create(ASTContext &Ctx, int Subcomponent, int Component, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLPackOffsetAttr(Ctx, CommonInfo, Subcomponent, Component); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLPackOffsetAttr *HLSLPackOffsetAttr::CreateImplicit(ASTContext &Ctx, int Subcomponent, int Component, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Subcomponent, Component, I); } HLSLPackOffsetAttr *HLSLPackOffsetAttr::Create(ASTContext &Ctx, int Subcomponent, int Component, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Subcomponent, Component, I); } HLSLPackOffsetAttr::HLSLPackOffsetAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , int Subcomponent , int Component ) : HLSLAnnotationAttr(Ctx, CommonInfo, attr::HLSLPackOffset, /*IsLateParsed=*/false, false) , subcomponent(Subcomponent) , component(Component) { } HLSLPackOffsetAttr *HLSLPackOffsetAttr::clone(ASTContext &C) const { auto *A = new (C) HLSLPackOffsetAttr(C, *this, subcomponent, component); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void HLSLPackOffsetAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << ":packoffset"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getSubcomponent() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getComponent() << ""; if (!IsFirstArgument) OS << ")"; OS << ""; break; } } } const char *HLSLPackOffsetAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "packoffset"; } } // HLSLParamModifierAttr implementation HLSLParamModifierAttr *HLSLParamModifierAttr::CreateImplicit(ASTContext &Ctx, bool MergedSpelling, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLParamModifierAttr(Ctx, CommonInfo, MergedSpelling); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLParamModifierAttr *HLSLParamModifierAttr::Create(ASTContext &Ctx, bool MergedSpelling, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLParamModifierAttr(Ctx, CommonInfo, MergedSpelling); return A; } HLSLParamModifierAttr *HLSLParamModifierAttr::CreateImplicit(ASTContext &Ctx, bool MergedSpelling, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_in: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_in, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_inout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_inout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_out: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_out, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, MergedSpelling, I); } HLSLParamModifierAttr *HLSLParamModifierAttr::Create(ASTContext &Ctx, bool MergedSpelling, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_in: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_in, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_inout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_inout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_out: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_out, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, MergedSpelling, I); } HLSLParamModifierAttr *HLSLParamModifierAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLParamModifierAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLParamModifierAttr *HLSLParamModifierAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLParamModifierAttr(Ctx, CommonInfo); return A; } HLSLParamModifierAttr *HLSLParamModifierAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_in: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_in, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_inout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_inout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_out: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_out, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } HLSLParamModifierAttr *HLSLParamModifierAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_in: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_in, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_inout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_inout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_out: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_out, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } HLSLParamModifierAttr::HLSLParamModifierAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , bool MergedSpelling ) : TypeAttr(Ctx, CommonInfo, attr::HLSLParamModifier, /*IsLateParsed=*/false) , mergedSpelling(MergedSpelling) { } HLSLParamModifierAttr::HLSLParamModifierAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::HLSLParamModifier, /*IsLateParsed=*/false) , mergedSpelling() { } HLSLParamModifierAttr::Spelling HLSLParamModifierAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return Keyword_in; case 1: return Keyword_inout; case 2: return Keyword_out; } } HLSLParamModifierAttr *HLSLParamModifierAttr::clone(ASTContext &C) const { auto *A = new (C) HLSLParamModifierAttr(C, *this, mergedSpelling); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void HLSLParamModifierAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "in"; OS << ""; break; } case 1 : { OS << "inout"; OS << ""; break; } case 2 : { OS << "out"; OS << ""; break; } } } const char *HLSLParamModifierAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "in"; case 1: return "inout"; case 2: return "out"; } } // HLSLROVAttr implementation HLSLROVAttr *HLSLROVAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLROVAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLROVAttr *HLSLROVAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLROVAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLROVAttr *HLSLROVAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } HLSLROVAttr *HLSLROVAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } HLSLROVAttr::HLSLROVAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::HLSLROV, /*IsLateParsed=*/false, false) { } HLSLROVAttr *HLSLROVAttr::clone(ASTContext &C) const { auto *A = new (C) HLSLROVAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void HLSLROVAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[hlsl::is_rov"; OS << "]]"; break; } } } const char *HLSLROVAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "is_rov"; } } // HLSLResourceAttr implementation HLSLResourceAttr *HLSLResourceAttr::CreateImplicit(ASTContext &Ctx, llvm::hlsl::ResourceKind ResourceKind, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLResourceAttr(Ctx, CommonInfo, ResourceKind); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLResourceAttr *HLSLResourceAttr::Create(ASTContext &Ctx, llvm::hlsl::ResourceKind ResourceKind, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLResourceAttr(Ctx, CommonInfo, ResourceKind); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLResourceAttr *HLSLResourceAttr::CreateImplicit(ASTContext &Ctx, llvm::hlsl::ResourceKind ResourceKind, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, ResourceKind, I); } HLSLResourceAttr *HLSLResourceAttr::Create(ASTContext &Ctx, llvm::hlsl::ResourceKind ResourceKind, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, ResourceKind, I); } HLSLResourceAttr::HLSLResourceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::hlsl::ResourceKind ResourceKind ) : InheritableAttr(Ctx, CommonInfo, attr::HLSLResource, /*IsLateParsed=*/false, false) , resourceKind(ResourceKind) { } bool HLSLResourceAttr::ConvertStrToResourceKind(StringRef Val, llvm::hlsl::ResourceKind &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("Texture1D", llvm::hlsl::ResourceKind::Texture1D) .Case("Texture2D", llvm::hlsl::ResourceKind::Texture2D) .Case("Texture2DMS", llvm::hlsl::ResourceKind::Texture2DMS) .Case("Texture3D", llvm::hlsl::ResourceKind::Texture3D) .Case("TextureCube", llvm::hlsl::ResourceKind::TextureCube) .Case("Texture1DArray", llvm::hlsl::ResourceKind::Texture1DArray) .Case("Texture2DArray", llvm::hlsl::ResourceKind::Texture2DArray) .Case("Texture2DMSArray", llvm::hlsl::ResourceKind::Texture2DMSArray) .Case("TextureCubeArray", llvm::hlsl::ResourceKind::TextureCubeArray) .Case("TypedBuffer", llvm::hlsl::ResourceKind::TypedBuffer) .Case("RawBuffer", llvm::hlsl::ResourceKind::RawBuffer) .Case("StructuredBuffer", llvm::hlsl::ResourceKind::StructuredBuffer) .Case("CBuffer", llvm::hlsl::ResourceKind::CBuffer) .Case("Sampler", llvm::hlsl::ResourceKind::Sampler) .Case("TBuffer", llvm::hlsl::ResourceKind::TBuffer) .Case("RTAccelerationStructure", llvm::hlsl::ResourceKind::RTAccelerationStructure) .Case("FeedbackTexture2D", llvm::hlsl::ResourceKind::FeedbackTexture2D) .Case("FeedbackTexture2DArray", llvm::hlsl::ResourceKind::FeedbackTexture2DArray) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *HLSLResourceAttr::ConvertResourceKindToStr(llvm::hlsl::ResourceKind Val) { switch(Val) { case llvm::hlsl::ResourceKind::Texture1D: return "Texture1D"; case llvm::hlsl::ResourceKind::Texture2D: return "Texture2D"; case llvm::hlsl::ResourceKind::Texture2DMS: return "Texture2DMS"; case llvm::hlsl::ResourceKind::Texture3D: return "Texture3D"; case llvm::hlsl::ResourceKind::TextureCube: return "TextureCube"; case llvm::hlsl::ResourceKind::Texture1DArray: return "Texture1DArray"; case llvm::hlsl::ResourceKind::Texture2DArray: return "Texture2DArray"; case llvm::hlsl::ResourceKind::Texture2DMSArray: return "Texture2DMSArray"; case llvm::hlsl::ResourceKind::TextureCubeArray: return "TextureCubeArray"; case llvm::hlsl::ResourceKind::TypedBuffer: return "TypedBuffer"; case llvm::hlsl::ResourceKind::RawBuffer: return "RawBuffer"; case llvm::hlsl::ResourceKind::StructuredBuffer: return "StructuredBuffer"; case llvm::hlsl::ResourceKind::CBuffer: return "CBuffer"; case llvm::hlsl::ResourceKind::Sampler: return "Sampler"; case llvm::hlsl::ResourceKind::TBuffer: return "TBuffer"; case llvm::hlsl::ResourceKind::RTAccelerationStructure: return "RTAccelerationStructure"; case llvm::hlsl::ResourceKind::FeedbackTexture2D: return "FeedbackTexture2D"; case llvm::hlsl::ResourceKind::FeedbackTexture2DArray: return "FeedbackTexture2DArray"; default: llvm_unreachable("Invalid attribute value"); } llvm_unreachable("No enumerator with that value"); } HLSLResourceAttr *HLSLResourceAttr::clone(ASTContext &C) const { auto *A = new (C) HLSLResourceAttr(C, *this, resourceKind); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void HLSLResourceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *HLSLResourceAttr::getSpelling() const { return "(No spelling)"; } // HLSLResourceBindingAttr implementation HLSLResourceBindingAttr *HLSLResourceBindingAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Slot, llvm::StringRef Space, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLResourceBindingAttr(Ctx, CommonInfo, Slot, Space); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLResourceBindingAttr *HLSLResourceBindingAttr::Create(ASTContext &Ctx, llvm::StringRef Slot, llvm::StringRef Space, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLResourceBindingAttr(Ctx, CommonInfo, Slot, Space); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLResourceBindingAttr *HLSLResourceBindingAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Slot, llvm::StringRef Space, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Slot, Space, I); } HLSLResourceBindingAttr *HLSLResourceBindingAttr::Create(ASTContext &Ctx, llvm::StringRef Slot, llvm::StringRef Space, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Slot, Space, I); } HLSLResourceBindingAttr::HLSLResourceBindingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Slot , llvm::StringRef Space ) : InheritableAttr(Ctx, CommonInfo, attr::HLSLResourceBinding, /*IsLateParsed=*/false, false) , slotLength(Slot.size()),slot(new (Ctx, 1) char[slotLength]) , spaceLength(Space.size()),space(new (Ctx, 1) char[spaceLength]) { if (!Slot.empty()) std::memcpy(slot, Slot.data(), slotLength); if (!Space.empty()) std::memcpy(space, Space.data(), spaceLength); } HLSLResourceBindingAttr::HLSLResourceBindingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Slot ) : InheritableAttr(Ctx, CommonInfo, attr::HLSLResourceBinding, /*IsLateParsed=*/false, false) , slotLength(Slot.size()),slot(new (Ctx, 1) char[slotLength]) , spaceLength(0),space(nullptr) { if (!Slot.empty()) std::memcpy(slot, Slot.data(), slotLength); } HLSLResourceBindingAttr *HLSLResourceBindingAttr::clone(ASTContext &C) const { auto *A = new (C) HLSLResourceBindingAttr(C, *this, getSlot(), getSpace()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void HLSLResourceBindingAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << ":register"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getSlot() << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getSpace() << "\""; if (!IsFirstArgument) OS << ")"; OS << ""; break; } } } const char *HLSLResourceBindingAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "register"; } } // HLSLResourceClassAttr implementation HLSLResourceClassAttr *HLSLResourceClassAttr::CreateImplicit(ASTContext &Ctx, llvm::hlsl::ResourceClass ResourceClass, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLResourceClassAttr(Ctx, CommonInfo, ResourceClass); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLResourceClassAttr *HLSLResourceClassAttr::Create(ASTContext &Ctx, llvm::hlsl::ResourceClass ResourceClass, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLResourceClassAttr(Ctx, CommonInfo, ResourceClass); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLResourceClassAttr *HLSLResourceClassAttr::CreateImplicit(ASTContext &Ctx, llvm::hlsl::ResourceClass ResourceClass, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, ResourceClass, I); } HLSLResourceClassAttr *HLSLResourceClassAttr::Create(ASTContext &Ctx, llvm::hlsl::ResourceClass ResourceClass, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, ResourceClass, I); } HLSLResourceClassAttr::HLSLResourceClassAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::hlsl::ResourceClass ResourceClass ) : InheritableAttr(Ctx, CommonInfo, attr::HLSLResourceClass, /*IsLateParsed=*/false, false) , resourceClass(ResourceClass) { } bool HLSLResourceClassAttr::ConvertStrToResourceClass(StringRef Val, llvm::hlsl::ResourceClass &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("SRV", llvm::hlsl::ResourceClass::SRV) .Case("UAV", llvm::hlsl::ResourceClass::UAV) .Case("CBuffer", llvm::hlsl::ResourceClass::CBuffer) .Case("Sampler", llvm::hlsl::ResourceClass::Sampler) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *HLSLResourceClassAttr::ConvertResourceClassToStr(llvm::hlsl::ResourceClass Val) { switch(Val) { case llvm::hlsl::ResourceClass::SRV: return "SRV"; case llvm::hlsl::ResourceClass::UAV: return "UAV"; case llvm::hlsl::ResourceClass::CBuffer: return "CBuffer"; case llvm::hlsl::ResourceClass::Sampler: return "Sampler"; } llvm_unreachable("No enumerator with that value"); } HLSLResourceClassAttr *HLSLResourceClassAttr::clone(ASTContext &C) const { auto *A = new (C) HLSLResourceClassAttr(C, *this, resourceClass); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void HLSLResourceClassAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[hlsl::resource_class"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << HLSLResourceClassAttr::ConvertResourceClassToStr(getResourceClass()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *HLSLResourceClassAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "resource_class"; } } // HLSLSV_DispatchThreadIDAttr implementation HLSLSV_DispatchThreadIDAttr *HLSLSV_DispatchThreadIDAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLSV_DispatchThreadIDAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLSV_DispatchThreadIDAttr *HLSLSV_DispatchThreadIDAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLSV_DispatchThreadIDAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLSV_DispatchThreadIDAttr *HLSLSV_DispatchThreadIDAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } HLSLSV_DispatchThreadIDAttr *HLSLSV_DispatchThreadIDAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } HLSLSV_DispatchThreadIDAttr::HLSLSV_DispatchThreadIDAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : HLSLAnnotationAttr(Ctx, CommonInfo, attr::HLSLSV_DispatchThreadID, /*IsLateParsed=*/false, false) { } HLSLSV_DispatchThreadIDAttr *HLSLSV_DispatchThreadIDAttr::clone(ASTContext &C) const { auto *A = new (C) HLSLSV_DispatchThreadIDAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void HLSLSV_DispatchThreadIDAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << ":SV_DispatchThreadID"; OS << ""; break; } } } const char *HLSLSV_DispatchThreadIDAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "SV_DispatchThreadID"; } } // HLSLSV_GroupIndexAttr implementation HLSLSV_GroupIndexAttr *HLSLSV_GroupIndexAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLSV_GroupIndexAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLSV_GroupIndexAttr *HLSLSV_GroupIndexAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLSV_GroupIndexAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLSV_GroupIndexAttr *HLSLSV_GroupIndexAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } HLSLSV_GroupIndexAttr *HLSLSV_GroupIndexAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_HLSLAnnotation, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } HLSLSV_GroupIndexAttr::HLSLSV_GroupIndexAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : HLSLAnnotationAttr(Ctx, CommonInfo, attr::HLSLSV_GroupIndex, /*IsLateParsed=*/false, false) { } HLSLSV_GroupIndexAttr *HLSLSV_GroupIndexAttr::clone(ASTContext &C) const { auto *A = new (C) HLSLSV_GroupIndexAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void HLSLSV_GroupIndexAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << ":SV_GroupIndex"; OS << ""; break; } } } const char *HLSLSV_GroupIndexAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "SV_GroupIndex"; } } // HLSLShaderAttr implementation HLSLShaderAttr *HLSLShaderAttr::CreateImplicit(ASTContext &Ctx, llvm::Triple::EnvironmentType Type, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLShaderAttr(Ctx, CommonInfo, Type); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLShaderAttr *HLSLShaderAttr::Create(ASTContext &Ctx, llvm::Triple::EnvironmentType Type, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HLSLShaderAttr(Ctx, CommonInfo, Type); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HLSLShaderAttr *HLSLShaderAttr::CreateImplicit(ASTContext &Ctx, llvm::Triple::EnvironmentType Type, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Type, I); } HLSLShaderAttr *HLSLShaderAttr::Create(ASTContext &Ctx, llvm::Triple::EnvironmentType Type, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Microsoft, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Type, I); } HLSLShaderAttr::HLSLShaderAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::Triple::EnvironmentType Type ) : InheritableAttr(Ctx, CommonInfo, attr::HLSLShader, /*IsLateParsed=*/false, false) , type(Type) { } bool HLSLShaderAttr::ConvertStrToEnvironmentType(StringRef Val, llvm::Triple::EnvironmentType &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("pixel", llvm::Triple::EnvironmentType::Pixel) .Case("vertex", llvm::Triple::EnvironmentType::Vertex) .Case("geometry", llvm::Triple::EnvironmentType::Geometry) .Case("hull", llvm::Triple::EnvironmentType::Hull) .Case("domain", llvm::Triple::EnvironmentType::Domain) .Case("compute", llvm::Triple::EnvironmentType::Compute) .Case("raygeneration", llvm::Triple::EnvironmentType::RayGeneration) .Case("intersection", llvm::Triple::EnvironmentType::Intersection) .Case("anyhit", llvm::Triple::EnvironmentType::AnyHit) .Case("closesthit", llvm::Triple::EnvironmentType::ClosestHit) .Case("miss", llvm::Triple::EnvironmentType::Miss) .Case("callable", llvm::Triple::EnvironmentType::Callable) .Case("mesh", llvm::Triple::EnvironmentType::Mesh) .Case("amplification", llvm::Triple::EnvironmentType::Amplification) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *HLSLShaderAttr::ConvertEnvironmentTypeToStr(llvm::Triple::EnvironmentType Val) { switch(Val) { case llvm::Triple::EnvironmentType::Pixel: return "pixel"; case llvm::Triple::EnvironmentType::Vertex: return "vertex"; case llvm::Triple::EnvironmentType::Geometry: return "geometry"; case llvm::Triple::EnvironmentType::Hull: return "hull"; case llvm::Triple::EnvironmentType::Domain: return "domain"; case llvm::Triple::EnvironmentType::Compute: return "compute"; case llvm::Triple::EnvironmentType::RayGeneration: return "raygeneration"; case llvm::Triple::EnvironmentType::Intersection: return "intersection"; case llvm::Triple::EnvironmentType::AnyHit: return "anyhit"; case llvm::Triple::EnvironmentType::ClosestHit: return "closesthit"; case llvm::Triple::EnvironmentType::Miss: return "miss"; case llvm::Triple::EnvironmentType::Callable: return "callable"; case llvm::Triple::EnvironmentType::Mesh: return "mesh"; case llvm::Triple::EnvironmentType::Amplification: return "amplification"; default: llvm_unreachable("Invalid attribute value"); } llvm_unreachable("No enumerator with that value"); } HLSLShaderAttr *HLSLShaderAttr::clone(ASTContext &C) const { auto *A = new (C) HLSLShaderAttr(C, *this, type); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void HLSLShaderAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[shader"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << HLSLShaderAttr::ConvertEnvironmentTypeToStr(getType()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]"; break; } } } const char *HLSLShaderAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "shader"; } } // HotAttr implementation HotAttr *HotAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HotAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HotAttr *HotAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HotAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HotAttr *HotAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_hot: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_hot, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_hot: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_hot, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_hot: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_hot, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } HotAttr *HotAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_hot: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_hot, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_hot: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_hot, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_hot: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_hot, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } HotAttr::HotAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Hot, /*IsLateParsed=*/false, false) { } HotAttr *HotAttr::clone(ASTContext &C) const { auto *A = new (C) HotAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void HotAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((hot"; OS << "))"; break; } case 1 : { OS << "[[gnu::hot"; OS << "]]"; break; } case 2 : { OS << "[[gnu::hot"; OS << "]]"; break; } } } const char *HotAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "hot"; case 1: return "hot"; case 2: return "hot"; } } // HybridPatchableAttr implementation HybridPatchableAttr *HybridPatchableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HybridPatchableAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HybridPatchableAttr *HybridPatchableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) HybridPatchableAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } HybridPatchableAttr *HybridPatchableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_hybrid_patchable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_hybrid_patchable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_hybrid_patchable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_hybrid_patchable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } HybridPatchableAttr *HybridPatchableAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_hybrid_patchable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_hybrid_patchable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_hybrid_patchable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_hybrid_patchable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_hybrid_patchable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } HybridPatchableAttr::HybridPatchableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::HybridPatchable, /*IsLateParsed=*/false, false) { } HybridPatchableAttr *HybridPatchableAttr::clone(ASTContext &C) const { auto *A = new (C) HybridPatchableAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void HybridPatchableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__declspec(hybrid_patchable"; OS << ")"; break; } case 1 : { OS << "__attribute__((hybrid_patchable"; OS << "))"; break; } case 2 : { OS << "[[clang::hybrid_patchable"; OS << "]]"; break; } case 3 : { OS << "[[clang::hybrid_patchable"; OS << "]]"; break; } } } const char *HybridPatchableAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "hybrid_patchable"; case 1: return "hybrid_patchable"; case 2: return "hybrid_patchable"; case 3: return "hybrid_patchable"; } } // IBActionAttr implementation IBActionAttr *IBActionAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) IBActionAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } IBActionAttr *IBActionAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) IBActionAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } IBActionAttr *IBActionAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ibaction: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ibaction, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ibaction: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ibaction, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ibaction: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ibaction, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } IBActionAttr *IBActionAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ibaction: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ibaction, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ibaction: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ibaction, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ibaction: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ibaction, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } IBActionAttr::IBActionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::IBAction, /*IsLateParsed=*/false, false) { } IBActionAttr *IBActionAttr::clone(ASTContext &C) const { auto *A = new (C) IBActionAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void IBActionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((ibaction"; OS << "))"; break; } case 1 : { OS << "[[clang::ibaction"; OS << "]]"; break; } case 2 : { OS << "[[clang::ibaction"; OS << "]]"; break; } } } const char *IBActionAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "ibaction"; case 1: return "ibaction"; case 2: return "ibaction"; } } // IBOutletAttr implementation IBOutletAttr *IBOutletAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) IBOutletAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } IBOutletAttr *IBOutletAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) IBOutletAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } IBOutletAttr *IBOutletAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_iboutlet: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_iboutlet, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_iboutlet: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_iboutlet, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_iboutlet: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_iboutlet, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } IBOutletAttr *IBOutletAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_iboutlet: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_iboutlet, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_iboutlet: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_iboutlet, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_iboutlet: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_iboutlet, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } IBOutletAttr::IBOutletAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::IBOutlet, /*IsLateParsed=*/false, false) { } IBOutletAttr *IBOutletAttr::clone(ASTContext &C) const { auto *A = new (C) IBOutletAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void IBOutletAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((iboutlet"; OS << "))"; break; } case 1 : { OS << "[[clang::iboutlet"; OS << "]]"; break; } case 2 : { OS << "[[clang::iboutlet"; OS << "]]"; break; } } } const char *IBOutletAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "iboutlet"; case 1: return "iboutlet"; case 2: return "iboutlet"; } } // IBOutletCollectionAttr implementation IBOutletCollectionAttr *IBOutletCollectionAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * Interface, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) IBOutletCollectionAttr(Ctx, CommonInfo, Interface); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } IBOutletCollectionAttr *IBOutletCollectionAttr::Create(ASTContext &Ctx, TypeSourceInfo * Interface, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) IBOutletCollectionAttr(Ctx, CommonInfo, Interface); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } IBOutletCollectionAttr *IBOutletCollectionAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * Interface, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_iboutletcollection: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_iboutletcollection, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_iboutletcollection: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_iboutletcollection, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_iboutletcollection: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_iboutletcollection, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Interface, I); } IBOutletCollectionAttr *IBOutletCollectionAttr::Create(ASTContext &Ctx, TypeSourceInfo * Interface, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_iboutletcollection: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_iboutletcollection, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_iboutletcollection: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_iboutletcollection, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_iboutletcollection: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_iboutletcollection, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Interface, I); } IBOutletCollectionAttr::IBOutletCollectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , TypeSourceInfo * Interface ) : InheritableAttr(Ctx, CommonInfo, attr::IBOutletCollection, /*IsLateParsed=*/false, false) , interface_(Interface) { } IBOutletCollectionAttr::IBOutletCollectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::IBOutletCollection, /*IsLateParsed=*/false, false) , interface_() { } IBOutletCollectionAttr *IBOutletCollectionAttr::clone(ASTContext &C) const { auto *A = new (C) IBOutletCollectionAttr(C, *this, interface_); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void IBOutletCollectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((iboutletcollection"; if (!getInterfaceLoc()) ++TrailingOmittedArgs; if (!(!getInterfaceLoc())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getInterface().getAsString() << ""; } if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::iboutletcollection"; if (!getInterfaceLoc()) ++TrailingOmittedArgs; if (!(!getInterfaceLoc())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getInterface().getAsString() << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::iboutletcollection"; if (!getInterfaceLoc()) ++TrailingOmittedArgs; if (!(!getInterfaceLoc())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getInterface().getAsString() << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *IBOutletCollectionAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "iboutletcollection"; case 1: return "iboutletcollection"; case 2: return "iboutletcollection"; } } // IFuncAttr implementation IFuncAttr *IFuncAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Resolver, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) IFuncAttr(Ctx, CommonInfo, Resolver); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } IFuncAttr *IFuncAttr::Create(ASTContext &Ctx, llvm::StringRef Resolver, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) IFuncAttr(Ctx, CommonInfo, Resolver); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } IFuncAttr *IFuncAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Resolver, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ifunc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ifunc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_ifunc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_ifunc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_ifunc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_ifunc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Resolver, I); } IFuncAttr *IFuncAttr::Create(ASTContext &Ctx, llvm::StringRef Resolver, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ifunc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ifunc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_ifunc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_ifunc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_ifunc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_ifunc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Resolver, I); } IFuncAttr::IFuncAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Resolver ) : Attr(Ctx, CommonInfo, attr::IFunc, /*IsLateParsed=*/false) , resolverLength(Resolver.size()),resolver(new (Ctx, 1) char[resolverLength]) { if (!Resolver.empty()) std::memcpy(resolver, Resolver.data(), resolverLength); } IFuncAttr *IFuncAttr::clone(ASTContext &C) const { auto *A = new (C) IFuncAttr(C, *this, getResolver()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void IFuncAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((ifunc"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getResolver() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::ifunc"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getResolver() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::ifunc"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getResolver() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *IFuncAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "ifunc"; case 1: return "ifunc"; case 2: return "ifunc"; } } // InitPriorityAttr implementation InitPriorityAttr *InitPriorityAttr::CreateImplicit(ASTContext &Ctx, unsigned Priority, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) InitPriorityAttr(Ctx, CommonInfo, Priority); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } InitPriorityAttr *InitPriorityAttr::Create(ASTContext &Ctx, unsigned Priority, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) InitPriorityAttr(Ctx, CommonInfo, Priority); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } InitPriorityAttr *InitPriorityAttr::CreateImplicit(ASTContext &Ctx, unsigned Priority, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_init_priority: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_init_priority, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_init_priority: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_init_priority, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Priority, I); } InitPriorityAttr *InitPriorityAttr::Create(ASTContext &Ctx, unsigned Priority, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_init_priority: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_init_priority, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_init_priority: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_init_priority, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Priority, I); } InitPriorityAttr::InitPriorityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned Priority ) : InheritableAttr(Ctx, CommonInfo, attr::InitPriority, /*IsLateParsed=*/false, false) , priority(Priority) { } InitPriorityAttr *InitPriorityAttr::clone(ASTContext &C) const { auto *A = new (C) InitPriorityAttr(C, *this, priority); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void InitPriorityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((init_priority"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getPriority() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::init_priority"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getPriority() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *InitPriorityAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "init_priority"; case 1: return "init_priority"; } } // InitSegAttr implementation InitSegAttr *InitSegAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Section, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) InitSegAttr(Ctx, CommonInfo, Section); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } InitSegAttr *InitSegAttr::Create(ASTContext &Ctx, llvm::StringRef Section, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) InitSegAttr(Ctx, CommonInfo, Section); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } InitSegAttr *InitSegAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Section, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Section, I); } InitSegAttr *InitSegAttr::Create(ASTContext &Ctx, llvm::StringRef Section, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Section, I); } InitSegAttr::InitSegAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Section ) : Attr(Ctx, CommonInfo, attr::InitSeg, /*IsLateParsed=*/false) , sectionLength(Section.size()),section(new (Ctx, 1) char[sectionLength]) { if (!Section.empty()) std::memcpy(section, Section.data(), sectionLength); } InitSegAttr *InitSegAttr::clone(ASTContext &C) const { auto *A = new (C) InitSegAttr(C, *this, getSection()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void InitSegAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "#pragma init_seg"; printPrettyPragma(OS, Policy); OS << "\n"; break; } } } const char *InitSegAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "init_seg"; } } // IntelOclBiccAttr implementation IntelOclBiccAttr *IntelOclBiccAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) IntelOclBiccAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } IntelOclBiccAttr *IntelOclBiccAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) IntelOclBiccAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } IntelOclBiccAttr *IntelOclBiccAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_intel_ocl_bicc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_intel_ocl_bicc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_intel_ocl_bicc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_intel_ocl_bicc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } IntelOclBiccAttr *IntelOclBiccAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_intel_ocl_bicc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_intel_ocl_bicc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_intel_ocl_bicc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_intel_ocl_bicc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } IntelOclBiccAttr::IntelOclBiccAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::IntelOclBicc, /*IsLateParsed=*/false, false) { } IntelOclBiccAttr *IntelOclBiccAttr::clone(ASTContext &C) const { auto *A = new (C) IntelOclBiccAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void IntelOclBiccAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((intel_ocl_bicc"; OS << "))"; break; } case 1 : { OS << "[[clang::intel_ocl_bicc"; OS << "]]"; break; } } } const char *IntelOclBiccAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "intel_ocl_bicc"; case 1: return "intel_ocl_bicc"; } } // InternalLinkageAttr implementation InternalLinkageAttr *InternalLinkageAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) InternalLinkageAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } InternalLinkageAttr *InternalLinkageAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) InternalLinkageAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } InternalLinkageAttr *InternalLinkageAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_internal_linkage: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_internal_linkage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_internal_linkage: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_internal_linkage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_internal_linkage: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_internal_linkage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } InternalLinkageAttr *InternalLinkageAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_internal_linkage: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_internal_linkage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_internal_linkage: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_internal_linkage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_internal_linkage: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_internal_linkage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } InternalLinkageAttr::InternalLinkageAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::InternalLinkage, /*IsLateParsed=*/false, false) { } InternalLinkageAttr *InternalLinkageAttr::clone(ASTContext &C) const { auto *A = new (C) InternalLinkageAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void InternalLinkageAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((internal_linkage"; OS << "))"; break; } case 1 : { OS << "[[clang::internal_linkage"; OS << "]]"; break; } case 2 : { OS << "[[clang::internal_linkage"; OS << "]]"; break; } } } const char *InternalLinkageAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "internal_linkage"; case 1: return "internal_linkage"; case 2: return "internal_linkage"; } } // LTOVisibilityPublicAttr implementation LTOVisibilityPublicAttr *LTOVisibilityPublicAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LTOVisibilityPublicAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LTOVisibilityPublicAttr *LTOVisibilityPublicAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LTOVisibilityPublicAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LTOVisibilityPublicAttr *LTOVisibilityPublicAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_lto_visibility_public: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_lto_visibility_public, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_lto_visibility_public: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_lto_visibility_public, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_lto_visibility_public: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_lto_visibility_public, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } LTOVisibilityPublicAttr *LTOVisibilityPublicAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_lto_visibility_public: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_lto_visibility_public, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_lto_visibility_public: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_lto_visibility_public, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_lto_visibility_public: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_lto_visibility_public, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } LTOVisibilityPublicAttr::LTOVisibilityPublicAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::LTOVisibilityPublic, /*IsLateParsed=*/false, false) { } LTOVisibilityPublicAttr *LTOVisibilityPublicAttr::clone(ASTContext &C) const { auto *A = new (C) LTOVisibilityPublicAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void LTOVisibilityPublicAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((lto_visibility_public"; OS << "))"; break; } case 1 : { OS << "[[clang::lto_visibility_public"; OS << "]]"; break; } case 2 : { OS << "[[clang::lto_visibility_public"; OS << "]]"; break; } } } const char *LTOVisibilityPublicAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "lto_visibility_public"; case 1: return "lto_visibility_public"; case 2: return "lto_visibility_public"; } } // LayoutVersionAttr implementation LayoutVersionAttr *LayoutVersionAttr::CreateImplicit(ASTContext &Ctx, unsigned Version, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LayoutVersionAttr(Ctx, CommonInfo, Version); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LayoutVersionAttr *LayoutVersionAttr::Create(ASTContext &Ctx, unsigned Version, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LayoutVersionAttr(Ctx, CommonInfo, Version); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LayoutVersionAttr *LayoutVersionAttr::CreateImplicit(ASTContext &Ctx, unsigned Version, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Version, I); } LayoutVersionAttr *LayoutVersionAttr::Create(ASTContext &Ctx, unsigned Version, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Version, I); } LayoutVersionAttr::LayoutVersionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned Version ) : InheritableAttr(Ctx, CommonInfo, attr::LayoutVersion, /*IsLateParsed=*/false, false) , version(Version) { } LayoutVersionAttr *LayoutVersionAttr::clone(ASTContext &C) const { auto *A = new (C) LayoutVersionAttr(C, *this, version); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void LayoutVersionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__declspec(layout_version"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getVersion() << ""; if (!IsFirstArgument) OS << ")"; OS << ")"; break; } } } const char *LayoutVersionAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "layout_version"; } } // LeafAttr implementation LeafAttr *LeafAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LeafAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LeafAttr *LeafAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LeafAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LeafAttr *LeafAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_leaf: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_leaf: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_leaf: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } LeafAttr *LeafAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_leaf: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_leaf: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_leaf: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_leaf, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } LeafAttr::LeafAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Leaf, /*IsLateParsed=*/false, false) { } LeafAttr *LeafAttr::clone(ASTContext &C) const { auto *A = new (C) LeafAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void LeafAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((leaf"; OS << "))"; break; } case 1 : { OS << "[[gnu::leaf"; OS << "]]"; break; } case 2 : { OS << "[[gnu::leaf"; OS << "]]"; break; } } } const char *LeafAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "leaf"; case 1: return "leaf"; case 2: return "leaf"; } } // LifetimeBoundAttr implementation LifetimeBoundAttr *LifetimeBoundAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LifetimeBoundAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LifetimeBoundAttr *LifetimeBoundAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LifetimeBoundAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LifetimeBoundAttr *LifetimeBoundAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } LifetimeBoundAttr *LifetimeBoundAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_lifetimebound: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_lifetimebound, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } LifetimeBoundAttr::LifetimeBoundAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::LifetimeBound, /*IsLateParsed=*/false, false) { } LifetimeBoundAttr *LifetimeBoundAttr::clone(ASTContext &C) const { auto *A = new (C) LifetimeBoundAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void LifetimeBoundAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((lifetimebound"; OS << "))"; break; } case 1 : { OS << "[[clang::lifetimebound"; OS << "]]"; break; } } } const char *LifetimeBoundAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "lifetimebound"; case 1: return "lifetimebound"; } } // LikelyAttr implementation LikelyAttr *LikelyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LikelyAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LikelyAttr *LikelyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LikelyAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LikelyAttr *LikelyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_likely: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_likely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_likely: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_likely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } LikelyAttr *LikelyAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_likely: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_likely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_likely: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_likely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } LikelyAttr::LikelyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : StmtAttr(Ctx, CommonInfo, attr::Likely, /*IsLateParsed=*/false) { } LikelyAttr *LikelyAttr::clone(ASTContext &C) const { auto *A = new (C) LikelyAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void LikelyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[likely"; OS << "]]"; break; } case 1 : { OS << "[[clang::likely"; OS << "]]"; break; } } } const char *LikelyAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "likely"; case 1: return "likely"; } } // LoaderUninitializedAttr implementation LoaderUninitializedAttr *LoaderUninitializedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LoaderUninitializedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LoaderUninitializedAttr *LoaderUninitializedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LoaderUninitializedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LoaderUninitializedAttr *LoaderUninitializedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_loader_uninitialized: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_loader_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_loader_uninitialized: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_loader_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_loader_uninitialized: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_loader_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } LoaderUninitializedAttr *LoaderUninitializedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_loader_uninitialized: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_loader_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_loader_uninitialized: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_loader_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_loader_uninitialized: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_loader_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } LoaderUninitializedAttr::LoaderUninitializedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::LoaderUninitialized, /*IsLateParsed=*/false) { } LoaderUninitializedAttr *LoaderUninitializedAttr::clone(ASTContext &C) const { auto *A = new (C) LoaderUninitializedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void LoaderUninitializedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((loader_uninitialized"; OS << "))"; break; } case 1 : { OS << "[[clang::loader_uninitialized"; OS << "]]"; break; } case 2 : { OS << "[[clang::loader_uninitialized"; OS << "]]"; break; } } } const char *LoaderUninitializedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "loader_uninitialized"; case 1: return "loader_uninitialized"; case 2: return "loader_uninitialized"; } } // LockReturnedAttr implementation LockReturnedAttr *LockReturnedAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LockReturnedAttr(Ctx, CommonInfo, Arg); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LockReturnedAttr *LockReturnedAttr::Create(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LockReturnedAttr(Ctx, CommonInfo, Arg); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LockReturnedAttr *LockReturnedAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Arg, I); } LockReturnedAttr *LockReturnedAttr::Create(ASTContext &Ctx, Expr * Arg, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Arg, I); } LockReturnedAttr::LockReturnedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Arg ) : InheritableAttr(Ctx, CommonInfo, attr::LockReturned, /*IsLateParsed=*/true, false) , arg(Arg) { } LockReturnedAttr *LockReturnedAttr::clone(ASTContext &C) const { auto *A = new (C) LockReturnedAttr(C, *this, arg); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void LockReturnedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((lock_returned"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getArg()->printPretty(OS, nullptr, Policy); OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *LockReturnedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "lock_returned"; } } // LocksExcludedAttr implementation LocksExcludedAttr *LocksExcludedAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LocksExcludedAttr(Ctx, CommonInfo, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LocksExcludedAttr *LocksExcludedAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LocksExcludedAttr(Ctx, CommonInfo, Args, ArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LocksExcludedAttr *LocksExcludedAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Args, ArgsSize, I); } LocksExcludedAttr *LocksExcludedAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Args, ArgsSize, I); } LocksExcludedAttr::LocksExcludedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * *Args, unsigned ArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::LocksExcluded, /*IsLateParsed=*/true, true) , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) { std::copy(Args, Args + args_Size, args_); } LocksExcludedAttr::LocksExcludedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::LocksExcluded, /*IsLateParsed=*/true, true) , args_Size(0), args_(nullptr) { } LocksExcludedAttr *LocksExcludedAttr::clone(ASTContext &C) const { auto *A = new (C) LocksExcludedAttr(C, *this, args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void LocksExcludedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((locks_excluded"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *LocksExcludedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "locks_excluded"; } } // LoopHintAttr implementation LoopHintAttr *LoopHintAttr::CreateImplicit(ASTContext &Ctx, LoopHintAttr::OptionType Option, LoopHintAttr::LoopHintState State, Expr * Value, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LoopHintAttr(Ctx, CommonInfo, Option, State, Value); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } LoopHintAttr *LoopHintAttr::Create(ASTContext &Ctx, LoopHintAttr::OptionType Option, LoopHintAttr::LoopHintState State, Expr * Value, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) LoopHintAttr(Ctx, CommonInfo, Option, State, Value); return A; } LoopHintAttr *LoopHintAttr::CreateImplicit(ASTContext &Ctx, LoopHintAttr::OptionType Option, LoopHintAttr::LoopHintState State, Expr * Value, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Pragma_clang_loop: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_clang_loop, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Pragma_unroll: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_unroll, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Pragma_nounroll: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_nounroll, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Pragma_unroll_and_jam: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_unroll_and_jam, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Pragma_nounroll_and_jam: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_nounroll_and_jam, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Option, State, Value, I); } LoopHintAttr *LoopHintAttr::Create(ASTContext &Ctx, LoopHintAttr::OptionType Option, LoopHintAttr::LoopHintState State, Expr * Value, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Pragma_clang_loop: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_clang_loop, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Pragma_unroll: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_unroll, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Pragma_nounroll: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_nounroll, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Pragma_unroll_and_jam: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_unroll_and_jam, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Pragma_nounroll_and_jam: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, Pragma_nounroll_and_jam, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Option, State, Value, I); } LoopHintAttr::LoopHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , LoopHintAttr::OptionType Option , LoopHintAttr::LoopHintState State , Expr * Value ) : Attr(Ctx, CommonInfo, attr::LoopHint, /*IsLateParsed=*/false) , option(Option) , state(State) , value(Value) { } LoopHintAttr::Spelling LoopHintAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return Pragma_clang_loop; case 1: return Pragma_unroll; case 2: return Pragma_nounroll; case 3: return Pragma_unroll_and_jam; case 4: return Pragma_nounroll_and_jam; } } bool LoopHintAttr::ConvertStrToOptionType(StringRef Val, LoopHintAttr::OptionType &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("vectorize", LoopHintAttr::OptionType::Vectorize) .Case("vectorize_width", LoopHintAttr::OptionType::VectorizeWidth) .Case("interleave", LoopHintAttr::OptionType::Interleave) .Case("interleave_count", LoopHintAttr::OptionType::InterleaveCount) .Case("unroll", LoopHintAttr::OptionType::Unroll) .Case("unroll_count", LoopHintAttr::OptionType::UnrollCount) .Case("unroll_and_jam", LoopHintAttr::OptionType::UnrollAndJam) .Case("unroll_and_jam_count", LoopHintAttr::OptionType::UnrollAndJamCount) .Case("pipeline", LoopHintAttr::OptionType::PipelineDisabled) .Case("pipeline_initiation_interval", LoopHintAttr::OptionType::PipelineInitiationInterval) .Case("distribute", LoopHintAttr::OptionType::Distribute) .Case("vectorize_predicate", LoopHintAttr::OptionType::VectorizePredicate) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *LoopHintAttr::ConvertOptionTypeToStr(LoopHintAttr::OptionType Val) { switch(Val) { case LoopHintAttr::OptionType::Vectorize: return "vectorize"; case LoopHintAttr::OptionType::VectorizeWidth: return "vectorize_width"; case LoopHintAttr::OptionType::Interleave: return "interleave"; case LoopHintAttr::OptionType::InterleaveCount: return "interleave_count"; case LoopHintAttr::OptionType::Unroll: return "unroll"; case LoopHintAttr::OptionType::UnrollCount: return "unroll_count"; case LoopHintAttr::OptionType::UnrollAndJam: return "unroll_and_jam"; case LoopHintAttr::OptionType::UnrollAndJamCount: return "unroll_and_jam_count"; case LoopHintAttr::OptionType::PipelineDisabled: return "pipeline"; case LoopHintAttr::OptionType::PipelineInitiationInterval: return "pipeline_initiation_interval"; case LoopHintAttr::OptionType::Distribute: return "distribute"; case LoopHintAttr::OptionType::VectorizePredicate: return "vectorize_predicate"; } llvm_unreachable("No enumerator with that value"); } bool LoopHintAttr::ConvertStrToLoopHintState(StringRef Val, LoopHintAttr::LoopHintState &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("enable", LoopHintAttr::LoopHintState::Enable) .Case("disable", LoopHintAttr::LoopHintState::Disable) .Case("numeric", LoopHintAttr::LoopHintState::Numeric) .Case("fixed_width", LoopHintAttr::LoopHintState::FixedWidth) .Case("scalable_width", LoopHintAttr::LoopHintState::ScalableWidth) .Case("assume_safety", LoopHintAttr::LoopHintState::AssumeSafety) .Case("full", LoopHintAttr::LoopHintState::Full) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *LoopHintAttr::ConvertLoopHintStateToStr(LoopHintAttr::LoopHintState Val) { switch(Val) { case LoopHintAttr::LoopHintState::Enable: return "enable"; case LoopHintAttr::LoopHintState::Disable: return "disable"; case LoopHintAttr::LoopHintState::Numeric: return "numeric"; case LoopHintAttr::LoopHintState::FixedWidth: return "fixed_width"; case LoopHintAttr::LoopHintState::ScalableWidth: return "scalable_width"; case LoopHintAttr::LoopHintState::AssumeSafety: return "assume_safety"; case LoopHintAttr::LoopHintState::Full: return "full"; } llvm_unreachable("No enumerator with that value"); } LoopHintAttr *LoopHintAttr::clone(ASTContext &C) const { auto *A = new (C) LoopHintAttr(C, *this, option, state, value); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void LoopHintAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "#pragma clang loop"; printPrettyPragma(OS, Policy); OS << "\n"; break; } case 1 : { OS << "#pragma unroll"; printPrettyPragma(OS, Policy); OS << "\n"; break; } case 2 : { OS << "#pragma nounroll"; printPrettyPragma(OS, Policy); OS << "\n"; break; } case 3 : { OS << "#pragma unroll_and_jam"; printPrettyPragma(OS, Policy); OS << "\n"; break; } case 4 : { OS << "#pragma nounroll_and_jam"; printPrettyPragma(OS, Policy); OS << "\n"; break; } } } const char *LoopHintAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "loop"; case 1: return "unroll"; case 2: return "nounroll"; case 3: return "unroll_and_jam"; case 4: return "nounroll_and_jam"; } } // M68kInterruptAttr implementation M68kInterruptAttr *M68kInterruptAttr::CreateImplicit(ASTContext &Ctx, unsigned Number, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) M68kInterruptAttr(Ctx, CommonInfo, Number); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } M68kInterruptAttr *M68kInterruptAttr::Create(ASTContext &Ctx, unsigned Number, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) M68kInterruptAttr(Ctx, CommonInfo, Number); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } M68kInterruptAttr *M68kInterruptAttr::CreateImplicit(ASTContext &Ctx, unsigned Number, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Number, I); } M68kInterruptAttr *M68kInterruptAttr::Create(ASTContext &Ctx, unsigned Number, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Number, I); } M68kInterruptAttr::M68kInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned Number ) : InheritableAttr(Ctx, CommonInfo, attr::M68kInterrupt, /*IsLateParsed=*/false, false) , number(Number) { } M68kInterruptAttr *M68kInterruptAttr::clone(ASTContext &C) const { auto *A = new (C) M68kInterruptAttr(C, *this, number); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void M68kInterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((interrupt"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNumber() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *M68kInterruptAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "interrupt"; } } // M68kRTDAttr implementation M68kRTDAttr *M68kRTDAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) M68kRTDAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } M68kRTDAttr *M68kRTDAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) M68kRTDAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } M68kRTDAttr *M68kRTDAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_m68k_rtd: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_m68k_rtd, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_m68k_rtd: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_m68k_rtd, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_m68k_rtd: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_m68k_rtd, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } M68kRTDAttr *M68kRTDAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_m68k_rtd: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_m68k_rtd, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_m68k_rtd: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_m68k_rtd, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_m68k_rtd: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_m68k_rtd, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } M68kRTDAttr::M68kRTDAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::M68kRTD, /*IsLateParsed=*/false, false) { } M68kRTDAttr *M68kRTDAttr::clone(ASTContext &C) const { auto *A = new (C) M68kRTDAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void M68kRTDAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((m68k_rtd"; OS << "))"; break; } case 1 : { OS << "[[clang::m68k_rtd"; OS << "]]"; break; } case 2 : { OS << "[[clang::m68k_rtd"; OS << "]]"; break; } } } const char *M68kRTDAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "m68k_rtd"; case 1: return "m68k_rtd"; case 2: return "m68k_rtd"; } } // MIGServerRoutineAttr implementation MIGServerRoutineAttr *MIGServerRoutineAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MIGServerRoutineAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MIGServerRoutineAttr *MIGServerRoutineAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MIGServerRoutineAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MIGServerRoutineAttr *MIGServerRoutineAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_mig_server_routine: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_mig_server_routine, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_mig_server_routine: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_mig_server_routine, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_mig_server_routine: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_mig_server_routine, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } MIGServerRoutineAttr *MIGServerRoutineAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_mig_server_routine: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_mig_server_routine, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_mig_server_routine: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_mig_server_routine, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_mig_server_routine: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_mig_server_routine, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } MIGServerRoutineAttr::MIGServerRoutineAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::MIGServerRoutine, /*IsLateParsed=*/false, false) { } MIGServerRoutineAttr *MIGServerRoutineAttr::clone(ASTContext &C) const { auto *A = new (C) MIGServerRoutineAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MIGServerRoutineAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((mig_server_routine"; OS << "))"; break; } case 1 : { OS << "[[clang::mig_server_routine"; OS << "]]"; break; } case 2 : { OS << "[[clang::mig_server_routine"; OS << "]]"; break; } } } const char *MIGServerRoutineAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "mig_server_routine"; case 1: return "mig_server_routine"; case 2: return "mig_server_routine"; } } // MSABIAttr implementation MSABIAttr *MSABIAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSABIAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSABIAttr *MSABIAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSABIAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSABIAttr *MSABIAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ms_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ms_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_ms_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_ms_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_ms_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_ms_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } MSABIAttr *MSABIAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ms_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ms_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_ms_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_ms_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_ms_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_ms_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } MSABIAttr::MSABIAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::MSABI, /*IsLateParsed=*/false, false) { } MSABIAttr *MSABIAttr::clone(ASTContext &C) const { auto *A = new (C) MSABIAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MSABIAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((ms_abi"; OS << "))"; break; } case 1 : { OS << "[[gnu::ms_abi"; OS << "]]"; break; } case 2 : { OS << "[[gnu::ms_abi"; OS << "]]"; break; } } } const char *MSABIAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "ms_abi"; case 1: return "ms_abi"; case 2: return "ms_abi"; } } // MSAllocatorAttr implementation MSAllocatorAttr *MSAllocatorAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSAllocatorAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSAllocatorAttr *MSAllocatorAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSAllocatorAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSAllocatorAttr *MSAllocatorAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } MSAllocatorAttr *MSAllocatorAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } MSAllocatorAttr::MSAllocatorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::MSAllocator, /*IsLateParsed=*/false, false) { } MSAllocatorAttr *MSAllocatorAttr::clone(ASTContext &C) const { auto *A = new (C) MSAllocatorAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MSAllocatorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__declspec(allocator"; OS << ")"; break; } } } const char *MSAllocatorAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "allocator"; } } // MSConstexprAttr implementation MSConstexprAttr *MSConstexprAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSConstexprAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSConstexprAttr *MSConstexprAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSConstexprAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSConstexprAttr *MSConstexprAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } MSConstexprAttr *MSConstexprAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } MSConstexprAttr::MSConstexprAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::MSConstexpr, /*IsLateParsed=*/false, false) { } MSConstexprAttr *MSConstexprAttr::clone(ASTContext &C) const { auto *A = new (C) MSConstexprAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MSConstexprAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[msvc::constexpr"; OS << "]]"; break; } } } const char *MSConstexprAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "constexpr"; } } // MSInheritanceAttr implementation MSInheritanceAttr *MSInheritanceAttr::CreateImplicit(ASTContext &Ctx, bool BestCase, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSInheritanceAttr(Ctx, CommonInfo, BestCase); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSInheritanceAttr *MSInheritanceAttr::Create(ASTContext &Ctx, bool BestCase, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSInheritanceAttr(Ctx, CommonInfo, BestCase); return A; } MSInheritanceAttr *MSInheritanceAttr::CreateImplicit(ASTContext &Ctx, bool BestCase, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_single_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_single_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_multiple_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_multiple_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_virtual_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_virtual_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_unspecified_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_unspecified_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, BestCase, I); } MSInheritanceAttr *MSInheritanceAttr::Create(ASTContext &Ctx, bool BestCase, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_single_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_single_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_multiple_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_multiple_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_virtual_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_virtual_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_unspecified_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_unspecified_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, BestCase, I); } MSInheritanceAttr *MSInheritanceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSInheritanceAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSInheritanceAttr *MSInheritanceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSInheritanceAttr(Ctx, CommonInfo); return A; } MSInheritanceAttr *MSInheritanceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_single_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_single_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_multiple_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_multiple_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_virtual_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_virtual_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_unspecified_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_unspecified_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } MSInheritanceAttr *MSInheritanceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_single_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_single_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_multiple_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_multiple_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_virtual_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_virtual_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_unspecified_inheritance: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_unspecified_inheritance, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } MSInheritanceAttr::MSInheritanceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , bool BestCase ) : InheritableAttr(Ctx, CommonInfo, attr::MSInheritance, /*IsLateParsed=*/false, false) , bestCase(BestCase) { } MSInheritanceAttr::MSInheritanceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::MSInheritance, /*IsLateParsed=*/false, false) , bestCase() { } MSInheritanceAttr::Spelling MSInheritanceAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return Keyword_single_inheritance; case 1: return Keyword_multiple_inheritance; case 2: return Keyword_virtual_inheritance; case 3: return Keyword_unspecified_inheritance; } } MSInheritanceAttr *MSInheritanceAttr::clone(ASTContext &C) const { auto *A = new (C) MSInheritanceAttr(C, *this, bestCase); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MSInheritanceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__single_inheritance"; OS << ""; break; } case 1 : { OS << "__multiple_inheritance"; OS << ""; break; } case 2 : { OS << "__virtual_inheritance"; OS << ""; break; } case 3 : { OS << "__unspecified_inheritance"; OS << ""; break; } } } const char *MSInheritanceAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__single_inheritance"; case 1: return "__multiple_inheritance"; case 2: return "__virtual_inheritance"; case 3: return "__unspecified_inheritance"; } } // MSNoVTableAttr implementation MSNoVTableAttr *MSNoVTableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSNoVTableAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSNoVTableAttr *MSNoVTableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSNoVTableAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSNoVTableAttr *MSNoVTableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } MSNoVTableAttr *MSNoVTableAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } MSNoVTableAttr::MSNoVTableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::MSNoVTable, /*IsLateParsed=*/false, false) { } MSNoVTableAttr *MSNoVTableAttr::clone(ASTContext &C) const { auto *A = new (C) MSNoVTableAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MSNoVTableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__declspec(novtable"; OS << ")"; break; } } } const char *MSNoVTableAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "novtable"; } } // MSP430InterruptAttr implementation MSP430InterruptAttr *MSP430InterruptAttr::CreateImplicit(ASTContext &Ctx, unsigned Number, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSP430InterruptAttr(Ctx, CommonInfo, Number); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSP430InterruptAttr *MSP430InterruptAttr::Create(ASTContext &Ctx, unsigned Number, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSP430InterruptAttr(Ctx, CommonInfo, Number); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSP430InterruptAttr *MSP430InterruptAttr::CreateImplicit(ASTContext &Ctx, unsigned Number, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Number, I); } MSP430InterruptAttr *MSP430InterruptAttr::Create(ASTContext &Ctx, unsigned Number, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Number, I); } MSP430InterruptAttr::MSP430InterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned Number ) : InheritableAttr(Ctx, CommonInfo, attr::MSP430Interrupt, /*IsLateParsed=*/false, false) , number(Number) { } MSP430InterruptAttr *MSP430InterruptAttr::clone(ASTContext &C) const { auto *A = new (C) MSP430InterruptAttr(C, *this, number); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MSP430InterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((interrupt"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNumber() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::interrupt"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNumber() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::interrupt"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNumber() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *MSP430InterruptAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "interrupt"; case 1: return "interrupt"; case 2: return "interrupt"; } } // MSStructAttr implementation MSStructAttr *MSStructAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSStructAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSStructAttr *MSStructAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSStructAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSStructAttr *MSStructAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ms_struct: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ms_struct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_ms_struct: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_ms_struct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_ms_struct: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_ms_struct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } MSStructAttr *MSStructAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ms_struct: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ms_struct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_ms_struct: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_ms_struct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_ms_struct: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_ms_struct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } MSStructAttr::MSStructAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::MSStruct, /*IsLateParsed=*/false, false) { } MSStructAttr *MSStructAttr::clone(ASTContext &C) const { auto *A = new (C) MSStructAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MSStructAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((ms_struct"; OS << "))"; break; } case 1 : { OS << "[[gnu::ms_struct"; OS << "]]"; break; } case 2 : { OS << "[[gnu::ms_struct"; OS << "]]"; break; } } } const char *MSStructAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "ms_struct"; case 1: return "ms_struct"; case 2: return "ms_struct"; } } // MSVtorDispAttr implementation MSVtorDispAttr *MSVtorDispAttr::CreateImplicit(ASTContext &Ctx, unsigned Vdm, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSVtorDispAttr(Ctx, CommonInfo, Vdm); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSVtorDispAttr *MSVtorDispAttr::Create(ASTContext &Ctx, unsigned Vdm, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MSVtorDispAttr(Ctx, CommonInfo, Vdm); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MSVtorDispAttr *MSVtorDispAttr::CreateImplicit(ASTContext &Ctx, unsigned Vdm, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, Vdm, I); } MSVtorDispAttr *MSVtorDispAttr::Create(ASTContext &Ctx, unsigned Vdm, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, Vdm, I); } MSVtorDispAttr::MSVtorDispAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned Vdm ) : InheritableAttr(Ctx, CommonInfo, attr::MSVtorDisp, /*IsLateParsed=*/false, false) , vdm(Vdm) { } MSVtorDispAttr *MSVtorDispAttr::clone(ASTContext &C) const { auto *A = new (C) MSVtorDispAttr(C, *this, vdm); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MSVtorDispAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *MSVtorDispAttr::getSpelling() const { return "(No spelling)"; } // MaxFieldAlignmentAttr implementation MaxFieldAlignmentAttr *MaxFieldAlignmentAttr::CreateImplicit(ASTContext &Ctx, unsigned Alignment, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MaxFieldAlignmentAttr(Ctx, CommonInfo, Alignment); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MaxFieldAlignmentAttr *MaxFieldAlignmentAttr::Create(ASTContext &Ctx, unsigned Alignment, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MaxFieldAlignmentAttr(Ctx, CommonInfo, Alignment); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MaxFieldAlignmentAttr *MaxFieldAlignmentAttr::CreateImplicit(ASTContext &Ctx, unsigned Alignment, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, Alignment, I); } MaxFieldAlignmentAttr *MaxFieldAlignmentAttr::Create(ASTContext &Ctx, unsigned Alignment, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, Alignment, I); } MaxFieldAlignmentAttr::MaxFieldAlignmentAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned Alignment ) : InheritableAttr(Ctx, CommonInfo, attr::MaxFieldAlignment, /*IsLateParsed=*/false, false) , alignment(Alignment) { } MaxFieldAlignmentAttr *MaxFieldAlignmentAttr::clone(ASTContext &C) const { auto *A = new (C) MaxFieldAlignmentAttr(C, *this, alignment); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MaxFieldAlignmentAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *MaxFieldAlignmentAttr::getSpelling() const { return "(No spelling)"; } // MayAliasAttr implementation MayAliasAttr *MayAliasAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MayAliasAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MayAliasAttr *MayAliasAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MayAliasAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MayAliasAttr *MayAliasAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_may_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_may_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_may_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_may_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_may_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_may_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } MayAliasAttr *MayAliasAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_may_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_may_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_may_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_may_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_may_alias: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_may_alias, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } MayAliasAttr::MayAliasAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::MayAlias, /*IsLateParsed=*/false, false) { } MayAliasAttr *MayAliasAttr::clone(ASTContext &C) const { auto *A = new (C) MayAliasAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MayAliasAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((may_alias"; OS << "))"; break; } case 1 : { OS << "[[gnu::may_alias"; OS << "]]"; break; } case 2 : { OS << "[[gnu::may_alias"; OS << "]]"; break; } } } const char *MayAliasAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "may_alias"; case 1: return "may_alias"; case 2: return "may_alias"; } } // MaybeUndefAttr implementation MaybeUndefAttr *MaybeUndefAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MaybeUndefAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MaybeUndefAttr *MaybeUndefAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MaybeUndefAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MaybeUndefAttr *MaybeUndefAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_maybe_undef: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_maybe_undef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_maybe_undef: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_maybe_undef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_maybe_undef: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_maybe_undef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } MaybeUndefAttr *MaybeUndefAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_maybe_undef: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_maybe_undef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_maybe_undef: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_maybe_undef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_maybe_undef: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_maybe_undef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } MaybeUndefAttr::MaybeUndefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::MaybeUndef, /*IsLateParsed=*/false, false) { } MaybeUndefAttr *MaybeUndefAttr::clone(ASTContext &C) const { auto *A = new (C) MaybeUndefAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MaybeUndefAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((maybe_undef"; OS << "))"; break; } case 1 : { OS << "[[clang::maybe_undef"; OS << "]]"; break; } case 2 : { OS << "[[clang::maybe_undef"; OS << "]]"; break; } } } const char *MaybeUndefAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "maybe_undef"; case 1: return "maybe_undef"; case 2: return "maybe_undef"; } } // MicroMipsAttr implementation MicroMipsAttr *MicroMipsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MicroMipsAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MicroMipsAttr *MicroMipsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MicroMipsAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MicroMipsAttr *MicroMipsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_micromips: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_micromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_micromips: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_micromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_micromips: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_micromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } MicroMipsAttr *MicroMipsAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_micromips: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_micromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_micromips: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_micromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_micromips: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_micromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } MicroMipsAttr::MicroMipsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::MicroMips, /*IsLateParsed=*/false, false) { } MicroMipsAttr *MicroMipsAttr::clone(ASTContext &C) const { auto *A = new (C) MicroMipsAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MicroMipsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((micromips"; OS << "))"; break; } case 1 : { OS << "[[gnu::micromips"; OS << "]]"; break; } case 2 : { OS << "[[gnu::micromips"; OS << "]]"; break; } } } const char *MicroMipsAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "micromips"; case 1: return "micromips"; case 2: return "micromips"; } } // MinSizeAttr implementation MinSizeAttr *MinSizeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MinSizeAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MinSizeAttr *MinSizeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MinSizeAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MinSizeAttr *MinSizeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_minsize: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_minsize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_minsize: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_minsize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_minsize: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_minsize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } MinSizeAttr *MinSizeAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_minsize: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_minsize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_minsize: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_minsize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_minsize: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_minsize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } MinSizeAttr::MinSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::MinSize, /*IsLateParsed=*/false, false) { } MinSizeAttr *MinSizeAttr::clone(ASTContext &C) const { auto *A = new (C) MinSizeAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MinSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((minsize"; OS << "))"; break; } case 1 : { OS << "[[clang::minsize"; OS << "]]"; break; } case 2 : { OS << "[[clang::minsize"; OS << "]]"; break; } } } const char *MinSizeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "minsize"; case 1: return "minsize"; case 2: return "minsize"; } } // MinVectorWidthAttr implementation MinVectorWidthAttr *MinVectorWidthAttr::CreateImplicit(ASTContext &Ctx, unsigned VectorWidth, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MinVectorWidthAttr(Ctx, CommonInfo, VectorWidth); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MinVectorWidthAttr *MinVectorWidthAttr::Create(ASTContext &Ctx, unsigned VectorWidth, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MinVectorWidthAttr(Ctx, CommonInfo, VectorWidth); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MinVectorWidthAttr *MinVectorWidthAttr::CreateImplicit(ASTContext &Ctx, unsigned VectorWidth, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_min_vector_width: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_min_vector_width, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_min_vector_width: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_min_vector_width, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_min_vector_width: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_min_vector_width, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, VectorWidth, I); } MinVectorWidthAttr *MinVectorWidthAttr::Create(ASTContext &Ctx, unsigned VectorWidth, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_min_vector_width: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_min_vector_width, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_min_vector_width: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_min_vector_width, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_min_vector_width: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_min_vector_width, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, VectorWidth, I); } MinVectorWidthAttr::MinVectorWidthAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned VectorWidth ) : InheritableAttr(Ctx, CommonInfo, attr::MinVectorWidth, /*IsLateParsed=*/false, false) , vectorWidth(VectorWidth) { } MinVectorWidthAttr *MinVectorWidthAttr::clone(ASTContext &C) const { auto *A = new (C) MinVectorWidthAttr(C, *this, vectorWidth); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MinVectorWidthAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((min_vector_width"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getVectorWidth() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::min_vector_width"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getVectorWidth() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::min_vector_width"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getVectorWidth() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *MinVectorWidthAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "min_vector_width"; case 1: return "min_vector_width"; case 2: return "min_vector_width"; } } // Mips16Attr implementation Mips16Attr *Mips16Attr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) Mips16Attr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } Mips16Attr *Mips16Attr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) Mips16Attr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } Mips16Attr *Mips16Attr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_mips16: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_mips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_mips16: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_mips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_mips16: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_mips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } Mips16Attr *Mips16Attr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_mips16: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_mips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_mips16: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_mips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_mips16: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_mips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } Mips16Attr::Mips16Attr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Mips16, /*IsLateParsed=*/false, false) { } Mips16Attr *Mips16Attr::clone(ASTContext &C) const { auto *A = new (C) Mips16Attr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void Mips16Attr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((mips16"; OS << "))"; break; } case 1 : { OS << "[[gnu::mips16"; OS << "]]"; break; } case 2 : { OS << "[[gnu::mips16"; OS << "]]"; break; } } } const char *Mips16Attr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "mips16"; case 1: return "mips16"; case 2: return "mips16"; } } // MipsInterruptAttr implementation MipsInterruptAttr *MipsInterruptAttr::CreateImplicit(ASTContext &Ctx, MipsInterruptAttr::InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MipsInterruptAttr(Ctx, CommonInfo, Interrupt); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MipsInterruptAttr *MipsInterruptAttr::Create(ASTContext &Ctx, MipsInterruptAttr::InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MipsInterruptAttr(Ctx, CommonInfo, Interrupt); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MipsInterruptAttr *MipsInterruptAttr::CreateImplicit(ASTContext &Ctx, MipsInterruptAttr::InterruptType Interrupt, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Interrupt, I); } MipsInterruptAttr *MipsInterruptAttr::Create(ASTContext &Ctx, MipsInterruptAttr::InterruptType Interrupt, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Interrupt, I); } MipsInterruptAttr::MipsInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , MipsInterruptAttr::InterruptType Interrupt ) : InheritableAttr(Ctx, CommonInfo, attr::MipsInterrupt, /*IsLateParsed=*/false, false) , interrupt(Interrupt) { } bool MipsInterruptAttr::ConvertStrToInterruptType(StringRef Val, MipsInterruptAttr::InterruptType &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("vector=sw0", MipsInterruptAttr::InterruptType::sw0) .Case("vector=sw1", MipsInterruptAttr::InterruptType::sw1) .Case("vector=hw0", MipsInterruptAttr::InterruptType::hw0) .Case("vector=hw1", MipsInterruptAttr::InterruptType::hw1) .Case("vector=hw2", MipsInterruptAttr::InterruptType::hw2) .Case("vector=hw3", MipsInterruptAttr::InterruptType::hw3) .Case("vector=hw4", MipsInterruptAttr::InterruptType::hw4) .Case("vector=hw5", MipsInterruptAttr::InterruptType::hw5) .Case("eic", MipsInterruptAttr::InterruptType::eic) .Case("", MipsInterruptAttr::InterruptType::eic) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *MipsInterruptAttr::ConvertInterruptTypeToStr(MipsInterruptAttr::InterruptType Val) { switch(Val) { case MipsInterruptAttr::InterruptType::sw0: return "vector=sw0"; case MipsInterruptAttr::InterruptType::sw1: return "vector=sw1"; case MipsInterruptAttr::InterruptType::hw0: return "vector=hw0"; case MipsInterruptAttr::InterruptType::hw1: return "vector=hw1"; case MipsInterruptAttr::InterruptType::hw2: return "vector=hw2"; case MipsInterruptAttr::InterruptType::hw3: return "vector=hw3"; case MipsInterruptAttr::InterruptType::hw4: return "vector=hw4"; case MipsInterruptAttr::InterruptType::hw5: return "vector=hw5"; case MipsInterruptAttr::InterruptType::eic: return "eic"; } llvm_unreachable("No enumerator with that value"); } MipsInterruptAttr *MipsInterruptAttr::clone(ASTContext &C) const { auto *A = new (C) MipsInterruptAttr(C, *this, interrupt); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MipsInterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((interrupt"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << MipsInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::interrupt"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << MipsInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::interrupt"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << MipsInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *MipsInterruptAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "interrupt"; case 1: return "interrupt"; case 2: return "interrupt"; } } // MipsLongCallAttr implementation MipsLongCallAttr *MipsLongCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MipsLongCallAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MipsLongCallAttr *MipsLongCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MipsLongCallAttr(Ctx, CommonInfo); return A; } MipsLongCallAttr *MipsLongCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_long_call: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_long_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_long_call: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_long_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_long_call: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_long_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_far: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_far, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_far: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_far, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_far: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_far, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } MipsLongCallAttr *MipsLongCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_long_call: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_long_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_long_call: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_long_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_long_call: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_long_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_far: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_far, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_far: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_far, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_far: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_far, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } MipsLongCallAttr::MipsLongCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::MipsLongCall, /*IsLateParsed=*/false, false) { } MipsLongCallAttr::Spelling MipsLongCallAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_long_call; case 1: return CXX11_gnu_long_call; case 2: return C23_gnu_long_call; case 3: return GNU_far; case 4: return CXX11_gnu_far; case 5: return C23_gnu_far; } } MipsLongCallAttr *MipsLongCallAttr::clone(ASTContext &C) const { auto *A = new (C) MipsLongCallAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MipsLongCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((long_call"; OS << "))"; break; } case 1 : { OS << "[[gnu::long_call"; OS << "]]"; break; } case 2 : { OS << "[[gnu::long_call"; OS << "]]"; break; } case 3 : { OS << "__attribute__((far"; OS << "))"; break; } case 4 : { OS << "[[gnu::far"; OS << "]]"; break; } case 5 : { OS << "[[gnu::far"; OS << "]]"; break; } } } const char *MipsLongCallAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "long_call"; case 1: return "long_call"; case 2: return "long_call"; case 3: return "far"; case 4: return "far"; case 5: return "far"; } } // MipsShortCallAttr implementation MipsShortCallAttr *MipsShortCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MipsShortCallAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MipsShortCallAttr *MipsShortCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MipsShortCallAttr(Ctx, CommonInfo); return A; } MipsShortCallAttr *MipsShortCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_short_call: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_short_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_short_call: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_short_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_short_call: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_short_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_near: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_near, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_near: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_near, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_near: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_near, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } MipsShortCallAttr *MipsShortCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_short_call: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_short_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_short_call: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_short_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_short_call: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_short_call, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_near: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_near, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_near: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_near, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_near: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_near, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } MipsShortCallAttr::MipsShortCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::MipsShortCall, /*IsLateParsed=*/false, false) { } MipsShortCallAttr::Spelling MipsShortCallAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_short_call; case 1: return CXX11_gnu_short_call; case 2: return C23_gnu_short_call; case 3: return GNU_near; case 4: return CXX11_gnu_near; case 5: return C23_gnu_near; } } MipsShortCallAttr *MipsShortCallAttr::clone(ASTContext &C) const { auto *A = new (C) MipsShortCallAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MipsShortCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((short_call"; OS << "))"; break; } case 1 : { OS << "[[gnu::short_call"; OS << "]]"; break; } case 2 : { OS << "[[gnu::short_call"; OS << "]]"; break; } case 3 : { OS << "__attribute__((near"; OS << "))"; break; } case 4 : { OS << "[[gnu::near"; OS << "]]"; break; } case 5 : { OS << "[[gnu::near"; OS << "]]"; break; } } } const char *MipsShortCallAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "short_call"; case 1: return "short_call"; case 2: return "short_call"; case 3: return "near"; case 4: return "near"; case 5: return "near"; } } // ModeAttr implementation ModeAttr *ModeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Mode, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ModeAttr(Ctx, CommonInfo, Mode); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ModeAttr *ModeAttr::Create(ASTContext &Ctx, IdentifierInfo * Mode, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ModeAttr(Ctx, CommonInfo, Mode); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ModeAttr *ModeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Mode, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_mode: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_mode, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_mode: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_mode, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_mode: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_mode, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Mode, I); } ModeAttr *ModeAttr::Create(ASTContext &Ctx, IdentifierInfo * Mode, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_mode: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_mode, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_mode: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_mode, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_mode: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_mode, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Mode, I); } ModeAttr::ModeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * Mode ) : Attr(Ctx, CommonInfo, attr::Mode, /*IsLateParsed=*/false) , mode(Mode) { } ModeAttr *ModeAttr::clone(ASTContext &C) const { auto *A = new (C) ModeAttr(C, *this, mode); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ModeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((mode"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getMode() ? getMode()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::mode"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getMode() ? getMode()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::mode"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getMode() ? getMode()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ModeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "mode"; case 1: return "mode"; case 2: return "mode"; } } // MustTailAttr implementation MustTailAttr *MustTailAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MustTailAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MustTailAttr *MustTailAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) MustTailAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } MustTailAttr *MustTailAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_musttail: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_musttail, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_musttail: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_musttail, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_musttail: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_musttail, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } MustTailAttr *MustTailAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_musttail: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_musttail, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_musttail: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_musttail, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_musttail: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_musttail, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } MustTailAttr::MustTailAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : StmtAttr(Ctx, CommonInfo, attr::MustTail, /*IsLateParsed=*/false) { } MustTailAttr *MustTailAttr::clone(ASTContext &C) const { auto *A = new (C) MustTailAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void MustTailAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((musttail"; OS << "))"; break; } case 1 : { OS << "[[clang::musttail"; OS << "]]"; break; } case 2 : { OS << "[[clang::musttail"; OS << "]]"; break; } } } const char *MustTailAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "musttail"; case 1: return "musttail"; case 2: return "musttail"; } } // NSConsumedAttr implementation NSConsumedAttr *NSConsumedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NSConsumedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NSConsumedAttr *NSConsumedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NSConsumedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NSConsumedAttr *NSConsumedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ns_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ns_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ns_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NSConsumedAttr *NSConsumedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ns_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ns_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ns_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NSConsumedAttr::NSConsumedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableParamAttr(Ctx, CommonInfo, attr::NSConsumed, /*IsLateParsed=*/false, false) { } NSConsumedAttr *NSConsumedAttr::clone(ASTContext &C) const { auto *A = new (C) NSConsumedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NSConsumedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((ns_consumed"; OS << "))"; break; } case 1 : { OS << "[[clang::ns_consumed"; OS << "]]"; break; } case 2 : { OS << "[[clang::ns_consumed"; OS << "]]"; break; } } } const char *NSConsumedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "ns_consumed"; case 1: return "ns_consumed"; case 2: return "ns_consumed"; } } // NSConsumesSelfAttr implementation NSConsumesSelfAttr *NSConsumesSelfAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NSConsumesSelfAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NSConsumesSelfAttr *NSConsumesSelfAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NSConsumesSelfAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NSConsumesSelfAttr *NSConsumesSelfAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ns_consumes_self: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_consumes_self, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ns_consumes_self: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_consumes_self, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ns_consumes_self: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_consumes_self, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NSConsumesSelfAttr *NSConsumesSelfAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ns_consumes_self: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_consumes_self, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ns_consumes_self: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_consumes_self, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ns_consumes_self: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_consumes_self, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NSConsumesSelfAttr::NSConsumesSelfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NSConsumesSelf, /*IsLateParsed=*/false, false) { } NSConsumesSelfAttr *NSConsumesSelfAttr::clone(ASTContext &C) const { auto *A = new (C) NSConsumesSelfAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NSConsumesSelfAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((ns_consumes_self"; OS << "))"; break; } case 1 : { OS << "[[clang::ns_consumes_self"; OS << "]]"; break; } case 2 : { OS << "[[clang::ns_consumes_self"; OS << "]]"; break; } } } const char *NSConsumesSelfAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "ns_consumes_self"; case 1: return "ns_consumes_self"; case 2: return "ns_consumes_self"; } } // NSErrorDomainAttr implementation NSErrorDomainAttr *NSErrorDomainAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ErrorDomain, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NSErrorDomainAttr(Ctx, CommonInfo, ErrorDomain); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NSErrorDomainAttr *NSErrorDomainAttr::Create(ASTContext &Ctx, IdentifierInfo * ErrorDomain, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NSErrorDomainAttr(Ctx, CommonInfo, ErrorDomain); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NSErrorDomainAttr *NSErrorDomainAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ErrorDomain, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, ErrorDomain, I); } NSErrorDomainAttr *NSErrorDomainAttr::Create(ASTContext &Ctx, IdentifierInfo * ErrorDomain, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, ErrorDomain, I); } NSErrorDomainAttr::NSErrorDomainAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * ErrorDomain ) : InheritableAttr(Ctx, CommonInfo, attr::NSErrorDomain, /*IsLateParsed=*/false, false) , errorDomain(ErrorDomain) { } NSErrorDomainAttr *NSErrorDomainAttr::clone(ASTContext &C) const { auto *A = new (C) NSErrorDomainAttr(C, *this, errorDomain); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NSErrorDomainAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((ns_error_domain"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getErrorDomain() ? getErrorDomain()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *NSErrorDomainAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "ns_error_domain"; } } // NSReturnsAutoreleasedAttr implementation NSReturnsAutoreleasedAttr *NSReturnsAutoreleasedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NSReturnsAutoreleasedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NSReturnsAutoreleasedAttr *NSReturnsAutoreleasedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NSReturnsAutoreleasedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NSReturnsAutoreleasedAttr *NSReturnsAutoreleasedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ns_returns_autoreleased: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_returns_autoreleased, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ns_returns_autoreleased: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_returns_autoreleased, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ns_returns_autoreleased: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_returns_autoreleased, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NSReturnsAutoreleasedAttr *NSReturnsAutoreleasedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ns_returns_autoreleased: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_returns_autoreleased, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ns_returns_autoreleased: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_returns_autoreleased, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ns_returns_autoreleased: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_returns_autoreleased, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NSReturnsAutoreleasedAttr::NSReturnsAutoreleasedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NSReturnsAutoreleased, /*IsLateParsed=*/false, false) { } NSReturnsAutoreleasedAttr *NSReturnsAutoreleasedAttr::clone(ASTContext &C) const { auto *A = new (C) NSReturnsAutoreleasedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NSReturnsAutoreleasedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((ns_returns_autoreleased"; OS << "))"; break; } case 1 : { OS << "[[clang::ns_returns_autoreleased"; OS << "]]"; break; } case 2 : { OS << "[[clang::ns_returns_autoreleased"; OS << "]]"; break; } } } const char *NSReturnsAutoreleasedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "ns_returns_autoreleased"; case 1: return "ns_returns_autoreleased"; case 2: return "ns_returns_autoreleased"; } } // NSReturnsNotRetainedAttr implementation NSReturnsNotRetainedAttr *NSReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NSReturnsNotRetainedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NSReturnsNotRetainedAttr *NSReturnsNotRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NSReturnsNotRetainedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NSReturnsNotRetainedAttr *NSReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ns_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ns_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ns_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NSReturnsNotRetainedAttr *NSReturnsNotRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ns_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ns_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ns_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NSReturnsNotRetainedAttr::NSReturnsNotRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NSReturnsNotRetained, /*IsLateParsed=*/false, false) { } NSReturnsNotRetainedAttr *NSReturnsNotRetainedAttr::clone(ASTContext &C) const { auto *A = new (C) NSReturnsNotRetainedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NSReturnsNotRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((ns_returns_not_retained"; OS << "))"; break; } case 1 : { OS << "[[clang::ns_returns_not_retained"; OS << "]]"; break; } case 2 : { OS << "[[clang::ns_returns_not_retained"; OS << "]]"; break; } } } const char *NSReturnsNotRetainedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "ns_returns_not_retained"; case 1: return "ns_returns_not_retained"; case 2: return "ns_returns_not_retained"; } } // NSReturnsRetainedAttr implementation NSReturnsRetainedAttr *NSReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NSReturnsRetainedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NSReturnsRetainedAttr *NSReturnsRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NSReturnsRetainedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NSReturnsRetainedAttr *NSReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ns_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ns_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ns_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NSReturnsRetainedAttr *NSReturnsRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ns_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ns_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ns_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ns_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ns_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ns_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NSReturnsRetainedAttr::NSReturnsRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NSReturnsRetained, /*IsLateParsed=*/false, false) { } NSReturnsRetainedAttr *NSReturnsRetainedAttr::clone(ASTContext &C) const { auto *A = new (C) NSReturnsRetainedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NSReturnsRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((ns_returns_retained"; OS << "))"; break; } case 1 : { OS << "[[clang::ns_returns_retained"; OS << "]]"; break; } case 2 : { OS << "[[clang::ns_returns_retained"; OS << "]]"; break; } } } const char *NSReturnsRetainedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "ns_returns_retained"; case 1: return "ns_returns_retained"; case 2: return "ns_returns_retained"; } } // NVPTXKernelAttr implementation NVPTXKernelAttr *NVPTXKernelAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NVPTXKernelAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NVPTXKernelAttr *NVPTXKernelAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NVPTXKernelAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NVPTXKernelAttr *NVPTXKernelAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nvptx_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nvptx_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_nvptx_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nvptx_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_nvptx_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nvptx_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NVPTXKernelAttr *NVPTXKernelAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nvptx_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nvptx_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_nvptx_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nvptx_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_nvptx_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nvptx_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NVPTXKernelAttr::NVPTXKernelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NVPTXKernel, /*IsLateParsed=*/false, false) { } NVPTXKernelAttr *NVPTXKernelAttr::clone(ASTContext &C) const { auto *A = new (C) NVPTXKernelAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NVPTXKernelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((nvptx_kernel"; OS << "))"; break; } case 1 : { OS << "[[clang::nvptx_kernel"; OS << "]]"; break; } case 2 : { OS << "[[clang::nvptx_kernel"; OS << "]]"; break; } } } const char *NVPTXKernelAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "nvptx_kernel"; case 1: return "nvptx_kernel"; case 2: return "nvptx_kernel"; } } // NakedAttr implementation NakedAttr *NakedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NakedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NakedAttr *NakedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NakedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NakedAttr *NakedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_naked: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_naked: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_naked: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_naked: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NakedAttr *NakedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_naked: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_naked: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_naked: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_naked: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_naked, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NakedAttr::NakedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Naked, /*IsLateParsed=*/false, false) { } NakedAttr *NakedAttr::clone(ASTContext &C) const { auto *A = new (C) NakedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NakedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((naked"; OS << "))"; break; } case 1 : { OS << "[[gnu::naked"; OS << "]]"; break; } case 2 : { OS << "[[gnu::naked"; OS << "]]"; break; } case 3 : { OS << "__declspec(naked"; OS << ")"; break; } } } const char *NakedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "naked"; case 1: return "naked"; case 2: return "naked"; case 3: return "naked"; } } // NoAliasAttr implementation NoAliasAttr *NoAliasAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoAliasAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoAliasAttr *NoAliasAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoAliasAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoAliasAttr *NoAliasAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } NoAliasAttr *NoAliasAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } NoAliasAttr::NoAliasAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoAlias, /*IsLateParsed=*/false, false) { } NoAliasAttr *NoAliasAttr::clone(ASTContext &C) const { auto *A = new (C) NoAliasAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoAliasAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__declspec(noalias"; OS << ")"; break; } } } const char *NoAliasAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "noalias"; } } // NoBuiltinAttr implementation NoBuiltinAttr *NoBuiltinAttr::CreateImplicit(ASTContext &Ctx, StringRef *BuiltinNames, unsigned BuiltinNamesSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoBuiltinAttr(Ctx, CommonInfo, BuiltinNames, BuiltinNamesSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoBuiltinAttr *NoBuiltinAttr::Create(ASTContext &Ctx, StringRef *BuiltinNames, unsigned BuiltinNamesSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoBuiltinAttr(Ctx, CommonInfo, BuiltinNames, BuiltinNamesSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoBuiltinAttr *NoBuiltinAttr::CreateImplicit(ASTContext &Ctx, StringRef *BuiltinNames, unsigned BuiltinNamesSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_no_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_no_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, BuiltinNames, BuiltinNamesSize, I); } NoBuiltinAttr *NoBuiltinAttr::Create(ASTContext &Ctx, StringRef *BuiltinNames, unsigned BuiltinNamesSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_no_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_no_builtin: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_builtin, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, BuiltinNames, BuiltinNamesSize, I); } NoBuiltinAttr::NoBuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , StringRef *BuiltinNames, unsigned BuiltinNamesSize ) : Attr(Ctx, CommonInfo, attr::NoBuiltin, /*IsLateParsed=*/false) , builtinNames_Size(BuiltinNamesSize), builtinNames_(new (Ctx, 16) StringRef[builtinNames_Size]) { for (size_t I = 0, E = builtinNames_Size; I != E; ++I) { StringRef Ref = BuiltinNames[I]; if (!Ref.empty()) { char *Mem = new (Ctx, 1) char[Ref.size()]; std::memcpy(Mem, Ref.data(), Ref.size()); builtinNames_[I] = StringRef(Mem, Ref.size()); } } } NoBuiltinAttr::NoBuiltinAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::NoBuiltin, /*IsLateParsed=*/false) , builtinNames_Size(0), builtinNames_(nullptr) { } NoBuiltinAttr *NoBuiltinAttr::clone(ASTContext &C) const { auto *A = new (C) NoBuiltinAttr(C, *this, builtinNames_, builtinNames_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoBuiltinAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((no_builtin"; OS << ""; for (const auto &Val : builtinNames()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::no_builtin"; OS << ""; for (const auto &Val : builtinNames()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::no_builtin"; OS << ""; for (const auto &Val : builtinNames()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *NoBuiltinAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "no_builtin"; case 1: return "no_builtin"; case 2: return "no_builtin"; } } // NoCommonAttr implementation NoCommonAttr *NoCommonAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoCommonAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoCommonAttr *NoCommonAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoCommonAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoCommonAttr *NoCommonAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nocommon: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nocommon, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_nocommon: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nocommon, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_nocommon: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nocommon, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoCommonAttr *NoCommonAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nocommon: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nocommon, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_nocommon: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nocommon, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_nocommon: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nocommon, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoCommonAttr::NoCommonAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoCommon, /*IsLateParsed=*/false, false) { } NoCommonAttr *NoCommonAttr::clone(ASTContext &C) const { auto *A = new (C) NoCommonAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoCommonAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((nocommon"; OS << "))"; break; } case 1 : { OS << "[[gnu::nocommon"; OS << "]]"; break; } case 2 : { OS << "[[gnu::nocommon"; OS << "]]"; break; } } } const char *NoCommonAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "nocommon"; case 1: return "nocommon"; case 2: return "nocommon"; } } // NoConvergentAttr implementation NoConvergentAttr *NoConvergentAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoConvergentAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoConvergentAttr *NoConvergentAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoConvergentAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoConvergentAttr *NoConvergentAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_noconvergent: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_noconvergent: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_noconvergent: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_noconvergent: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoConvergentAttr *NoConvergentAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_noconvergent: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_noconvergent: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_noconvergent: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_noconvergent: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_noconvergent, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoConvergentAttr::NoConvergentAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoConvergent, /*IsLateParsed=*/false, false) { } NoConvergentAttr *NoConvergentAttr::clone(ASTContext &C) const { auto *A = new (C) NoConvergentAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoConvergentAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((noconvergent"; OS << "))"; break; } case 1 : { OS << "[[clang::noconvergent"; OS << "]]"; break; } case 2 : { OS << "[[clang::noconvergent"; OS << "]]"; break; } case 3 : { OS << "__declspec(noconvergent"; OS << ")"; break; } } } const char *NoConvergentAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "noconvergent"; case 1: return "noconvergent"; case 2: return "noconvergent"; case 3: return "noconvergent"; } } // NoDebugAttr implementation NoDebugAttr *NoDebugAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoDebugAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoDebugAttr *NoDebugAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoDebugAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoDebugAttr *NoDebugAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nodebug: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nodebug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_nodebug: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nodebug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_nodebug: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nodebug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoDebugAttr *NoDebugAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nodebug: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nodebug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_nodebug: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nodebug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_nodebug: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nodebug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoDebugAttr::NoDebugAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoDebug, /*IsLateParsed=*/false, false) { } NoDebugAttr *NoDebugAttr::clone(ASTContext &C) const { auto *A = new (C) NoDebugAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoDebugAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((nodebug"; OS << "))"; break; } case 1 : { OS << "[[gnu::nodebug"; OS << "]]"; break; } case 2 : { OS << "[[gnu::nodebug"; OS << "]]"; break; } } } const char *NoDebugAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "nodebug"; case 1: return "nodebug"; case 2: return "nodebug"; } } // NoDerefAttr implementation NoDerefAttr *NoDerefAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoDerefAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoDerefAttr *NoDerefAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoDerefAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoDerefAttr *NoDerefAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_noderef: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noderef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_noderef: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noderef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_noderef: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noderef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoDerefAttr *NoDerefAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_noderef: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noderef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_noderef: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noderef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_noderef: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noderef, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoDerefAttr::NoDerefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::NoDeref, /*IsLateParsed=*/false) { } NoDerefAttr *NoDerefAttr::clone(ASTContext &C) const { auto *A = new (C) NoDerefAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoDerefAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((noderef"; OS << "))"; break; } case 1 : { OS << "[[clang::noderef"; OS << "]]"; break; } case 2 : { OS << "[[clang::noderef"; OS << "]]"; break; } } } const char *NoDerefAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "noderef"; case 1: return "noderef"; case 2: return "noderef"; } } // NoDestroyAttr implementation NoDestroyAttr *NoDestroyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoDestroyAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoDestroyAttr *NoDestroyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoDestroyAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoDestroyAttr *NoDestroyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_destroy: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_no_destroy: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoDestroyAttr *NoDestroyAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_destroy: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_no_destroy: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_destroy, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoDestroyAttr::NoDestroyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoDestroy, /*IsLateParsed=*/false, false) { } NoDestroyAttr *NoDestroyAttr::clone(ASTContext &C) const { auto *A = new (C) NoDestroyAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoDestroyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((no_destroy"; OS << "))"; break; } case 1 : { OS << "[[clang::no_destroy"; OS << "]]"; break; } } } const char *NoDestroyAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "no_destroy"; case 1: return "no_destroy"; } } // NoDuplicateAttr implementation NoDuplicateAttr *NoDuplicateAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoDuplicateAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoDuplicateAttr *NoDuplicateAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoDuplicateAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoDuplicateAttr *NoDuplicateAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_noduplicate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noduplicate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_noduplicate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noduplicate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_noduplicate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noduplicate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoDuplicateAttr *NoDuplicateAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_noduplicate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noduplicate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_noduplicate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noduplicate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_noduplicate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noduplicate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoDuplicateAttr::NoDuplicateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoDuplicate, /*IsLateParsed=*/false, false) { } NoDuplicateAttr *NoDuplicateAttr::clone(ASTContext &C) const { auto *A = new (C) NoDuplicateAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoDuplicateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((noduplicate"; OS << "))"; break; } case 1 : { OS << "[[clang::noduplicate"; OS << "]]"; break; } case 2 : { OS << "[[clang::noduplicate"; OS << "]]"; break; } } } const char *NoDuplicateAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "noduplicate"; case 1: return "noduplicate"; case 2: return "noduplicate"; } } // NoEscapeAttr implementation NoEscapeAttr *NoEscapeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoEscapeAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoEscapeAttr *NoEscapeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoEscapeAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoEscapeAttr *NoEscapeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_noescape: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noescape, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_noescape: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noescape, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_noescape: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noescape, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoEscapeAttr *NoEscapeAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_noescape: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noescape, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_noescape: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noescape, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_noescape: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noescape, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoEscapeAttr::NoEscapeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::NoEscape, /*IsLateParsed=*/false) { } NoEscapeAttr *NoEscapeAttr::clone(ASTContext &C) const { auto *A = new (C) NoEscapeAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoEscapeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((noescape"; OS << "))"; break; } case 1 : { OS << "[[clang::noescape"; OS << "]]"; break; } case 2 : { OS << "[[clang::noescape"; OS << "]]"; break; } } } const char *NoEscapeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "noescape"; case 1: return "noescape"; case 2: return "noescape"; } } // NoInlineAttr implementation NoInlineAttr *NoInlineAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoInlineAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoInlineAttr *NoInlineAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoInlineAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoInlineAttr *NoInlineAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_msvc_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_msvc_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_msvc_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_msvc_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoInlineAttr *NoInlineAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_msvc_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_msvc_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_msvc_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_msvc_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_noinline: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_noinline, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoInlineAttr::NoInlineAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : DeclOrStmtAttr(Ctx, CommonInfo, attr::NoInline, /*IsLateParsed=*/false, false) { } NoInlineAttr *NoInlineAttr::clone(ASTContext &C) const { auto *A = new (C) NoInlineAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoInlineAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__noinline__"; OS << ""; break; } case 1 : { OS << "__attribute__((noinline"; OS << "))"; break; } case 2 : { OS << "[[gnu::noinline"; OS << "]]"; break; } case 3 : { OS << "[[gnu::noinline"; OS << "]]"; break; } case 4 : { OS << "[[clang::noinline"; OS << "]]"; break; } case 5 : { OS << "[[clang::noinline"; OS << "]]"; break; } case 6 : { OS << "[[msvc::noinline"; OS << "]]"; break; } case 7 : { OS << "[[msvc::noinline"; OS << "]]"; break; } case 8 : { OS << "__declspec(noinline"; OS << ")"; break; } } } const char *NoInlineAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__noinline__"; case 1: return "noinline"; case 2: return "noinline"; case 3: return "noinline"; case 4: return "noinline"; case 5: return "noinline"; case 6: return "noinline"; case 7: return "noinline"; case 8: return "noinline"; } } // NoInstrumentFunctionAttr implementation NoInstrumentFunctionAttr *NoInstrumentFunctionAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoInstrumentFunctionAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoInstrumentFunctionAttr *NoInstrumentFunctionAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoInstrumentFunctionAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoInstrumentFunctionAttr *NoInstrumentFunctionAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_instrument_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_no_instrument_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_no_instrument_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoInstrumentFunctionAttr *NoInstrumentFunctionAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_instrument_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_no_instrument_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_no_instrument_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoInstrumentFunctionAttr::NoInstrumentFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoInstrumentFunction, /*IsLateParsed=*/false, false) { } NoInstrumentFunctionAttr *NoInstrumentFunctionAttr::clone(ASTContext &C) const { auto *A = new (C) NoInstrumentFunctionAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoInstrumentFunctionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((no_instrument_function"; OS << "))"; break; } case 1 : { OS << "[[gnu::no_instrument_function"; OS << "]]"; break; } case 2 : { OS << "[[gnu::no_instrument_function"; OS << "]]"; break; } } } const char *NoInstrumentFunctionAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "no_instrument_function"; case 1: return "no_instrument_function"; case 2: return "no_instrument_function"; } } // NoMergeAttr implementation NoMergeAttr *NoMergeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoMergeAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoMergeAttr *NoMergeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoMergeAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoMergeAttr *NoMergeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nomerge: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nomerge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_nomerge: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nomerge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_nomerge: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nomerge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoMergeAttr *NoMergeAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nomerge: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nomerge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_nomerge: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nomerge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_nomerge: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nomerge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoMergeAttr::NoMergeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : DeclOrStmtAttr(Ctx, CommonInfo, attr::NoMerge, /*IsLateParsed=*/false, false) { } NoMergeAttr *NoMergeAttr::clone(ASTContext &C) const { auto *A = new (C) NoMergeAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoMergeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((nomerge"; OS << "))"; break; } case 1 : { OS << "[[clang::nomerge"; OS << "]]"; break; } case 2 : { OS << "[[clang::nomerge"; OS << "]]"; break; } } } const char *NoMergeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "nomerge"; case 1: return "nomerge"; case 2: return "nomerge"; } } // NoMicroMipsAttr implementation NoMicroMipsAttr *NoMicroMipsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoMicroMipsAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoMicroMipsAttr *NoMicroMipsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoMicroMipsAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoMicroMipsAttr *NoMicroMipsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nomicromips: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nomicromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_nomicromips: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nomicromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_nomicromips: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nomicromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoMicroMipsAttr *NoMicroMipsAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nomicromips: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nomicromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_nomicromips: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nomicromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_nomicromips: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nomicromips, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoMicroMipsAttr::NoMicroMipsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoMicroMips, /*IsLateParsed=*/false, false) { } NoMicroMipsAttr *NoMicroMipsAttr::clone(ASTContext &C) const { auto *A = new (C) NoMicroMipsAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoMicroMipsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((nomicromips"; OS << "))"; break; } case 1 : { OS << "[[gnu::nomicromips"; OS << "]]"; break; } case 2 : { OS << "[[gnu::nomicromips"; OS << "]]"; break; } } } const char *NoMicroMipsAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "nomicromips"; case 1: return "nomicromips"; case 2: return "nomicromips"; } } // NoMips16Attr implementation NoMips16Attr *NoMips16Attr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoMips16Attr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoMips16Attr *NoMips16Attr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoMips16Attr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoMips16Attr *NoMips16Attr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nomips16: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nomips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_nomips16: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nomips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_nomips16: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nomips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoMips16Attr *NoMips16Attr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nomips16: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nomips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_nomips16: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nomips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_nomips16: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nomips16, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoMips16Attr::NoMips16Attr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoMips16, /*IsLateParsed=*/false, false) { } NoMips16Attr *NoMips16Attr::clone(ASTContext &C) const { auto *A = new (C) NoMips16Attr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoMips16Attr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((nomips16"; OS << "))"; break; } case 1 : { OS << "[[gnu::nomips16"; OS << "]]"; break; } case 2 : { OS << "[[gnu::nomips16"; OS << "]]"; break; } } } const char *NoMips16Attr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "nomips16"; case 1: return "nomips16"; case 2: return "nomips16"; } } // NoProfileFunctionAttr implementation NoProfileFunctionAttr *NoProfileFunctionAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoProfileFunctionAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoProfileFunctionAttr *NoProfileFunctionAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoProfileFunctionAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoProfileFunctionAttr *NoProfileFunctionAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_profile_instrument_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_profile_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_no_profile_instrument_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_profile_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_no_profile_instrument_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_profile_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoProfileFunctionAttr *NoProfileFunctionAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_profile_instrument_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_profile_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_no_profile_instrument_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_profile_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_no_profile_instrument_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_profile_instrument_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoProfileFunctionAttr::NoProfileFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoProfileFunction, /*IsLateParsed=*/false, false) { } NoProfileFunctionAttr *NoProfileFunctionAttr::clone(ASTContext &C) const { auto *A = new (C) NoProfileFunctionAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoProfileFunctionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((no_profile_instrument_function"; OS << "))"; break; } case 1 : { OS << "[[gnu::no_profile_instrument_function"; OS << "]]"; break; } case 2 : { OS << "[[gnu::no_profile_instrument_function"; OS << "]]"; break; } } } const char *NoProfileFunctionAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "no_profile_instrument_function"; case 1: return "no_profile_instrument_function"; case 2: return "no_profile_instrument_function"; } } // NoRandomizeLayoutAttr implementation NoRandomizeLayoutAttr *NoRandomizeLayoutAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoRandomizeLayoutAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoRandomizeLayoutAttr *NoRandomizeLayoutAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoRandomizeLayoutAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoRandomizeLayoutAttr *NoRandomizeLayoutAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_randomize_layout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_no_randomize_layout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_no_randomize_layout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoRandomizeLayoutAttr *NoRandomizeLayoutAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_randomize_layout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_no_randomize_layout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_no_randomize_layout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoRandomizeLayoutAttr::NoRandomizeLayoutAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoRandomizeLayout, /*IsLateParsed=*/false, false) { } NoRandomizeLayoutAttr *NoRandomizeLayoutAttr::clone(ASTContext &C) const { auto *A = new (C) NoRandomizeLayoutAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoRandomizeLayoutAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((no_randomize_layout"; OS << "))"; break; } case 1 : { OS << "[[gnu::no_randomize_layout"; OS << "]]"; break; } case 2 : { OS << "[[gnu::no_randomize_layout"; OS << "]]"; break; } } } const char *NoRandomizeLayoutAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "no_randomize_layout"; case 1: return "no_randomize_layout"; case 2: return "no_randomize_layout"; } } // NoReturnAttr implementation NoReturnAttr *NoReturnAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoReturnAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoReturnAttr *NoReturnAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoReturnAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoReturnAttr *NoReturnAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_noreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_noreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_noreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_noreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoReturnAttr *NoReturnAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_noreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_noreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_noreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_noreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_noreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoReturnAttr::NoReturnAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoReturn, /*IsLateParsed=*/false, false) { } NoReturnAttr *NoReturnAttr::clone(ASTContext &C) const { auto *A = new (C) NoReturnAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoReturnAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((noreturn"; OS << "))"; break; } case 1 : { OS << "[[gnu::noreturn"; OS << "]]"; break; } case 2 : { OS << "[[gnu::noreturn"; OS << "]]"; break; } case 3 : { OS << "__declspec(noreturn"; OS << ")"; break; } } } const char *NoReturnAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "noreturn"; case 1: return "noreturn"; case 2: return "noreturn"; case 3: return "noreturn"; } } // NoSanitizeAttr implementation NoSanitizeAttr *NoSanitizeAttr::CreateImplicit(ASTContext &Ctx, StringRef *Sanitizers, unsigned SanitizersSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoSanitizeAttr(Ctx, CommonInfo, Sanitizers, SanitizersSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoSanitizeAttr *NoSanitizeAttr::Create(ASTContext &Ctx, StringRef *Sanitizers, unsigned SanitizersSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoSanitizeAttr(Ctx, CommonInfo, Sanitizers, SanitizersSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoSanitizeAttr *NoSanitizeAttr::CreateImplicit(ASTContext &Ctx, StringRef *Sanitizers, unsigned SanitizersSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_sanitize: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_sanitize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_no_sanitize: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_sanitize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_no_sanitize: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_sanitize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Sanitizers, SanitizersSize, I); } NoSanitizeAttr *NoSanitizeAttr::Create(ASTContext &Ctx, StringRef *Sanitizers, unsigned SanitizersSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_sanitize: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_sanitize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_no_sanitize: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_sanitize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_no_sanitize: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_sanitize, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Sanitizers, SanitizersSize, I); } NoSanitizeAttr::NoSanitizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , StringRef *Sanitizers, unsigned SanitizersSize ) : InheritableAttr(Ctx, CommonInfo, attr::NoSanitize, /*IsLateParsed=*/false, false) , sanitizers_Size(SanitizersSize), sanitizers_(new (Ctx, 16) StringRef[sanitizers_Size]) { for (size_t I = 0, E = sanitizers_Size; I != E; ++I) { StringRef Ref = Sanitizers[I]; if (!Ref.empty()) { char *Mem = new (Ctx, 1) char[Ref.size()]; std::memcpy(Mem, Ref.data(), Ref.size()); sanitizers_[I] = StringRef(Mem, Ref.size()); } } } NoSanitizeAttr::NoSanitizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoSanitize, /*IsLateParsed=*/false, false) , sanitizers_Size(0), sanitizers_(nullptr) { } NoSanitizeAttr *NoSanitizeAttr::clone(ASTContext &C) const { auto *A = new (C) NoSanitizeAttr(C, *this, sanitizers_, sanitizers_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoSanitizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((no_sanitize"; OS << ""; for (const auto &Val : sanitizers()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::no_sanitize"; OS << ""; for (const auto &Val : sanitizers()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::no_sanitize"; OS << ""; for (const auto &Val : sanitizers()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *NoSanitizeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "no_sanitize"; case 1: return "no_sanitize"; case 2: return "no_sanitize"; } } // NoSpeculativeLoadHardeningAttr implementation NoSpeculativeLoadHardeningAttr *NoSpeculativeLoadHardeningAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoSpeculativeLoadHardeningAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoSpeculativeLoadHardeningAttr *NoSpeculativeLoadHardeningAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoSpeculativeLoadHardeningAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoSpeculativeLoadHardeningAttr *NoSpeculativeLoadHardeningAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_speculative_load_hardening: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_no_speculative_load_hardening: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_no_speculative_load_hardening: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoSpeculativeLoadHardeningAttr *NoSpeculativeLoadHardeningAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_speculative_load_hardening: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_no_speculative_load_hardening: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_no_speculative_load_hardening: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoSpeculativeLoadHardeningAttr::NoSpeculativeLoadHardeningAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoSpeculativeLoadHardening, /*IsLateParsed=*/false, false) { } NoSpeculativeLoadHardeningAttr *NoSpeculativeLoadHardeningAttr::clone(ASTContext &C) const { auto *A = new (C) NoSpeculativeLoadHardeningAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoSpeculativeLoadHardeningAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((no_speculative_load_hardening"; OS << "))"; break; } case 1 : { OS << "[[clang::no_speculative_load_hardening"; OS << "]]"; break; } case 2 : { OS << "[[clang::no_speculative_load_hardening"; OS << "]]"; break; } } } const char *NoSpeculativeLoadHardeningAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "no_speculative_load_hardening"; case 1: return "no_speculative_load_hardening"; case 2: return "no_speculative_load_hardening"; } } // NoSplitStackAttr implementation NoSplitStackAttr *NoSplitStackAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoSplitStackAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoSplitStackAttr *NoSplitStackAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoSplitStackAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoSplitStackAttr *NoSplitStackAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_split_stack: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_split_stack, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_no_split_stack: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_split_stack, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_no_split_stack: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_split_stack, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoSplitStackAttr *NoSplitStackAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_split_stack: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_split_stack, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_no_split_stack: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_split_stack, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_no_split_stack: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_split_stack, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoSplitStackAttr::NoSplitStackAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoSplitStack, /*IsLateParsed=*/false, false) { } NoSplitStackAttr *NoSplitStackAttr::clone(ASTContext &C) const { auto *A = new (C) NoSplitStackAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoSplitStackAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((no_split_stack"; OS << "))"; break; } case 1 : { OS << "[[gnu::no_split_stack"; OS << "]]"; break; } case 2 : { OS << "[[gnu::no_split_stack"; OS << "]]"; break; } } } const char *NoSplitStackAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "no_split_stack"; case 1: return "no_split_stack"; case 2: return "no_split_stack"; } } // NoStackProtectorAttr implementation NoStackProtectorAttr *NoStackProtectorAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoStackProtectorAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoStackProtectorAttr *NoStackProtectorAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoStackProtectorAttr(Ctx, CommonInfo); return A; } NoStackProtectorAttr *NoStackProtectorAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_stack_protector: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_no_stack_protector: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_no_stack_protector: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_no_stack_protector: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_no_stack_protector: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_safebuffers: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_safebuffers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoStackProtectorAttr *NoStackProtectorAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_stack_protector: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_no_stack_protector: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_no_stack_protector: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_no_stack_protector: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_no_stack_protector: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_no_stack_protector, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_safebuffers: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_safebuffers, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoStackProtectorAttr::NoStackProtectorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoStackProtector, /*IsLateParsed=*/false, false) { } NoStackProtectorAttr::Spelling NoStackProtectorAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_no_stack_protector; case 1: return CXX11_clang_no_stack_protector; case 2: return C23_clang_no_stack_protector; case 3: return CXX11_gnu_no_stack_protector; case 4: return C23_gnu_no_stack_protector; case 5: return Declspec_safebuffers; } } NoStackProtectorAttr *NoStackProtectorAttr::clone(ASTContext &C) const { auto *A = new (C) NoStackProtectorAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoStackProtectorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((no_stack_protector"; OS << "))"; break; } case 1 : { OS << "[[clang::no_stack_protector"; OS << "]]"; break; } case 2 : { OS << "[[clang::no_stack_protector"; OS << "]]"; break; } case 3 : { OS << "[[gnu::no_stack_protector"; OS << "]]"; break; } case 4 : { OS << "[[gnu::no_stack_protector"; OS << "]]"; break; } case 5 : { OS << "__declspec(safebuffers"; OS << ")"; break; } } } const char *NoStackProtectorAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "no_stack_protector"; case 1: return "no_stack_protector"; case 2: return "no_stack_protector"; case 3: return "no_stack_protector"; case 4: return "no_stack_protector"; case 5: return "safebuffers"; } } // NoThreadSafetyAnalysisAttr implementation NoThreadSafetyAnalysisAttr *NoThreadSafetyAnalysisAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoThreadSafetyAnalysisAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoThreadSafetyAnalysisAttr *NoThreadSafetyAnalysisAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoThreadSafetyAnalysisAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoThreadSafetyAnalysisAttr *NoThreadSafetyAnalysisAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_thread_safety_analysis: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_thread_safety_analysis, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_no_thread_safety_analysis: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_thread_safety_analysis, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_no_thread_safety_analysis: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_thread_safety_analysis, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoThreadSafetyAnalysisAttr *NoThreadSafetyAnalysisAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_no_thread_safety_analysis: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_no_thread_safety_analysis, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_no_thread_safety_analysis: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_no_thread_safety_analysis, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_no_thread_safety_analysis: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_no_thread_safety_analysis, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoThreadSafetyAnalysisAttr::NoThreadSafetyAnalysisAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoThreadSafetyAnalysis, /*IsLateParsed=*/false, false) { } NoThreadSafetyAnalysisAttr *NoThreadSafetyAnalysisAttr::clone(ASTContext &C) const { auto *A = new (C) NoThreadSafetyAnalysisAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoThreadSafetyAnalysisAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((no_thread_safety_analysis"; OS << "))"; break; } case 1 : { OS << "[[clang::no_thread_safety_analysis"; OS << "]]"; break; } case 2 : { OS << "[[clang::no_thread_safety_analysis"; OS << "]]"; break; } } } const char *NoThreadSafetyAnalysisAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "no_thread_safety_analysis"; case 1: return "no_thread_safety_analysis"; case 2: return "no_thread_safety_analysis"; } } // NoThrowAttr implementation NoThrowAttr *NoThrowAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoThrowAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoThrowAttr *NoThrowAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoThrowAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoThrowAttr *NoThrowAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nothrow: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_nothrow: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_nothrow: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_nothrow: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoThrowAttr *NoThrowAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nothrow: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_nothrow: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_nothrow: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_nothrow: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_nothrow, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoThrowAttr::NoThrowAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoThrow, /*IsLateParsed=*/false, false) { } NoThrowAttr *NoThrowAttr::clone(ASTContext &C) const { auto *A = new (C) NoThrowAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoThrowAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((nothrow"; OS << "))"; break; } case 1 : { OS << "[[gnu::nothrow"; OS << "]]"; break; } case 2 : { OS << "[[gnu::nothrow"; OS << "]]"; break; } case 3 : { OS << "__declspec(nothrow"; OS << ")"; break; } } } const char *NoThrowAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "nothrow"; case 1: return "nothrow"; case 2: return "nothrow"; case 3: return "nothrow"; } } // NoUniqueAddressAttr implementation NoUniqueAddressAttr *NoUniqueAddressAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoUniqueAddressAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoUniqueAddressAttr *NoUniqueAddressAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoUniqueAddressAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoUniqueAddressAttr *NoUniqueAddressAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_no_unique_address: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_no_unique_address, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_msvc_no_unique_address: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_msvc_no_unique_address, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoUniqueAddressAttr *NoUniqueAddressAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_no_unique_address: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_no_unique_address, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_msvc_no_unique_address: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_msvc_no_unique_address, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoUniqueAddressAttr::NoUniqueAddressAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoUniqueAddress, /*IsLateParsed=*/false, false) { } NoUniqueAddressAttr *NoUniqueAddressAttr::clone(ASTContext &C) const { auto *A = new (C) NoUniqueAddressAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoUniqueAddressAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[no_unique_address"; OS << "]]"; break; } case 1 : { OS << "[[msvc::no_unique_address"; OS << "]]"; break; } } } const char *NoUniqueAddressAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "no_unique_address"; case 1: return "no_unique_address"; } } // NoUwtableAttr implementation NoUwtableAttr *NoUwtableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoUwtableAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoUwtableAttr *NoUwtableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NoUwtableAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NoUwtableAttr *NoUwtableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nouwtable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nouwtable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_nouwtable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nouwtable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_nouwtable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nouwtable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NoUwtableAttr *NoUwtableAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nouwtable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nouwtable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_nouwtable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nouwtable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_nouwtable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nouwtable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NoUwtableAttr::NoUwtableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NoUwtable, /*IsLateParsed=*/false, false) { } NoUwtableAttr *NoUwtableAttr::clone(ASTContext &C) const { auto *A = new (C) NoUwtableAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NoUwtableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((nouwtable"; OS << "))"; break; } case 1 : { OS << "[[clang::nouwtable"; OS << "]]"; break; } case 2 : { OS << "[[clang::nouwtable"; OS << "]]"; break; } } } const char *NoUwtableAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "nouwtable"; case 1: return "nouwtable"; case 2: return "nouwtable"; } } // NonAllocatingAttr implementation NonAllocatingAttr *NonAllocatingAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NonAllocatingAttr(Ctx, CommonInfo, Cond); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NonAllocatingAttr *NonAllocatingAttr::Create(ASTContext &Ctx, Expr * Cond, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NonAllocatingAttr(Ctx, CommonInfo, Cond); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NonAllocatingAttr *NonAllocatingAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nonallocating: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nonallocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_nonallocating: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nonallocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_nonallocating: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nonallocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Cond, I); } NonAllocatingAttr *NonAllocatingAttr::Create(ASTContext &Ctx, Expr * Cond, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nonallocating: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nonallocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_nonallocating: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nonallocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_nonallocating: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nonallocating, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Cond, I); } NonAllocatingAttr::NonAllocatingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Cond ) : TypeAttr(Ctx, CommonInfo, attr::NonAllocating, /*IsLateParsed=*/false) , cond(Cond) { } NonAllocatingAttr::NonAllocatingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::NonAllocating, /*IsLateParsed=*/false) , cond() { } NonAllocatingAttr *NonAllocatingAttr::clone(ASTContext &C) const { auto *A = new (C) NonAllocatingAttr(C, *this, cond); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NonAllocatingAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((nonallocating"; if (!getCond()) ++TrailingOmittedArgs; if (!(!getCond())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getCond()->printPretty(OS, nullptr, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::nonallocating"; if (!getCond()) ++TrailingOmittedArgs; if (!(!getCond())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getCond()->printPretty(OS, nullptr, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::nonallocating"; if (!getCond()) ++TrailingOmittedArgs; if (!(!getCond())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getCond()->printPretty(OS, nullptr, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *NonAllocatingAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "nonallocating"; case 1: return "nonallocating"; case 2: return "nonallocating"; } } // NonBlockingAttr implementation NonBlockingAttr *NonBlockingAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NonBlockingAttr(Ctx, CommonInfo, Cond); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NonBlockingAttr *NonBlockingAttr::Create(ASTContext &Ctx, Expr * Cond, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NonBlockingAttr(Ctx, CommonInfo, Cond); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NonBlockingAttr *NonBlockingAttr::CreateImplicit(ASTContext &Ctx, Expr * Cond, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nonblocking: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nonblocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_nonblocking: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nonblocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_nonblocking: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nonblocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Cond, I); } NonBlockingAttr *NonBlockingAttr::Create(ASTContext &Ctx, Expr * Cond, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nonblocking: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nonblocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_nonblocking: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_nonblocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_nonblocking: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_nonblocking, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Cond, I); } NonBlockingAttr::NonBlockingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Cond ) : TypeAttr(Ctx, CommonInfo, attr::NonBlocking, /*IsLateParsed=*/false) , cond(Cond) { } NonBlockingAttr::NonBlockingAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::NonBlocking, /*IsLateParsed=*/false) , cond() { } NonBlockingAttr *NonBlockingAttr::clone(ASTContext &C) const { auto *A = new (C) NonBlockingAttr(C, *this, cond); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NonBlockingAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((nonblocking"; if (!getCond()) ++TrailingOmittedArgs; if (!(!getCond())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getCond()->printPretty(OS, nullptr, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::nonblocking"; if (!getCond()) ++TrailingOmittedArgs; if (!(!getCond())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getCond()->printPretty(OS, nullptr, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::nonblocking"; if (!getCond()) ++TrailingOmittedArgs; if (!(!getCond())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getCond()->printPretty(OS, nullptr, Policy); OS << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *NonBlockingAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "nonblocking"; case 1: return "nonblocking"; case 2: return "nonblocking"; } } // NonNullAttr implementation NonNullAttr *NonNullAttr::CreateImplicit(ASTContext &Ctx, ParamIdx *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NonNullAttr(Ctx, CommonInfo, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NonNullAttr *NonNullAttr::Create(ASTContext &Ctx, ParamIdx *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NonNullAttr(Ctx, CommonInfo, Args, ArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NonNullAttr *NonNullAttr::CreateImplicit(ASTContext &Ctx, ParamIdx *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nonnull: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_nonnull: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_nonnull: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Args, ArgsSize, I); } NonNullAttr *NonNullAttr::Create(ASTContext &Ctx, ParamIdx *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_nonnull: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_nonnull: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_nonnull: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Args, ArgsSize, I); } NonNullAttr::NonNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , ParamIdx *Args, unsigned ArgsSize ) : InheritableParamAttr(Ctx, CommonInfo, attr::NonNull, /*IsLateParsed=*/false, true) , args_Size(ArgsSize), args_(new (Ctx, 16) ParamIdx[args_Size]) { std::copy(Args, Args + args_Size, args_); } NonNullAttr::NonNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableParamAttr(Ctx, CommonInfo, attr::NonNull, /*IsLateParsed=*/false, true) , args_Size(0), args_(nullptr) { } NonNullAttr *NonNullAttr::clone(ASTContext &C) const { auto *A = new (C) NonNullAttr(C, *this, args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NonNullAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((nonnull"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val.getSourceIndex(); } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::nonnull"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val.getSourceIndex(); } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::nonnull"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val.getSourceIndex(); } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *NonNullAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "nonnull"; case 1: return "nonnull"; case 2: return "nonnull"; } } // NotTailCalledAttr implementation NotTailCalledAttr *NotTailCalledAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NotTailCalledAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NotTailCalledAttr *NotTailCalledAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) NotTailCalledAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } NotTailCalledAttr *NotTailCalledAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_not_tail_called: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_not_tail_called, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_not_tail_called: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_not_tail_called, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_not_tail_called: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_not_tail_called, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } NotTailCalledAttr *NotTailCalledAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_not_tail_called: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_not_tail_called, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_not_tail_called: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_not_tail_called, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_not_tail_called: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_not_tail_called, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } NotTailCalledAttr::NotTailCalledAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::NotTailCalled, /*IsLateParsed=*/false, false) { } NotTailCalledAttr *NotTailCalledAttr::clone(ASTContext &C) const { auto *A = new (C) NotTailCalledAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void NotTailCalledAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((not_tail_called"; OS << "))"; break; } case 1 : { OS << "[[clang::not_tail_called"; OS << "]]"; break; } case 2 : { OS << "[[clang::not_tail_called"; OS << "]]"; break; } } } const char *NotTailCalledAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "not_tail_called"; case 1: return "not_tail_called"; case 2: return "not_tail_called"; } } // OMPAllocateDeclAttr implementation OMPAllocateDeclAttr *OMPAllocateDeclAttr::CreateImplicit(ASTContext &Ctx, OMPAllocateDeclAttr::AllocatorTypeTy AllocatorType, Expr * Allocator, Expr * Alignment, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPAllocateDeclAttr(Ctx, CommonInfo, AllocatorType, Allocator, Alignment); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPAllocateDeclAttr *OMPAllocateDeclAttr::Create(ASTContext &Ctx, OMPAllocateDeclAttr::AllocatorTypeTy AllocatorType, Expr * Allocator, Expr * Alignment, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPAllocateDeclAttr(Ctx, CommonInfo, AllocatorType, Allocator, Alignment); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPAllocateDeclAttr *OMPAllocateDeclAttr::CreateImplicit(ASTContext &Ctx, OMPAllocateDeclAttr::AllocatorTypeTy AllocatorType, Expr * Allocator, Expr * Alignment, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, AllocatorType, Allocator, Alignment, I); } OMPAllocateDeclAttr *OMPAllocateDeclAttr::Create(ASTContext &Ctx, OMPAllocateDeclAttr::AllocatorTypeTy AllocatorType, Expr * Allocator, Expr * Alignment, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, AllocatorType, Allocator, Alignment, I); } OMPAllocateDeclAttr::OMPAllocateDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , OMPAllocateDeclAttr::AllocatorTypeTy AllocatorType , Expr * Allocator , Expr * Alignment ) : InheritableAttr(Ctx, CommonInfo, attr::OMPAllocateDecl, /*IsLateParsed=*/false, false) , allocatorType(AllocatorType) , allocator(Allocator) , alignment(Alignment) { } bool OMPAllocateDeclAttr::ConvertStrToAllocatorTypeTy(StringRef Val, OMPAllocateDeclAttr::AllocatorTypeTy &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("omp_null_allocator", OMPAllocateDeclAttr::AllocatorTypeTy::OMPNullMemAlloc) .Case("omp_default_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPDefaultMemAlloc) .Case("omp_large_cap_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPLargeCapMemAlloc) .Case("omp_const_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPConstMemAlloc) .Case("omp_high_bw_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPHighBWMemAlloc) .Case("omp_low_lat_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPLowLatMemAlloc) .Case("omp_cgroup_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPCGroupMemAlloc) .Case("omp_pteam_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPPTeamMemAlloc) .Case("omp_thread_mem_alloc", OMPAllocateDeclAttr::AllocatorTypeTy::OMPThreadMemAlloc) .Case("", OMPAllocateDeclAttr::AllocatorTypeTy::OMPUserDefinedMemAlloc) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *OMPAllocateDeclAttr::ConvertAllocatorTypeTyToStr(OMPAllocateDeclAttr::AllocatorTypeTy Val) { switch(Val) { case OMPAllocateDeclAttr::AllocatorTypeTy::OMPNullMemAlloc: return "omp_null_allocator"; case OMPAllocateDeclAttr::AllocatorTypeTy::OMPDefaultMemAlloc: return "omp_default_mem_alloc"; case OMPAllocateDeclAttr::AllocatorTypeTy::OMPLargeCapMemAlloc: return "omp_large_cap_mem_alloc"; case OMPAllocateDeclAttr::AllocatorTypeTy::OMPConstMemAlloc: return "omp_const_mem_alloc"; case OMPAllocateDeclAttr::AllocatorTypeTy::OMPHighBWMemAlloc: return "omp_high_bw_mem_alloc"; case OMPAllocateDeclAttr::AllocatorTypeTy::OMPLowLatMemAlloc: return "omp_low_lat_mem_alloc"; case OMPAllocateDeclAttr::AllocatorTypeTy::OMPCGroupMemAlloc: return "omp_cgroup_mem_alloc"; case OMPAllocateDeclAttr::AllocatorTypeTy::OMPPTeamMemAlloc: return "omp_pteam_mem_alloc"; case OMPAllocateDeclAttr::AllocatorTypeTy::OMPThreadMemAlloc: return "omp_thread_mem_alloc"; case OMPAllocateDeclAttr::AllocatorTypeTy::OMPUserDefinedMemAlloc: return ""; } llvm_unreachable("No enumerator with that value"); } OMPAllocateDeclAttr *OMPAllocateDeclAttr::clone(ASTContext &C) const { auto *A = new (C) OMPAllocateDeclAttr(C, *this, allocatorType, allocator, alignment); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OMPAllocateDeclAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *OMPAllocateDeclAttr::getSpelling() const { return "(No spelling)"; } // OMPAssumeAttr implementation OMPAssumeAttr *OMPAssumeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Assumption, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPAssumeAttr(Ctx, CommonInfo, Assumption); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPAssumeAttr *OMPAssumeAttr::Create(ASTContext &Ctx, llvm::StringRef Assumption, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPAssumeAttr(Ctx, CommonInfo, Assumption); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPAssumeAttr *OMPAssumeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Assumption, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Assumption, I); } OMPAssumeAttr *OMPAssumeAttr::Create(ASTContext &Ctx, llvm::StringRef Assumption, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Assumption, I); } OMPAssumeAttr::OMPAssumeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Assumption ) : InheritableAttr(Ctx, CommonInfo, attr::OMPAssume, /*IsLateParsed=*/false, true) , assumptionLength(Assumption.size()),assumption(new (Ctx, 1) char[assumptionLength]) { if (!Assumption.empty()) std::memcpy(assumption, Assumption.data(), assumptionLength); } OMPAssumeAttr *OMPAssumeAttr::clone(ASTContext &C) const { auto *A = new (C) OMPAssumeAttr(C, *this, getAssumption()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OMPAssumeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[omp::assume"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getAssumption() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *OMPAssumeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "assume"; } } // OMPCaptureKindAttr implementation OMPCaptureKindAttr *OMPCaptureKindAttr::CreateImplicit(ASTContext &Ctx, unsigned CaptureKindVal, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPCaptureKindAttr(Ctx, CommonInfo, CaptureKindVal); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPCaptureKindAttr *OMPCaptureKindAttr::Create(ASTContext &Ctx, unsigned CaptureKindVal, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPCaptureKindAttr(Ctx, CommonInfo, CaptureKindVal); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPCaptureKindAttr *OMPCaptureKindAttr::CreateImplicit(ASTContext &Ctx, unsigned CaptureKindVal, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, CaptureKindVal, I); } OMPCaptureKindAttr *OMPCaptureKindAttr::Create(ASTContext &Ctx, unsigned CaptureKindVal, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, CaptureKindVal, I); } OMPCaptureKindAttr::OMPCaptureKindAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned CaptureKindVal ) : Attr(Ctx, CommonInfo, attr::OMPCaptureKind, /*IsLateParsed=*/false) , captureKindVal(CaptureKindVal) { } OMPCaptureKindAttr *OMPCaptureKindAttr::clone(ASTContext &C) const { auto *A = new (C) OMPCaptureKindAttr(C, *this, captureKindVal); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OMPCaptureKindAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *OMPCaptureKindAttr::getSpelling() const { return "(No spelling)"; } // OMPCaptureNoInitAttr implementation OMPCaptureNoInitAttr *OMPCaptureNoInitAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPCaptureNoInitAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPCaptureNoInitAttr *OMPCaptureNoInitAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPCaptureNoInitAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPCaptureNoInitAttr *OMPCaptureNoInitAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, I); } OMPCaptureNoInitAttr *OMPCaptureNoInitAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, I); } OMPCaptureNoInitAttr::OMPCaptureNoInitAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::OMPCaptureNoInit, /*IsLateParsed=*/false, false) { } OMPCaptureNoInitAttr *OMPCaptureNoInitAttr::clone(ASTContext &C) const { auto *A = new (C) OMPCaptureNoInitAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OMPCaptureNoInitAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *OMPCaptureNoInitAttr::getSpelling() const { return "(No spelling)"; } // OMPDeclareSimdDeclAttr implementation 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) { auto *A = new (Ctx) OMPDeclareSimdDeclAttr(Ctx, CommonInfo, BranchState, Simdlen, Uniforms, UniformsSize, Aligneds, AlignedsSize, Alignments, AlignmentsSize, Linears, LinearsSize, Modifiers, ModifiersSize, Steps, StepsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } 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) { auto *A = new (Ctx) OMPDeclareSimdDeclAttr(Ctx, CommonInfo, BranchState, Simdlen, Uniforms, UniformsSize, Aligneds, AlignedsSize, Alignments, AlignmentsSize, Linears, LinearsSize, Modifiers, ModifiersSize, Steps, StepsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } 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) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, BranchState, Simdlen, Uniforms, UniformsSize, Aligneds, AlignedsSize, Alignments, AlignmentsSize, Linears, LinearsSize, Modifiers, ModifiersSize, Steps, StepsSize, I); } 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) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, BranchState, Simdlen, Uniforms, UniformsSize, Aligneds, AlignedsSize, Alignments, AlignmentsSize, Linears, LinearsSize, Modifiers, ModifiersSize, Steps, StepsSize, I); } OMPDeclareSimdDeclAttr::OMPDeclareSimdDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , 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 ) : Attr(Ctx, CommonInfo, attr::OMPDeclareSimdDecl, /*IsLateParsed=*/false) , branchState(BranchState) , simdlen(Simdlen) , uniforms_Size(UniformsSize), uniforms_(new (Ctx, 16) Expr *[uniforms_Size]) , aligneds_Size(AlignedsSize), aligneds_(new (Ctx, 16) Expr *[aligneds_Size]) , alignments_Size(AlignmentsSize), alignments_(new (Ctx, 16) Expr *[alignments_Size]) , linears_Size(LinearsSize), linears_(new (Ctx, 16) Expr *[linears_Size]) , modifiers_Size(ModifiersSize), modifiers_(new (Ctx, 16) unsigned[modifiers_Size]) , steps_Size(StepsSize), steps_(new (Ctx, 16) Expr *[steps_Size]) { std::copy(Uniforms, Uniforms + uniforms_Size, uniforms_); std::copy(Aligneds, Aligneds + aligneds_Size, aligneds_); std::copy(Alignments, Alignments + alignments_Size, alignments_); std::copy(Linears, Linears + linears_Size, linears_); std::copy(Modifiers, Modifiers + modifiers_Size, modifiers_); std::copy(Steps, Steps + steps_Size, steps_); } OMPDeclareSimdDeclAttr::OMPDeclareSimdDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , OMPDeclareSimdDeclAttr::BranchStateTy BranchState , Expr * Simdlen ) : Attr(Ctx, CommonInfo, attr::OMPDeclareSimdDecl, /*IsLateParsed=*/false) , branchState(BranchState) , simdlen(Simdlen) , uniforms_Size(0), uniforms_(nullptr) , aligneds_Size(0), aligneds_(nullptr) , alignments_Size(0), alignments_(nullptr) , linears_Size(0), linears_(nullptr) , modifiers_Size(0), modifiers_(nullptr) , steps_Size(0), steps_(nullptr) { } bool OMPDeclareSimdDeclAttr::ConvertStrToBranchStateTy(StringRef Val, OMPDeclareSimdDeclAttr::BranchStateTy &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("", OMPDeclareSimdDeclAttr::BranchStateTy::BS_Undefined) .Case("inbranch", OMPDeclareSimdDeclAttr::BranchStateTy::BS_Inbranch) .Case("notinbranch", OMPDeclareSimdDeclAttr::BranchStateTy::BS_Notinbranch) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *OMPDeclareSimdDeclAttr::ConvertBranchStateTyToStr(OMPDeclareSimdDeclAttr::BranchStateTy Val) { switch(Val) { case OMPDeclareSimdDeclAttr::BranchStateTy::BS_Undefined: return ""; case OMPDeclareSimdDeclAttr::BranchStateTy::BS_Inbranch: return "inbranch"; case OMPDeclareSimdDeclAttr::BranchStateTy::BS_Notinbranch: return "notinbranch"; } llvm_unreachable("No enumerator with that value"); } OMPDeclareSimdDeclAttr *OMPDeclareSimdDeclAttr::clone(ASTContext &C) const { 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); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OMPDeclareSimdDeclAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "#pragma omp declare simd"; printPrettyPragma(OS, Policy); OS << "\n"; break; } } } const char *OMPDeclareSimdDeclAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "declare simd"; } } // OMPDeclareTargetDeclAttr implementation OMPDeclareTargetDeclAttr *OMPDeclareTargetDeclAttr::CreateImplicit(ASTContext &Ctx, OMPDeclareTargetDeclAttr::MapTypeTy MapType, OMPDeclareTargetDeclAttr::DevTypeTy DevType, Expr * IndirectExpr, bool Indirect, unsigned Level, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPDeclareTargetDeclAttr(Ctx, CommonInfo, MapType, DevType, IndirectExpr, Indirect, Level); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPDeclareTargetDeclAttr *OMPDeclareTargetDeclAttr::Create(ASTContext &Ctx, OMPDeclareTargetDeclAttr::MapTypeTy MapType, OMPDeclareTargetDeclAttr::DevTypeTy DevType, Expr * IndirectExpr, bool Indirect, unsigned Level, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPDeclareTargetDeclAttr(Ctx, CommonInfo, MapType, DevType, IndirectExpr, Indirect, Level); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPDeclareTargetDeclAttr *OMPDeclareTargetDeclAttr::CreateImplicit(ASTContext &Ctx, OMPDeclareTargetDeclAttr::MapTypeTy MapType, OMPDeclareTargetDeclAttr::DevTypeTy DevType, Expr * IndirectExpr, bool Indirect, unsigned Level, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, MapType, DevType, IndirectExpr, Indirect, Level, I); } OMPDeclareTargetDeclAttr *OMPDeclareTargetDeclAttr::Create(ASTContext &Ctx, OMPDeclareTargetDeclAttr::MapTypeTy MapType, OMPDeclareTargetDeclAttr::DevTypeTy DevType, Expr * IndirectExpr, bool Indirect, unsigned Level, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, MapType, DevType, IndirectExpr, Indirect, Level, I); } OMPDeclareTargetDeclAttr::OMPDeclareTargetDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , OMPDeclareTargetDeclAttr::MapTypeTy MapType , OMPDeclareTargetDeclAttr::DevTypeTy DevType , Expr * IndirectExpr , bool Indirect , unsigned Level ) : InheritableAttr(Ctx, CommonInfo, attr::OMPDeclareTargetDecl, /*IsLateParsed=*/false, false) , mapType(MapType) , devType(DevType) , indirectExpr(IndirectExpr) , indirect(Indirect) , level(Level) { } bool OMPDeclareTargetDeclAttr::ConvertStrToMapTypeTy(StringRef Val, OMPDeclareTargetDeclAttr::MapTypeTy &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("to", OMPDeclareTargetDeclAttr::MapTypeTy::MT_To) .Case("enter", OMPDeclareTargetDeclAttr::MapTypeTy::MT_Enter) .Case("link", OMPDeclareTargetDeclAttr::MapTypeTy::MT_Link) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *OMPDeclareTargetDeclAttr::ConvertMapTypeTyToStr(OMPDeclareTargetDeclAttr::MapTypeTy Val) { switch(Val) { case OMPDeclareTargetDeclAttr::MapTypeTy::MT_To: return "to"; case OMPDeclareTargetDeclAttr::MapTypeTy::MT_Enter: return "enter"; case OMPDeclareTargetDeclAttr::MapTypeTy::MT_Link: return "link"; } llvm_unreachable("No enumerator with that value"); } bool OMPDeclareTargetDeclAttr::ConvertStrToDevTypeTy(StringRef Val, OMPDeclareTargetDeclAttr::DevTypeTy &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("host", OMPDeclareTargetDeclAttr::DevTypeTy::DT_Host) .Case("nohost", OMPDeclareTargetDeclAttr::DevTypeTy::DT_NoHost) .Case("any", OMPDeclareTargetDeclAttr::DevTypeTy::DT_Any) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *OMPDeclareTargetDeclAttr::ConvertDevTypeTyToStr(OMPDeclareTargetDeclAttr::DevTypeTy Val) { switch(Val) { case OMPDeclareTargetDeclAttr::DevTypeTy::DT_Host: return "host"; case OMPDeclareTargetDeclAttr::DevTypeTy::DT_NoHost: return "nohost"; case OMPDeclareTargetDeclAttr::DevTypeTy::DT_Any: return "any"; } llvm_unreachable("No enumerator with that value"); } OMPDeclareTargetDeclAttr *OMPDeclareTargetDeclAttr::clone(ASTContext &C) const { auto *A = new (C) OMPDeclareTargetDeclAttr(C, *this, mapType, devType, indirectExpr, indirect, level); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OMPDeclareTargetDeclAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "#pragma omp declare target"; printPrettyPragma(OS, Policy); OS << "\n"; break; } } } const char *OMPDeclareTargetDeclAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "declare target"; } } // OMPDeclareVariantAttr implementation OMPDeclareVariantAttr *OMPDeclareVariantAttr::CreateImplicit(ASTContext &Ctx, Expr * VariantFuncRef, OMPTraitInfo * TraitInfos, Expr * *AdjustArgsNothing, unsigned AdjustArgsNothingSize, Expr * *AdjustArgsNeedDevicePtr, unsigned AdjustArgsNeedDevicePtrSize, OMPInteropInfo *AppendArgs, unsigned AppendArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPDeclareVariantAttr(Ctx, CommonInfo, VariantFuncRef, TraitInfos, AdjustArgsNothing, AdjustArgsNothingSize, AdjustArgsNeedDevicePtr, AdjustArgsNeedDevicePtrSize, AppendArgs, AppendArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPDeclareVariantAttr *OMPDeclareVariantAttr::Create(ASTContext &Ctx, Expr * VariantFuncRef, OMPTraitInfo * TraitInfos, Expr * *AdjustArgsNothing, unsigned AdjustArgsNothingSize, Expr * *AdjustArgsNeedDevicePtr, unsigned AdjustArgsNeedDevicePtrSize, OMPInteropInfo *AppendArgs, unsigned AppendArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPDeclareVariantAttr(Ctx, CommonInfo, VariantFuncRef, TraitInfos, AdjustArgsNothing, AdjustArgsNothingSize, AdjustArgsNeedDevicePtr, AdjustArgsNeedDevicePtrSize, AppendArgs, AppendArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPDeclareVariantAttr *OMPDeclareVariantAttr::CreateImplicit(ASTContext &Ctx, Expr * VariantFuncRef, OMPTraitInfo * TraitInfos, Expr * *AdjustArgsNothing, unsigned AdjustArgsNothingSize, Expr * *AdjustArgsNeedDevicePtr, unsigned AdjustArgsNeedDevicePtrSize, OMPInteropInfo *AppendArgs, unsigned AppendArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, VariantFuncRef, TraitInfos, AdjustArgsNothing, AdjustArgsNothingSize, AdjustArgsNeedDevicePtr, AdjustArgsNeedDevicePtrSize, AppendArgs, AppendArgsSize, I); } OMPDeclareVariantAttr *OMPDeclareVariantAttr::Create(ASTContext &Ctx, Expr * VariantFuncRef, OMPTraitInfo * TraitInfos, Expr * *AdjustArgsNothing, unsigned AdjustArgsNothingSize, Expr * *AdjustArgsNeedDevicePtr, unsigned AdjustArgsNeedDevicePtrSize, OMPInteropInfo *AppendArgs, unsigned AppendArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Pragma, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, VariantFuncRef, TraitInfos, AdjustArgsNothing, AdjustArgsNothingSize, AdjustArgsNeedDevicePtr, AdjustArgsNeedDevicePtrSize, AppendArgs, AppendArgsSize, I); } OMPDeclareVariantAttr::OMPDeclareVariantAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * VariantFuncRef , OMPTraitInfo * TraitInfos , Expr * *AdjustArgsNothing, unsigned AdjustArgsNothingSize , Expr * *AdjustArgsNeedDevicePtr, unsigned AdjustArgsNeedDevicePtrSize , OMPInteropInfo *AppendArgs, unsigned AppendArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::OMPDeclareVariant, /*IsLateParsed=*/false, true) , variantFuncRef(VariantFuncRef) , traitInfos(TraitInfos) , adjustArgsNothing_Size(AdjustArgsNothingSize), adjustArgsNothing_(new (Ctx, 16) Expr *[adjustArgsNothing_Size]) , adjustArgsNeedDevicePtr_Size(AdjustArgsNeedDevicePtrSize), adjustArgsNeedDevicePtr_(new (Ctx, 16) Expr *[adjustArgsNeedDevicePtr_Size]) , appendArgs_Size(AppendArgsSize), appendArgs_(new (Ctx, 16) OMPInteropInfo[appendArgs_Size]) { std::copy(AdjustArgsNothing, AdjustArgsNothing + adjustArgsNothing_Size, adjustArgsNothing_); std::copy(AdjustArgsNeedDevicePtr, AdjustArgsNeedDevicePtr + adjustArgsNeedDevicePtr_Size, adjustArgsNeedDevicePtr_); std::copy(AppendArgs, AppendArgs + appendArgs_Size, appendArgs_); } OMPDeclareVariantAttr::OMPDeclareVariantAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * VariantFuncRef , OMPTraitInfo * TraitInfos , OMPInteropInfo *AppendArgs, unsigned AppendArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::OMPDeclareVariant, /*IsLateParsed=*/false, true) , variantFuncRef(VariantFuncRef) , traitInfos(TraitInfos) , adjustArgsNothing_Size(0), adjustArgsNothing_(nullptr) , adjustArgsNeedDevicePtr_Size(0), adjustArgsNeedDevicePtr_(nullptr) , appendArgs_Size(AppendArgsSize), appendArgs_(new (Ctx, 16) OMPInteropInfo[appendArgs_Size]) { std::copy(AppendArgs, AppendArgs + appendArgs_Size, appendArgs_); } OMPDeclareVariantAttr *OMPDeclareVariantAttr::clone(ASTContext &C) const { auto *A = new (C) OMPDeclareVariantAttr(C, *this, variantFuncRef, traitInfos, adjustArgsNothing_, adjustArgsNothing_Size, adjustArgsNeedDevicePtr_, adjustArgsNeedDevicePtr_Size, appendArgs_, appendArgs_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OMPDeclareVariantAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "#pragma omp declare variant"; printPrettyPragma(OS, Policy); OS << "\n"; break; } } } const char *OMPDeclareVariantAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "declare variant"; } } // OMPReferencedVarAttr implementation OMPReferencedVarAttr *OMPReferencedVarAttr::CreateImplicit(ASTContext &Ctx, Expr * Ref, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPReferencedVarAttr(Ctx, CommonInfo, Ref); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPReferencedVarAttr *OMPReferencedVarAttr::Create(ASTContext &Ctx, Expr * Ref, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPReferencedVarAttr(Ctx, CommonInfo, Ref); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPReferencedVarAttr *OMPReferencedVarAttr::CreateImplicit(ASTContext &Ctx, Expr * Ref, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, Ref, I); } OMPReferencedVarAttr *OMPReferencedVarAttr::Create(ASTContext &Ctx, Expr * Ref, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, Ref, I); } OMPReferencedVarAttr::OMPReferencedVarAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Ref ) : Attr(Ctx, CommonInfo, attr::OMPReferencedVar, /*IsLateParsed=*/false) , ref(Ref) { } OMPReferencedVarAttr *OMPReferencedVarAttr::clone(ASTContext &C) const { auto *A = new (C) OMPReferencedVarAttr(C, *this, ref); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OMPReferencedVarAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *OMPReferencedVarAttr::getSpelling() const { return "(No spelling)"; } // OMPThreadPrivateDeclAttr implementation OMPThreadPrivateDeclAttr *OMPThreadPrivateDeclAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPThreadPrivateDeclAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPThreadPrivateDeclAttr *OMPThreadPrivateDeclAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OMPThreadPrivateDeclAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OMPThreadPrivateDeclAttr *OMPThreadPrivateDeclAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, I); } OMPThreadPrivateDeclAttr *OMPThreadPrivateDeclAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, I); } OMPThreadPrivateDeclAttr::OMPThreadPrivateDeclAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::OMPThreadPrivateDecl, /*IsLateParsed=*/false, false) { } OMPThreadPrivateDeclAttr *OMPThreadPrivateDeclAttr::clone(ASTContext &C) const { auto *A = new (C) OMPThreadPrivateDeclAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OMPThreadPrivateDeclAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *OMPThreadPrivateDeclAttr::getSpelling() const { return "(No spelling)"; } // OSConsumedAttr implementation OSConsumedAttr *OSConsumedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OSConsumedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OSConsumedAttr *OSConsumedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OSConsumedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OSConsumedAttr *OSConsumedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_os_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_os_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_os_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OSConsumedAttr *OSConsumedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_os_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_os_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_os_consumed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_consumed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OSConsumedAttr::OSConsumedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableParamAttr(Ctx, CommonInfo, attr::OSConsumed, /*IsLateParsed=*/false, false) { } OSConsumedAttr *OSConsumedAttr::clone(ASTContext &C) const { auto *A = new (C) OSConsumedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OSConsumedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((os_consumed"; OS << "))"; break; } case 1 : { OS << "[[clang::os_consumed"; OS << "]]"; break; } case 2 : { OS << "[[clang::os_consumed"; OS << "]]"; break; } } } const char *OSConsumedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "os_consumed"; case 1: return "os_consumed"; case 2: return "os_consumed"; } } // OSConsumesThisAttr implementation OSConsumesThisAttr *OSConsumesThisAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OSConsumesThisAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OSConsumesThisAttr *OSConsumesThisAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OSConsumesThisAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OSConsumesThisAttr *OSConsumesThisAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_os_consumes_this: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_consumes_this, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_os_consumes_this: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_consumes_this, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_os_consumes_this: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_consumes_this, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OSConsumesThisAttr *OSConsumesThisAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_os_consumes_this: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_consumes_this, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_os_consumes_this: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_consumes_this, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_os_consumes_this: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_consumes_this, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OSConsumesThisAttr::OSConsumesThisAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::OSConsumesThis, /*IsLateParsed=*/false, false) { } OSConsumesThisAttr *OSConsumesThisAttr::clone(ASTContext &C) const { auto *A = new (C) OSConsumesThisAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OSConsumesThisAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((os_consumes_this"; OS << "))"; break; } case 1 : { OS << "[[clang::os_consumes_this"; OS << "]]"; break; } case 2 : { OS << "[[clang::os_consumes_this"; OS << "]]"; break; } } } const char *OSConsumesThisAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "os_consumes_this"; case 1: return "os_consumes_this"; case 2: return "os_consumes_this"; } } // OSReturnsNotRetainedAttr implementation OSReturnsNotRetainedAttr *OSReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OSReturnsNotRetainedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OSReturnsNotRetainedAttr *OSReturnsNotRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OSReturnsNotRetainedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OSReturnsNotRetainedAttr *OSReturnsNotRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_os_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_os_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_os_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OSReturnsNotRetainedAttr *OSReturnsNotRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_os_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_os_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_os_returns_not_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_not_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OSReturnsNotRetainedAttr::OSReturnsNotRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::OSReturnsNotRetained, /*IsLateParsed=*/false, false) { } OSReturnsNotRetainedAttr *OSReturnsNotRetainedAttr::clone(ASTContext &C) const { auto *A = new (C) OSReturnsNotRetainedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OSReturnsNotRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((os_returns_not_retained"; OS << "))"; break; } case 1 : { OS << "[[clang::os_returns_not_retained"; OS << "]]"; break; } case 2 : { OS << "[[clang::os_returns_not_retained"; OS << "]]"; break; } } } const char *OSReturnsNotRetainedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "os_returns_not_retained"; case 1: return "os_returns_not_retained"; case 2: return "os_returns_not_retained"; } } // OSReturnsRetainedAttr implementation OSReturnsRetainedAttr *OSReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OSReturnsRetainedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OSReturnsRetainedAttr *OSReturnsRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OSReturnsRetainedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OSReturnsRetainedAttr *OSReturnsRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_os_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_os_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_os_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OSReturnsRetainedAttr *OSReturnsRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_os_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_os_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_os_returns_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OSReturnsRetainedAttr::OSReturnsRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::OSReturnsRetained, /*IsLateParsed=*/false, false) { } OSReturnsRetainedAttr *OSReturnsRetainedAttr::clone(ASTContext &C) const { auto *A = new (C) OSReturnsRetainedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OSReturnsRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((os_returns_retained"; OS << "))"; break; } case 1 : { OS << "[[clang::os_returns_retained"; OS << "]]"; break; } case 2 : { OS << "[[clang::os_returns_retained"; OS << "]]"; break; } } } const char *OSReturnsRetainedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "os_returns_retained"; case 1: return "os_returns_retained"; case 2: return "os_returns_retained"; } } // OSReturnsRetainedOnNonZeroAttr implementation OSReturnsRetainedOnNonZeroAttr *OSReturnsRetainedOnNonZeroAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OSReturnsRetainedOnNonZeroAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OSReturnsRetainedOnNonZeroAttr *OSReturnsRetainedOnNonZeroAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OSReturnsRetainedOnNonZeroAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OSReturnsRetainedOnNonZeroAttr *OSReturnsRetainedOnNonZeroAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_os_returns_retained_on_non_zero: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_retained_on_non_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_os_returns_retained_on_non_zero: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_retained_on_non_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_os_returns_retained_on_non_zero: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_retained_on_non_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OSReturnsRetainedOnNonZeroAttr *OSReturnsRetainedOnNonZeroAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_os_returns_retained_on_non_zero: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_retained_on_non_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_os_returns_retained_on_non_zero: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_retained_on_non_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_os_returns_retained_on_non_zero: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_retained_on_non_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OSReturnsRetainedOnNonZeroAttr::OSReturnsRetainedOnNonZeroAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::OSReturnsRetainedOnNonZero, /*IsLateParsed=*/false, false) { } OSReturnsRetainedOnNonZeroAttr *OSReturnsRetainedOnNonZeroAttr::clone(ASTContext &C) const { auto *A = new (C) OSReturnsRetainedOnNonZeroAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OSReturnsRetainedOnNonZeroAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((os_returns_retained_on_non_zero"; OS << "))"; break; } case 1 : { OS << "[[clang::os_returns_retained_on_non_zero"; OS << "]]"; break; } case 2 : { OS << "[[clang::os_returns_retained_on_non_zero"; OS << "]]"; break; } } } const char *OSReturnsRetainedOnNonZeroAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "os_returns_retained_on_non_zero"; case 1: return "os_returns_retained_on_non_zero"; case 2: return "os_returns_retained_on_non_zero"; } } // OSReturnsRetainedOnZeroAttr implementation OSReturnsRetainedOnZeroAttr *OSReturnsRetainedOnZeroAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OSReturnsRetainedOnZeroAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OSReturnsRetainedOnZeroAttr *OSReturnsRetainedOnZeroAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OSReturnsRetainedOnZeroAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OSReturnsRetainedOnZeroAttr *OSReturnsRetainedOnZeroAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_os_returns_retained_on_zero: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_retained_on_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_os_returns_retained_on_zero: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_retained_on_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_os_returns_retained_on_zero: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_retained_on_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OSReturnsRetainedOnZeroAttr *OSReturnsRetainedOnZeroAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_os_returns_retained_on_zero: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_os_returns_retained_on_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_os_returns_retained_on_zero: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_os_returns_retained_on_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_os_returns_retained_on_zero: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_os_returns_retained_on_zero, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OSReturnsRetainedOnZeroAttr::OSReturnsRetainedOnZeroAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::OSReturnsRetainedOnZero, /*IsLateParsed=*/false, false) { } OSReturnsRetainedOnZeroAttr *OSReturnsRetainedOnZeroAttr::clone(ASTContext &C) const { auto *A = new (C) OSReturnsRetainedOnZeroAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OSReturnsRetainedOnZeroAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((os_returns_retained_on_zero"; OS << "))"; break; } case 1 : { OS << "[[clang::os_returns_retained_on_zero"; OS << "]]"; break; } case 2 : { OS << "[[clang::os_returns_retained_on_zero"; OS << "]]"; break; } } } const char *OSReturnsRetainedOnZeroAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "os_returns_retained_on_zero"; case 1: return "os_returns_retained_on_zero"; case 2: return "os_returns_retained_on_zero"; } } // ObjCBoxableAttr implementation ObjCBoxableAttr *ObjCBoxableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCBoxableAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCBoxableAttr *ObjCBoxableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCBoxableAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCBoxableAttr *ObjCBoxableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_boxable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_boxable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_boxable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_boxable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_boxable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_boxable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCBoxableAttr *ObjCBoxableAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_boxable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_boxable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_boxable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_boxable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_boxable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_boxable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCBoxableAttr::ObjCBoxableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::ObjCBoxable, /*IsLateParsed=*/false) { } ObjCBoxableAttr *ObjCBoxableAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCBoxableAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCBoxableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_boxable"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_boxable"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_boxable"; OS << "]]"; break; } } } const char *ObjCBoxableAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_boxable"; case 1: return "objc_boxable"; case 2: return "objc_boxable"; } } // ObjCBridgeAttr implementation ObjCBridgeAttr *ObjCBridgeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCBridgeAttr(Ctx, CommonInfo, BridgedType); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCBridgeAttr *ObjCBridgeAttr::Create(ASTContext &Ctx, IdentifierInfo * BridgedType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCBridgeAttr(Ctx, CommonInfo, BridgedType); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCBridgeAttr *ObjCBridgeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_bridge: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_bridge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_bridge: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_bridge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_bridge: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_bridge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, BridgedType, I); } ObjCBridgeAttr *ObjCBridgeAttr::Create(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_bridge: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_bridge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_bridge: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_bridge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_bridge: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_bridge, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, BridgedType, I); } ObjCBridgeAttr::ObjCBridgeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * BridgedType ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCBridge, /*IsLateParsed=*/false, false) , bridgedType(BridgedType) { } ObjCBridgeAttr *ObjCBridgeAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCBridgeAttr(C, *this, bridgedType); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCBridgeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_bridge"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_bridge"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_bridge"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ObjCBridgeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_bridge"; case 1: return "objc_bridge"; case 2: return "objc_bridge"; } } // ObjCBridgeMutableAttr implementation ObjCBridgeMutableAttr *ObjCBridgeMutableAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCBridgeMutableAttr(Ctx, CommonInfo, BridgedType); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCBridgeMutableAttr *ObjCBridgeMutableAttr::Create(ASTContext &Ctx, IdentifierInfo * BridgedType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCBridgeMutableAttr(Ctx, CommonInfo, BridgedType); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCBridgeMutableAttr *ObjCBridgeMutableAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_bridge_mutable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_bridge_mutable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_bridge_mutable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_bridge_mutable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_bridge_mutable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_bridge_mutable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, BridgedType, I); } ObjCBridgeMutableAttr *ObjCBridgeMutableAttr::Create(ASTContext &Ctx, IdentifierInfo * BridgedType, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_bridge_mutable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_bridge_mutable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_bridge_mutable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_bridge_mutable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_bridge_mutable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_bridge_mutable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, BridgedType, I); } ObjCBridgeMutableAttr::ObjCBridgeMutableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * BridgedType ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCBridgeMutable, /*IsLateParsed=*/false, false) , bridgedType(BridgedType) { } ObjCBridgeMutableAttr *ObjCBridgeMutableAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCBridgeMutableAttr(C, *this, bridgedType); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCBridgeMutableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_bridge_mutable"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_bridge_mutable"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_bridge_mutable"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getBridgedType() ? getBridgedType()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ObjCBridgeMutableAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_bridge_mutable"; case 1: return "objc_bridge_mutable"; case 2: return "objc_bridge_mutable"; } } // ObjCBridgeRelatedAttr implementation ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * RelatedClass, IdentifierInfo * ClassMethod, IdentifierInfo * InstanceMethod, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCBridgeRelatedAttr(Ctx, CommonInfo, RelatedClass, ClassMethod, InstanceMethod); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttr::Create(ASTContext &Ctx, IdentifierInfo * RelatedClass, IdentifierInfo * ClassMethod, IdentifierInfo * InstanceMethod, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCBridgeRelatedAttr(Ctx, CommonInfo, RelatedClass, ClassMethod, InstanceMethod); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * RelatedClass, IdentifierInfo * ClassMethod, IdentifierInfo * InstanceMethod, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_bridge_related: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_bridge_related, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_bridge_related: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_bridge_related, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_bridge_related: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_bridge_related, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, RelatedClass, ClassMethod, InstanceMethod, I); } ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttr::Create(ASTContext &Ctx, IdentifierInfo * RelatedClass, IdentifierInfo * ClassMethod, IdentifierInfo * InstanceMethod, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_bridge_related: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_bridge_related, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_bridge_related: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_bridge_related, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_bridge_related: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_bridge_related, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, RelatedClass, ClassMethod, InstanceMethod, I); } ObjCBridgeRelatedAttr::ObjCBridgeRelatedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * RelatedClass , IdentifierInfo * ClassMethod , IdentifierInfo * InstanceMethod ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCBridgeRelated, /*IsLateParsed=*/false, false) , relatedClass(RelatedClass) , classMethod(ClassMethod) , instanceMethod(InstanceMethod) { } ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCBridgeRelatedAttr(C, *this, relatedClass, classMethod, instanceMethod); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCBridgeRelatedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_bridge_related"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getRelatedClass() ? getRelatedClass()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getClassMethod() ? getClassMethod()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getInstanceMethod() ? getInstanceMethod()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_bridge_related"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getRelatedClass() ? getRelatedClass()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getClassMethod() ? getClassMethod()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getInstanceMethod() ? getInstanceMethod()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_bridge_related"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getRelatedClass() ? getRelatedClass()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getClassMethod() ? getClassMethod()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getInstanceMethod() ? getInstanceMethod()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ObjCBridgeRelatedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_bridge_related"; case 1: return "objc_bridge_related"; case 2: return "objc_bridge_related"; } } // ObjCClassStubAttr implementation ObjCClassStubAttr *ObjCClassStubAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCClassStubAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCClassStubAttr *ObjCClassStubAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCClassStubAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCClassStubAttr *ObjCClassStubAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_class_stub: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_class_stub, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_class_stub: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_class_stub, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_class_stub: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_class_stub, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCClassStubAttr *ObjCClassStubAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_class_stub: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_class_stub, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_class_stub: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_class_stub, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_class_stub: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_class_stub, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCClassStubAttr::ObjCClassStubAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::ObjCClassStub, /*IsLateParsed=*/false) { } ObjCClassStubAttr *ObjCClassStubAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCClassStubAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCClassStubAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_class_stub"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_class_stub"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_class_stub"; OS << "]]"; break; } } } const char *ObjCClassStubAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_class_stub"; case 1: return "objc_class_stub"; case 2: return "objc_class_stub"; } } // ObjCDesignatedInitializerAttr implementation ObjCDesignatedInitializerAttr *ObjCDesignatedInitializerAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCDesignatedInitializerAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCDesignatedInitializerAttr *ObjCDesignatedInitializerAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCDesignatedInitializerAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCDesignatedInitializerAttr *ObjCDesignatedInitializerAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_designated_initializer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_designated_initializer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_designated_initializer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_designated_initializer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_designated_initializer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_designated_initializer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCDesignatedInitializerAttr *ObjCDesignatedInitializerAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_designated_initializer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_designated_initializer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_designated_initializer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_designated_initializer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_designated_initializer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_designated_initializer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCDesignatedInitializerAttr::ObjCDesignatedInitializerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::ObjCDesignatedInitializer, /*IsLateParsed=*/false) { } ObjCDesignatedInitializerAttr *ObjCDesignatedInitializerAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCDesignatedInitializerAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCDesignatedInitializerAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_designated_initializer"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_designated_initializer"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_designated_initializer"; OS << "]]"; break; } } } const char *ObjCDesignatedInitializerAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_designated_initializer"; case 1: return "objc_designated_initializer"; case 2: return "objc_designated_initializer"; } } // ObjCDirectAttr implementation ObjCDirectAttr *ObjCDirectAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCDirectAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCDirectAttr *ObjCDirectAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCDirectAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCDirectAttr *ObjCDirectAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_direct: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_direct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_direct: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_direct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_direct: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_direct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCDirectAttr *ObjCDirectAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_direct: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_direct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_direct: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_direct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_direct: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_direct, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCDirectAttr::ObjCDirectAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::ObjCDirect, /*IsLateParsed=*/false) { } ObjCDirectAttr *ObjCDirectAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCDirectAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCDirectAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_direct"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_direct"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_direct"; OS << "]]"; break; } } } const char *ObjCDirectAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_direct"; case 1: return "objc_direct"; case 2: return "objc_direct"; } } // ObjCDirectMembersAttr implementation ObjCDirectMembersAttr *ObjCDirectMembersAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCDirectMembersAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCDirectMembersAttr *ObjCDirectMembersAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCDirectMembersAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCDirectMembersAttr *ObjCDirectMembersAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_direct_members: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_direct_members, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_direct_members: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_direct_members, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_direct_members: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_direct_members, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCDirectMembersAttr *ObjCDirectMembersAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_direct_members: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_direct_members, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_direct_members: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_direct_members, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_direct_members: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_direct_members, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCDirectMembersAttr::ObjCDirectMembersAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::ObjCDirectMembers, /*IsLateParsed=*/false) { } ObjCDirectMembersAttr *ObjCDirectMembersAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCDirectMembersAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCDirectMembersAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_direct_members"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_direct_members"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_direct_members"; OS << "]]"; break; } } } const char *ObjCDirectMembersAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_direct_members"; case 1: return "objc_direct_members"; case 2: return "objc_direct_members"; } } // ObjCExceptionAttr implementation ObjCExceptionAttr *ObjCExceptionAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCExceptionAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCExceptionAttr *ObjCExceptionAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCExceptionAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCExceptionAttr *ObjCExceptionAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_exception: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_exception, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_exception: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_exception, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_exception: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_exception, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCExceptionAttr *ObjCExceptionAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_exception: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_exception, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_exception: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_exception, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_exception: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_exception, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCExceptionAttr::ObjCExceptionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCException, /*IsLateParsed=*/false, false) { } ObjCExceptionAttr *ObjCExceptionAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCExceptionAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCExceptionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_exception"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_exception"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_exception"; OS << "]]"; break; } } } const char *ObjCExceptionAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_exception"; case 1: return "objc_exception"; case 2: return "objc_exception"; } } // ObjCExplicitProtocolImplAttr implementation ObjCExplicitProtocolImplAttr *ObjCExplicitProtocolImplAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCExplicitProtocolImplAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCExplicitProtocolImplAttr *ObjCExplicitProtocolImplAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCExplicitProtocolImplAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCExplicitProtocolImplAttr *ObjCExplicitProtocolImplAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_protocol_requires_explicit_implementation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_protocol_requires_explicit_implementation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_protocol_requires_explicit_implementation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_protocol_requires_explicit_implementation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_protocol_requires_explicit_implementation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_protocol_requires_explicit_implementation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCExplicitProtocolImplAttr *ObjCExplicitProtocolImplAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_protocol_requires_explicit_implementation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_protocol_requires_explicit_implementation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_protocol_requires_explicit_implementation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_protocol_requires_explicit_implementation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_protocol_requires_explicit_implementation: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_protocol_requires_explicit_implementation, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCExplicitProtocolImplAttr::ObjCExplicitProtocolImplAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCExplicitProtocolImpl, /*IsLateParsed=*/false, false) { } ObjCExplicitProtocolImplAttr *ObjCExplicitProtocolImplAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCExplicitProtocolImplAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCExplicitProtocolImplAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_protocol_requires_explicit_implementation"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_protocol_requires_explicit_implementation"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_protocol_requires_explicit_implementation"; OS << "]]"; break; } } } const char *ObjCExplicitProtocolImplAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_protocol_requires_explicit_implementation"; case 1: return "objc_protocol_requires_explicit_implementation"; case 2: return "objc_protocol_requires_explicit_implementation"; } } // ObjCExternallyRetainedAttr implementation ObjCExternallyRetainedAttr *ObjCExternallyRetainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCExternallyRetainedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCExternallyRetainedAttr *ObjCExternallyRetainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCExternallyRetainedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCExternallyRetainedAttr *ObjCExternallyRetainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_externally_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_externally_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_externally_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_externally_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_externally_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_externally_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCExternallyRetainedAttr *ObjCExternallyRetainedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_externally_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_externally_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_externally_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_externally_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_externally_retained: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_externally_retained, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCExternallyRetainedAttr::ObjCExternallyRetainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCExternallyRetained, /*IsLateParsed=*/false, false) { } ObjCExternallyRetainedAttr *ObjCExternallyRetainedAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCExternallyRetainedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCExternallyRetainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_externally_retained"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_externally_retained"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_externally_retained"; OS << "]]"; break; } } } const char *ObjCExternallyRetainedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_externally_retained"; case 1: return "objc_externally_retained"; case 2: return "objc_externally_retained"; } } // ObjCGCAttr implementation ObjCGCAttr *ObjCGCAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Kind, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCGCAttr(Ctx, CommonInfo, Kind); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCGCAttr *ObjCGCAttr::Create(ASTContext &Ctx, IdentifierInfo * Kind, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCGCAttr(Ctx, CommonInfo, Kind); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCGCAttr *ObjCGCAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Kind, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_gc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_gc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_gc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_gc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_gc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_gc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Kind, I); } ObjCGCAttr *ObjCGCAttr::Create(ASTContext &Ctx, IdentifierInfo * Kind, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_gc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_gc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_gc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_gc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_gc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_gc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Kind, I); } ObjCGCAttr::ObjCGCAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * Kind ) : TypeAttr(Ctx, CommonInfo, attr::ObjCGC, /*IsLateParsed=*/false) , kind(Kind) { } ObjCGCAttr *ObjCGCAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCGCAttr(C, *this, kind); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCGCAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_gc"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getKind() ? getKind()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_gc"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getKind() ? getKind()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_gc"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getKind() ? getKind()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ObjCGCAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_gc"; case 1: return "objc_gc"; case 2: return "objc_gc"; } } // ObjCIndependentClassAttr implementation ObjCIndependentClassAttr *ObjCIndependentClassAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCIndependentClassAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCIndependentClassAttr *ObjCIndependentClassAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCIndependentClassAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCIndependentClassAttr *ObjCIndependentClassAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_independent_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_independent_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_independent_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_independent_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_independent_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_independent_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCIndependentClassAttr *ObjCIndependentClassAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_independent_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_independent_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_independent_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_independent_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_independent_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_independent_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCIndependentClassAttr::ObjCIndependentClassAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCIndependentClass, /*IsLateParsed=*/false, false) { } ObjCIndependentClassAttr *ObjCIndependentClassAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCIndependentClassAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCIndependentClassAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_independent_class"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_independent_class"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_independent_class"; OS << "]]"; break; } } } const char *ObjCIndependentClassAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_independent_class"; case 1: return "objc_independent_class"; case 2: return "objc_independent_class"; } } // ObjCInertUnsafeUnretainedAttr implementation ObjCInertUnsafeUnretainedAttr *ObjCInertUnsafeUnretainedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCInertUnsafeUnretainedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCInertUnsafeUnretainedAttr *ObjCInertUnsafeUnretainedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCInertUnsafeUnretainedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCInertUnsafeUnretainedAttr *ObjCInertUnsafeUnretainedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } ObjCInertUnsafeUnretainedAttr *ObjCInertUnsafeUnretainedAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } ObjCInertUnsafeUnretainedAttr::ObjCInertUnsafeUnretainedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::ObjCInertUnsafeUnretained, /*IsLateParsed=*/false) { } ObjCInertUnsafeUnretainedAttr *ObjCInertUnsafeUnretainedAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCInertUnsafeUnretainedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCInertUnsafeUnretainedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__unsafe_unretained"; OS << ""; break; } } } const char *ObjCInertUnsafeUnretainedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__unsafe_unretained"; } } // ObjCKindOfAttr implementation ObjCKindOfAttr *ObjCKindOfAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCKindOfAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCKindOfAttr *ObjCKindOfAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCKindOfAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCKindOfAttr *ObjCKindOfAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } ObjCKindOfAttr *ObjCKindOfAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } ObjCKindOfAttr::ObjCKindOfAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::ObjCKindOf, /*IsLateParsed=*/false) { } ObjCKindOfAttr *ObjCKindOfAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCKindOfAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCKindOfAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__kindof"; OS << ""; break; } } } const char *ObjCKindOfAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__kindof"; } } // ObjCMethodFamilyAttr implementation ObjCMethodFamilyAttr *ObjCMethodFamilyAttr::CreateImplicit(ASTContext &Ctx, ObjCMethodFamilyAttr::FamilyKind Family, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCMethodFamilyAttr(Ctx, CommonInfo, Family); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCMethodFamilyAttr *ObjCMethodFamilyAttr::Create(ASTContext &Ctx, ObjCMethodFamilyAttr::FamilyKind Family, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCMethodFamilyAttr(Ctx, CommonInfo, Family); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCMethodFamilyAttr *ObjCMethodFamilyAttr::CreateImplicit(ASTContext &Ctx, ObjCMethodFamilyAttr::FamilyKind Family, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_method_family: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_method_family, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_method_family: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_method_family, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_method_family: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_method_family, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Family, I); } ObjCMethodFamilyAttr *ObjCMethodFamilyAttr::Create(ASTContext &Ctx, ObjCMethodFamilyAttr::FamilyKind Family, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_method_family: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_method_family, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_method_family: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_method_family, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_method_family: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_method_family, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Family, I); } ObjCMethodFamilyAttr::ObjCMethodFamilyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , ObjCMethodFamilyAttr::FamilyKind Family ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCMethodFamily, /*IsLateParsed=*/false, false) , family(Family) { } bool ObjCMethodFamilyAttr::ConvertStrToFamilyKind(StringRef Val, ObjCMethodFamilyAttr::FamilyKind &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("none", ObjCMethodFamilyAttr::FamilyKind::OMF_None) .Case("alloc", ObjCMethodFamilyAttr::FamilyKind::OMF_alloc) .Case("copy", ObjCMethodFamilyAttr::FamilyKind::OMF_copy) .Case("init", ObjCMethodFamilyAttr::FamilyKind::OMF_init) .Case("mutableCopy", ObjCMethodFamilyAttr::FamilyKind::OMF_mutableCopy) .Case("new", ObjCMethodFamilyAttr::FamilyKind::OMF_new) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *ObjCMethodFamilyAttr::ConvertFamilyKindToStr(ObjCMethodFamilyAttr::FamilyKind Val) { switch(Val) { case ObjCMethodFamilyAttr::FamilyKind::OMF_None: return "none"; case ObjCMethodFamilyAttr::FamilyKind::OMF_alloc: return "alloc"; case ObjCMethodFamilyAttr::FamilyKind::OMF_copy: return "copy"; case ObjCMethodFamilyAttr::FamilyKind::OMF_init: return "init"; case ObjCMethodFamilyAttr::FamilyKind::OMF_mutableCopy: return "mutableCopy"; case ObjCMethodFamilyAttr::FamilyKind::OMF_new: return "new"; } llvm_unreachable("No enumerator with that value"); } ObjCMethodFamilyAttr *ObjCMethodFamilyAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCMethodFamilyAttr(C, *this, family); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCMethodFamilyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_method_family"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << ObjCMethodFamilyAttr::ConvertFamilyKindToStr(getFamily()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_method_family"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << ObjCMethodFamilyAttr::ConvertFamilyKindToStr(getFamily()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_method_family"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << ObjCMethodFamilyAttr::ConvertFamilyKindToStr(getFamily()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ObjCMethodFamilyAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_method_family"; case 1: return "objc_method_family"; case 2: return "objc_method_family"; } } // ObjCNSObjectAttr implementation ObjCNSObjectAttr *ObjCNSObjectAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCNSObjectAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCNSObjectAttr *ObjCNSObjectAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCNSObjectAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCNSObjectAttr *ObjCNSObjectAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_NSObject: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_NSObject, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_NSObject: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_NSObject, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_NSObject: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_NSObject, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCNSObjectAttr *ObjCNSObjectAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_NSObject: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_NSObject, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_NSObject: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_NSObject, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_NSObject: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_NSObject, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCNSObjectAttr::ObjCNSObjectAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCNSObject, /*IsLateParsed=*/false, false) { } ObjCNSObjectAttr *ObjCNSObjectAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCNSObjectAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCNSObjectAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((NSObject"; OS << "))"; break; } case 1 : { OS << "[[clang::NSObject"; OS << "]]"; break; } case 2 : { OS << "[[clang::NSObject"; OS << "]]"; break; } } } const char *ObjCNSObjectAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "NSObject"; case 1: return "NSObject"; case 2: return "NSObject"; } } // ObjCNonLazyClassAttr implementation ObjCNonLazyClassAttr *ObjCNonLazyClassAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCNonLazyClassAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCNonLazyClassAttr *ObjCNonLazyClassAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCNonLazyClassAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCNonLazyClassAttr *ObjCNonLazyClassAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_nonlazy_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_nonlazy_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_nonlazy_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_nonlazy_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_nonlazy_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_nonlazy_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCNonLazyClassAttr *ObjCNonLazyClassAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_nonlazy_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_nonlazy_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_nonlazy_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_nonlazy_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_nonlazy_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_nonlazy_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCNonLazyClassAttr::ObjCNonLazyClassAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::ObjCNonLazyClass, /*IsLateParsed=*/false) { } ObjCNonLazyClassAttr *ObjCNonLazyClassAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCNonLazyClassAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCNonLazyClassAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_nonlazy_class"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_nonlazy_class"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_nonlazy_class"; OS << "]]"; break; } } } const char *ObjCNonLazyClassAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_nonlazy_class"; case 1: return "objc_nonlazy_class"; case 2: return "objc_nonlazy_class"; } } // ObjCNonRuntimeProtocolAttr implementation ObjCNonRuntimeProtocolAttr *ObjCNonRuntimeProtocolAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCNonRuntimeProtocolAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCNonRuntimeProtocolAttr *ObjCNonRuntimeProtocolAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCNonRuntimeProtocolAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCNonRuntimeProtocolAttr *ObjCNonRuntimeProtocolAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_non_runtime_protocol: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_non_runtime_protocol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_non_runtime_protocol: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_non_runtime_protocol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_non_runtime_protocol: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_non_runtime_protocol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCNonRuntimeProtocolAttr *ObjCNonRuntimeProtocolAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_non_runtime_protocol: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_non_runtime_protocol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_non_runtime_protocol: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_non_runtime_protocol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_non_runtime_protocol: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_non_runtime_protocol, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCNonRuntimeProtocolAttr::ObjCNonRuntimeProtocolAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::ObjCNonRuntimeProtocol, /*IsLateParsed=*/false) { } ObjCNonRuntimeProtocolAttr *ObjCNonRuntimeProtocolAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCNonRuntimeProtocolAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCNonRuntimeProtocolAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_non_runtime_protocol"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_non_runtime_protocol"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_non_runtime_protocol"; OS << "]]"; break; } } } const char *ObjCNonRuntimeProtocolAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_non_runtime_protocol"; case 1: return "objc_non_runtime_protocol"; case 2: return "objc_non_runtime_protocol"; } } // ObjCOwnershipAttr implementation ObjCOwnershipAttr *ObjCOwnershipAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Kind, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCOwnershipAttr(Ctx, CommonInfo, Kind); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCOwnershipAttr *ObjCOwnershipAttr::Create(ASTContext &Ctx, IdentifierInfo * Kind, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCOwnershipAttr(Ctx, CommonInfo, Kind); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCOwnershipAttr *ObjCOwnershipAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Kind, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_ownership: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_ownership, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_ownership: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_ownership, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_ownership: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_ownership, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Kind, I); } ObjCOwnershipAttr *ObjCOwnershipAttr::Create(ASTContext &Ctx, IdentifierInfo * Kind, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_ownership: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_ownership, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_ownership: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_ownership, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_ownership: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_ownership, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Kind, I); } ObjCOwnershipAttr::ObjCOwnershipAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * Kind ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCOwnership, /*IsLateParsed=*/false, false) , kind(Kind) { } ObjCOwnershipAttr *ObjCOwnershipAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCOwnershipAttr(C, *this, kind); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCOwnershipAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_ownership"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getKind() ? getKind()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_ownership"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getKind() ? getKind()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_ownership"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getKind() ? getKind()->getName() : "") << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ObjCOwnershipAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_ownership"; case 1: return "objc_ownership"; case 2: return "objc_ownership"; } } // ObjCPreciseLifetimeAttr implementation ObjCPreciseLifetimeAttr *ObjCPreciseLifetimeAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCPreciseLifetimeAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCPreciseLifetimeAttr *ObjCPreciseLifetimeAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCPreciseLifetimeAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCPreciseLifetimeAttr *ObjCPreciseLifetimeAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_precise_lifetime: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_precise_lifetime, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_precise_lifetime: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_precise_lifetime, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_precise_lifetime: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_precise_lifetime, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCPreciseLifetimeAttr *ObjCPreciseLifetimeAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_precise_lifetime: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_precise_lifetime, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_precise_lifetime: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_precise_lifetime, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_precise_lifetime: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_precise_lifetime, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCPreciseLifetimeAttr::ObjCPreciseLifetimeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCPreciseLifetime, /*IsLateParsed=*/false, false) { } ObjCPreciseLifetimeAttr *ObjCPreciseLifetimeAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCPreciseLifetimeAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCPreciseLifetimeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_precise_lifetime"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_precise_lifetime"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_precise_lifetime"; OS << "]]"; break; } } } const char *ObjCPreciseLifetimeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_precise_lifetime"; case 1: return "objc_precise_lifetime"; case 2: return "objc_precise_lifetime"; } } // ObjCRequiresPropertyDefsAttr implementation ObjCRequiresPropertyDefsAttr *ObjCRequiresPropertyDefsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCRequiresPropertyDefsAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCRequiresPropertyDefsAttr *ObjCRequiresPropertyDefsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCRequiresPropertyDefsAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCRequiresPropertyDefsAttr *ObjCRequiresPropertyDefsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_requires_property_definitions: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_requires_property_definitions, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_requires_property_definitions: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_requires_property_definitions, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_requires_property_definitions: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_requires_property_definitions, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCRequiresPropertyDefsAttr *ObjCRequiresPropertyDefsAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_requires_property_definitions: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_requires_property_definitions, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_requires_property_definitions: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_requires_property_definitions, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_requires_property_definitions: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_requires_property_definitions, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCRequiresPropertyDefsAttr::ObjCRequiresPropertyDefsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCRequiresPropertyDefs, /*IsLateParsed=*/false, false) { } ObjCRequiresPropertyDefsAttr *ObjCRequiresPropertyDefsAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCRequiresPropertyDefsAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCRequiresPropertyDefsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_requires_property_definitions"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_requires_property_definitions"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_requires_property_definitions"; OS << "]]"; break; } } } const char *ObjCRequiresPropertyDefsAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_requires_property_definitions"; case 1: return "objc_requires_property_definitions"; case 2: return "objc_requires_property_definitions"; } } // ObjCRequiresSuperAttr implementation ObjCRequiresSuperAttr *ObjCRequiresSuperAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCRequiresSuperAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCRequiresSuperAttr *ObjCRequiresSuperAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCRequiresSuperAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCRequiresSuperAttr *ObjCRequiresSuperAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_requires_super: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_requires_super, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_requires_super: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_requires_super, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_requires_super: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_requires_super, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCRequiresSuperAttr *ObjCRequiresSuperAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_requires_super: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_requires_super, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_requires_super: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_requires_super, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_requires_super: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_requires_super, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCRequiresSuperAttr::ObjCRequiresSuperAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCRequiresSuper, /*IsLateParsed=*/false, false) { } ObjCRequiresSuperAttr *ObjCRequiresSuperAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCRequiresSuperAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCRequiresSuperAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_requires_super"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_requires_super"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_requires_super"; OS << "]]"; break; } } } const char *ObjCRequiresSuperAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_requires_super"; case 1: return "objc_requires_super"; case 2: return "objc_requires_super"; } } // ObjCReturnsInnerPointerAttr implementation ObjCReturnsInnerPointerAttr *ObjCReturnsInnerPointerAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCReturnsInnerPointerAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCReturnsInnerPointerAttr *ObjCReturnsInnerPointerAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCReturnsInnerPointerAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCReturnsInnerPointerAttr *ObjCReturnsInnerPointerAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_returns_inner_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_returns_inner_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_returns_inner_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_returns_inner_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_returns_inner_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_returns_inner_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCReturnsInnerPointerAttr *ObjCReturnsInnerPointerAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_returns_inner_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_returns_inner_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_returns_inner_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_returns_inner_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_returns_inner_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_returns_inner_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCReturnsInnerPointerAttr::ObjCReturnsInnerPointerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCReturnsInnerPointer, /*IsLateParsed=*/false, false) { } ObjCReturnsInnerPointerAttr *ObjCReturnsInnerPointerAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCReturnsInnerPointerAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCReturnsInnerPointerAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_returns_inner_pointer"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_returns_inner_pointer"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_returns_inner_pointer"; OS << "]]"; break; } } } const char *ObjCReturnsInnerPointerAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_returns_inner_pointer"; case 1: return "objc_returns_inner_pointer"; case 2: return "objc_returns_inner_pointer"; } } // ObjCRootClassAttr implementation ObjCRootClassAttr *ObjCRootClassAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCRootClassAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCRootClassAttr *ObjCRootClassAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCRootClassAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCRootClassAttr *ObjCRootClassAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_root_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_root_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_root_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_root_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_root_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_root_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCRootClassAttr *ObjCRootClassAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_root_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_root_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_root_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_root_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_root_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_root_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCRootClassAttr::ObjCRootClassAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCRootClass, /*IsLateParsed=*/false, false) { } ObjCRootClassAttr *ObjCRootClassAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCRootClassAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCRootClassAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_root_class"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_root_class"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_root_class"; OS << "]]"; break; } } } const char *ObjCRootClassAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_root_class"; case 1: return "objc_root_class"; case 2: return "objc_root_class"; } } // ObjCRuntimeNameAttr implementation ObjCRuntimeNameAttr *ObjCRuntimeNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef MetadataName, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCRuntimeNameAttr(Ctx, CommonInfo, MetadataName); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCRuntimeNameAttr *ObjCRuntimeNameAttr::Create(ASTContext &Ctx, llvm::StringRef MetadataName, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCRuntimeNameAttr(Ctx, CommonInfo, MetadataName); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCRuntimeNameAttr *ObjCRuntimeNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef MetadataName, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_runtime_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_runtime_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_runtime_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_runtime_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_runtime_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_runtime_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, MetadataName, I); } ObjCRuntimeNameAttr *ObjCRuntimeNameAttr::Create(ASTContext &Ctx, llvm::StringRef MetadataName, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_runtime_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_runtime_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_runtime_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_runtime_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_runtime_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_runtime_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, MetadataName, I); } ObjCRuntimeNameAttr::ObjCRuntimeNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef MetadataName ) : Attr(Ctx, CommonInfo, attr::ObjCRuntimeName, /*IsLateParsed=*/false) , metadataNameLength(MetadataName.size()),metadataName(new (Ctx, 1) char[metadataNameLength]) { if (!MetadataName.empty()) std::memcpy(metadataName, MetadataName.data(), metadataNameLength); } ObjCRuntimeNameAttr *ObjCRuntimeNameAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCRuntimeNameAttr(C, *this, getMetadataName()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCRuntimeNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_runtime_name"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMetadataName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_runtime_name"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMetadataName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_runtime_name"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMetadataName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ObjCRuntimeNameAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_runtime_name"; case 1: return "objc_runtime_name"; case 2: return "objc_runtime_name"; } } // ObjCRuntimeVisibleAttr implementation ObjCRuntimeVisibleAttr *ObjCRuntimeVisibleAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCRuntimeVisibleAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCRuntimeVisibleAttr *ObjCRuntimeVisibleAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCRuntimeVisibleAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCRuntimeVisibleAttr *ObjCRuntimeVisibleAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_runtime_visible: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_runtime_visible, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_runtime_visible: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_runtime_visible, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_runtime_visible: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_runtime_visible, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCRuntimeVisibleAttr *ObjCRuntimeVisibleAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_runtime_visible: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_runtime_visible, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_runtime_visible: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_runtime_visible, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_runtime_visible: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_runtime_visible, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCRuntimeVisibleAttr::ObjCRuntimeVisibleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::ObjCRuntimeVisible, /*IsLateParsed=*/false) { } ObjCRuntimeVisibleAttr *ObjCRuntimeVisibleAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCRuntimeVisibleAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCRuntimeVisibleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_runtime_visible"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_runtime_visible"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_runtime_visible"; OS << "]]"; break; } } } const char *ObjCRuntimeVisibleAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_runtime_visible"; case 1: return "objc_runtime_visible"; case 2: return "objc_runtime_visible"; } } // ObjCSubclassingRestrictedAttr implementation ObjCSubclassingRestrictedAttr *ObjCSubclassingRestrictedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCSubclassingRestrictedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCSubclassingRestrictedAttr *ObjCSubclassingRestrictedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ObjCSubclassingRestrictedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ObjCSubclassingRestrictedAttr *ObjCSubclassingRestrictedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_subclassing_restricted: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_subclassing_restricted, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_subclassing_restricted: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_subclassing_restricted, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_subclassing_restricted: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_subclassing_restricted, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ObjCSubclassingRestrictedAttr *ObjCSubclassingRestrictedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_objc_subclassing_restricted: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_objc_subclassing_restricted, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_objc_subclassing_restricted: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_objc_subclassing_restricted, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_objc_subclassing_restricted: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_objc_subclassing_restricted, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ObjCSubclassingRestrictedAttr::ObjCSubclassingRestrictedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ObjCSubclassingRestricted, /*IsLateParsed=*/false, false) { } ObjCSubclassingRestrictedAttr *ObjCSubclassingRestrictedAttr::clone(ASTContext &C) const { auto *A = new (C) ObjCSubclassingRestrictedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ObjCSubclassingRestrictedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((objc_subclassing_restricted"; OS << "))"; break; } case 1 : { OS << "[[clang::objc_subclassing_restricted"; OS << "]]"; break; } case 2 : { OS << "[[clang::objc_subclassing_restricted"; OS << "]]"; break; } } } const char *ObjCSubclassingRestrictedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "objc_subclassing_restricted"; case 1: return "objc_subclassing_restricted"; case 2: return "objc_subclassing_restricted"; } } // OpenCLAccessAttr implementation OpenCLAccessAttr *OpenCLAccessAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLAccessAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLAccessAttr *OpenCLAccessAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLAccessAttr(Ctx, CommonInfo); return A; } OpenCLAccessAttr *OpenCLAccessAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_read_only: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_read_only, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_write_only: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_write_only, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_read_write: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_read_write, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OpenCLAccessAttr *OpenCLAccessAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_read_only: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_read_only, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_write_only: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_write_only, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_read_write: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_read_write, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OpenCLAccessAttr::OpenCLAccessAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::OpenCLAccess, /*IsLateParsed=*/false) { } OpenCLAccessAttr::Spelling OpenCLAccessAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return Keyword_read_only; case 1: return Keyword_read_only; case 2: return Keyword_write_only; case 3: return Keyword_write_only; case 4: return Keyword_read_write; case 5: return Keyword_read_write; } } OpenCLAccessAttr *OpenCLAccessAttr::clone(ASTContext &C) const { auto *A = new (C) OpenCLAccessAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OpenCLAccessAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__read_only"; OS << ""; break; } case 1 : { OS << "read_only"; OS << ""; break; } case 2 : { OS << "__write_only"; OS << ""; break; } case 3 : { OS << "write_only"; OS << ""; break; } case 4 : { OS << "__read_write"; OS << ""; break; } case 5 : { OS << "read_write"; OS << ""; break; } } } const char *OpenCLAccessAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__read_only"; case 1: return "read_only"; case 2: return "__write_only"; case 3: return "write_only"; case 4: return "__read_write"; case 5: return "read_write"; } } // OpenCLConstantAddressSpaceAttr implementation OpenCLConstantAddressSpaceAttr *OpenCLConstantAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLConstantAddressSpaceAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLConstantAddressSpaceAttr *OpenCLConstantAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLConstantAddressSpaceAttr(Ctx, CommonInfo); return A; } OpenCLConstantAddressSpaceAttr *OpenCLConstantAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_constant: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_opencl_constant: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_opencl_constant: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_opencl_constant: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OpenCLConstantAddressSpaceAttr *OpenCLConstantAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_constant: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_opencl_constant: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_opencl_constant: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_opencl_constant: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_constant, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OpenCLConstantAddressSpaceAttr::OpenCLConstantAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::OpenCLConstantAddressSpace, /*IsLateParsed=*/false) { } OpenCLConstantAddressSpaceAttr::Spelling OpenCLConstantAddressSpaceAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return Keyword_constant; case 1: return Keyword_constant; case 2: return GNU_opencl_constant; case 3: return CXX11_clang_opencl_constant; case 4: return C23_clang_opencl_constant; } } OpenCLConstantAddressSpaceAttr *OpenCLConstantAddressSpaceAttr::clone(ASTContext &C) const { auto *A = new (C) OpenCLConstantAddressSpaceAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OpenCLConstantAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__constant"; OS << ""; break; } case 1 : { OS << "constant"; OS << ""; break; } case 2 : { OS << "__attribute__((opencl_constant"; OS << "))"; break; } case 3 : { OS << "[[clang::opencl_constant"; OS << "]]"; break; } case 4 : { OS << "[[clang::opencl_constant"; OS << "]]"; break; } } } const char *OpenCLConstantAddressSpaceAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__constant"; case 1: return "constant"; case 2: return "opencl_constant"; case 3: return "opencl_constant"; case 4: return "opencl_constant"; } } // OpenCLGenericAddressSpaceAttr implementation OpenCLGenericAddressSpaceAttr *OpenCLGenericAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLGenericAddressSpaceAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLGenericAddressSpaceAttr *OpenCLGenericAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLGenericAddressSpaceAttr(Ctx, CommonInfo); return A; } OpenCLGenericAddressSpaceAttr *OpenCLGenericAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_generic: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_opencl_generic: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_opencl_generic: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_opencl_generic: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OpenCLGenericAddressSpaceAttr *OpenCLGenericAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_generic: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_opencl_generic: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_opencl_generic: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_opencl_generic: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_generic, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OpenCLGenericAddressSpaceAttr::OpenCLGenericAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::OpenCLGenericAddressSpace, /*IsLateParsed=*/false) { } OpenCLGenericAddressSpaceAttr::Spelling OpenCLGenericAddressSpaceAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return Keyword_generic; case 1: return Keyword_generic; case 2: return GNU_opencl_generic; case 3: return CXX11_clang_opencl_generic; case 4: return C23_clang_opencl_generic; } } OpenCLGenericAddressSpaceAttr *OpenCLGenericAddressSpaceAttr::clone(ASTContext &C) const { auto *A = new (C) OpenCLGenericAddressSpaceAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OpenCLGenericAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__generic"; OS << ""; break; } case 1 : { OS << "generic"; OS << ""; break; } case 2 : { OS << "__attribute__((opencl_generic"; OS << "))"; break; } case 3 : { OS << "[[clang::opencl_generic"; OS << "]]"; break; } case 4 : { OS << "[[clang::opencl_generic"; OS << "]]"; break; } } } const char *OpenCLGenericAddressSpaceAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__generic"; case 1: return "generic"; case 2: return "opencl_generic"; case 3: return "opencl_generic"; case 4: return "opencl_generic"; } } // OpenCLGlobalAddressSpaceAttr implementation OpenCLGlobalAddressSpaceAttr *OpenCLGlobalAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLGlobalAddressSpaceAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLGlobalAddressSpaceAttr *OpenCLGlobalAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLGlobalAddressSpaceAttr(Ctx, CommonInfo); return A; } OpenCLGlobalAddressSpaceAttr *OpenCLGlobalAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_global: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_opencl_global: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_opencl_global: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_opencl_global: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OpenCLGlobalAddressSpaceAttr *OpenCLGlobalAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_global: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_opencl_global: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_opencl_global: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_opencl_global: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_global, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OpenCLGlobalAddressSpaceAttr::OpenCLGlobalAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::OpenCLGlobalAddressSpace, /*IsLateParsed=*/false) { } OpenCLGlobalAddressSpaceAttr::Spelling OpenCLGlobalAddressSpaceAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return Keyword_global; case 1: return Keyword_global; case 2: return GNU_opencl_global; case 3: return CXX11_clang_opencl_global; case 4: return C23_clang_opencl_global; } } OpenCLGlobalAddressSpaceAttr *OpenCLGlobalAddressSpaceAttr::clone(ASTContext &C) const { auto *A = new (C) OpenCLGlobalAddressSpaceAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OpenCLGlobalAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__global"; OS << ""; break; } case 1 : { OS << "global"; OS << ""; break; } case 2 : { OS << "__attribute__((opencl_global"; OS << "))"; break; } case 3 : { OS << "[[clang::opencl_global"; OS << "]]"; break; } case 4 : { OS << "[[clang::opencl_global"; OS << "]]"; break; } } } const char *OpenCLGlobalAddressSpaceAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__global"; case 1: return "global"; case 2: return "opencl_global"; case 3: return "opencl_global"; case 4: return "opencl_global"; } } // OpenCLGlobalDeviceAddressSpaceAttr implementation OpenCLGlobalDeviceAddressSpaceAttr *OpenCLGlobalDeviceAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLGlobalDeviceAddressSpaceAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLGlobalDeviceAddressSpaceAttr *OpenCLGlobalDeviceAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLGlobalDeviceAddressSpaceAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLGlobalDeviceAddressSpaceAttr *OpenCLGlobalDeviceAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_opencl_global_device: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_global_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_opencl_global_device: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_global_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_opencl_global_device: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_global_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OpenCLGlobalDeviceAddressSpaceAttr *OpenCLGlobalDeviceAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_opencl_global_device: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_global_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_opencl_global_device: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_global_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_opencl_global_device: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_global_device, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OpenCLGlobalDeviceAddressSpaceAttr::OpenCLGlobalDeviceAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::OpenCLGlobalDeviceAddressSpace, /*IsLateParsed=*/false) { } OpenCLGlobalDeviceAddressSpaceAttr *OpenCLGlobalDeviceAddressSpaceAttr::clone(ASTContext &C) const { auto *A = new (C) OpenCLGlobalDeviceAddressSpaceAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OpenCLGlobalDeviceAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((opencl_global_device"; OS << "))"; break; } case 1 : { OS << "[[clang::opencl_global_device"; OS << "]]"; break; } case 2 : { OS << "[[clang::opencl_global_device"; OS << "]]"; break; } } } const char *OpenCLGlobalDeviceAddressSpaceAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "opencl_global_device"; case 1: return "opencl_global_device"; case 2: return "opencl_global_device"; } } // OpenCLGlobalHostAddressSpaceAttr implementation OpenCLGlobalHostAddressSpaceAttr *OpenCLGlobalHostAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLGlobalHostAddressSpaceAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLGlobalHostAddressSpaceAttr *OpenCLGlobalHostAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLGlobalHostAddressSpaceAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLGlobalHostAddressSpaceAttr *OpenCLGlobalHostAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_opencl_global_host: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_global_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_opencl_global_host: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_global_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_opencl_global_host: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_global_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OpenCLGlobalHostAddressSpaceAttr *OpenCLGlobalHostAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_opencl_global_host: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_global_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_opencl_global_host: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_global_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_opencl_global_host: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_global_host, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OpenCLGlobalHostAddressSpaceAttr::OpenCLGlobalHostAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::OpenCLGlobalHostAddressSpace, /*IsLateParsed=*/false) { } OpenCLGlobalHostAddressSpaceAttr *OpenCLGlobalHostAddressSpaceAttr::clone(ASTContext &C) const { auto *A = new (C) OpenCLGlobalHostAddressSpaceAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OpenCLGlobalHostAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((opencl_global_host"; OS << "))"; break; } case 1 : { OS << "[[clang::opencl_global_host"; OS << "]]"; break; } case 2 : { OS << "[[clang::opencl_global_host"; OS << "]]"; break; } } } const char *OpenCLGlobalHostAddressSpaceAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "opencl_global_host"; case 1: return "opencl_global_host"; case 2: return "opencl_global_host"; } } // OpenCLIntelReqdSubGroupSizeAttr implementation OpenCLIntelReqdSubGroupSizeAttr *OpenCLIntelReqdSubGroupSizeAttr::CreateImplicit(ASTContext &Ctx, unsigned SubGroupSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLIntelReqdSubGroupSizeAttr(Ctx, CommonInfo, SubGroupSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLIntelReqdSubGroupSizeAttr *OpenCLIntelReqdSubGroupSizeAttr::Create(ASTContext &Ctx, unsigned SubGroupSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLIntelReqdSubGroupSizeAttr(Ctx, CommonInfo, SubGroupSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLIntelReqdSubGroupSizeAttr *OpenCLIntelReqdSubGroupSizeAttr::CreateImplicit(ASTContext &Ctx, unsigned SubGroupSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, SubGroupSize, I); } OpenCLIntelReqdSubGroupSizeAttr *OpenCLIntelReqdSubGroupSizeAttr::Create(ASTContext &Ctx, unsigned SubGroupSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, SubGroupSize, I); } OpenCLIntelReqdSubGroupSizeAttr::OpenCLIntelReqdSubGroupSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned SubGroupSize ) : InheritableAttr(Ctx, CommonInfo, attr::OpenCLIntelReqdSubGroupSize, /*IsLateParsed=*/false, false) , subGroupSize(SubGroupSize) { } OpenCLIntelReqdSubGroupSizeAttr *OpenCLIntelReqdSubGroupSizeAttr::clone(ASTContext &C) const { auto *A = new (C) OpenCLIntelReqdSubGroupSizeAttr(C, *this, subGroupSize); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OpenCLIntelReqdSubGroupSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((intel_reqd_sub_group_size"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getSubGroupSize() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *OpenCLIntelReqdSubGroupSizeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "intel_reqd_sub_group_size"; } } // OpenCLKernelAttr implementation OpenCLKernelAttr *OpenCLKernelAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLKernelAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLKernelAttr *OpenCLKernelAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLKernelAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLKernelAttr *OpenCLKernelAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OpenCLKernelAttr *OpenCLKernelAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OpenCLKernelAttr::OpenCLKernelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::OpenCLKernel, /*IsLateParsed=*/false, false) { } OpenCLKernelAttr *OpenCLKernelAttr::clone(ASTContext &C) const { auto *A = new (C) OpenCLKernelAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OpenCLKernelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__kernel"; OS << ""; break; } case 1 : { OS << "kernel"; OS << ""; break; } } } const char *OpenCLKernelAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__kernel"; case 1: return "kernel"; } } // OpenCLLocalAddressSpaceAttr implementation OpenCLLocalAddressSpaceAttr *OpenCLLocalAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLLocalAddressSpaceAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLLocalAddressSpaceAttr *OpenCLLocalAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLLocalAddressSpaceAttr(Ctx, CommonInfo); return A; } OpenCLLocalAddressSpaceAttr *OpenCLLocalAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_local: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_opencl_local: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_opencl_local: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_opencl_local: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OpenCLLocalAddressSpaceAttr *OpenCLLocalAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_local: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_opencl_local: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_opencl_local: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_opencl_local: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_local, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OpenCLLocalAddressSpaceAttr::OpenCLLocalAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::OpenCLLocalAddressSpace, /*IsLateParsed=*/false) { } OpenCLLocalAddressSpaceAttr::Spelling OpenCLLocalAddressSpaceAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return Keyword_local; case 1: return Keyword_local; case 2: return GNU_opencl_local; case 3: return CXX11_clang_opencl_local; case 4: return C23_clang_opencl_local; } } OpenCLLocalAddressSpaceAttr *OpenCLLocalAddressSpaceAttr::clone(ASTContext &C) const { auto *A = new (C) OpenCLLocalAddressSpaceAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OpenCLLocalAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__local"; OS << ""; break; } case 1 : { OS << "local"; OS << ""; break; } case 2 : { OS << "__attribute__((opencl_local"; OS << "))"; break; } case 3 : { OS << "[[clang::opencl_local"; OS << "]]"; break; } case 4 : { OS << "[[clang::opencl_local"; OS << "]]"; break; } } } const char *OpenCLLocalAddressSpaceAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__local"; case 1: return "local"; case 2: return "opencl_local"; case 3: return "opencl_local"; case 4: return "opencl_local"; } } // OpenCLPrivateAddressSpaceAttr implementation OpenCLPrivateAddressSpaceAttr *OpenCLPrivateAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLPrivateAddressSpaceAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLPrivateAddressSpaceAttr *OpenCLPrivateAddressSpaceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLPrivateAddressSpaceAttr(Ctx, CommonInfo); return A; } OpenCLPrivateAddressSpaceAttr *OpenCLPrivateAddressSpaceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_private: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_opencl_private: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_opencl_private: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_opencl_private: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OpenCLPrivateAddressSpaceAttr *OpenCLPrivateAddressSpaceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Keyword_private: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_opencl_private: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_opencl_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_opencl_private: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_opencl_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_opencl_private: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_opencl_private, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OpenCLPrivateAddressSpaceAttr::OpenCLPrivateAddressSpaceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::OpenCLPrivateAddressSpace, /*IsLateParsed=*/false) { } OpenCLPrivateAddressSpaceAttr::Spelling OpenCLPrivateAddressSpaceAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return Keyword_private; case 1: return Keyword_private; case 2: return GNU_opencl_private; case 3: return CXX11_clang_opencl_private; case 4: return C23_clang_opencl_private; } } OpenCLPrivateAddressSpaceAttr *OpenCLPrivateAddressSpaceAttr::clone(ASTContext &C) const { auto *A = new (C) OpenCLPrivateAddressSpaceAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OpenCLPrivateAddressSpaceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__private"; OS << ""; break; } case 1 : { OS << "private"; OS << ""; break; } case 2 : { OS << "__attribute__((opencl_private"; OS << "))"; break; } case 3 : { OS << "[[clang::opencl_private"; OS << "]]"; break; } case 4 : { OS << "[[clang::opencl_private"; OS << "]]"; break; } } } const char *OpenCLPrivateAddressSpaceAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__private"; case 1: return "private"; case 2: return "opencl_private"; case 3: return "opencl_private"; case 4: return "opencl_private"; } } // OpenCLUnrollHintAttr implementation OpenCLUnrollHintAttr *OpenCLUnrollHintAttr::CreateImplicit(ASTContext &Ctx, unsigned UnrollHint, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLUnrollHintAttr(Ctx, CommonInfo, UnrollHint); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLUnrollHintAttr *OpenCLUnrollHintAttr::Create(ASTContext &Ctx, unsigned UnrollHint, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OpenCLUnrollHintAttr(Ctx, CommonInfo, UnrollHint); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OpenCLUnrollHintAttr *OpenCLUnrollHintAttr::CreateImplicit(ASTContext &Ctx, unsigned UnrollHint, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, UnrollHint, I); } OpenCLUnrollHintAttr *OpenCLUnrollHintAttr::Create(ASTContext &Ctx, unsigned UnrollHint, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, UnrollHint, I); } OpenCLUnrollHintAttr::OpenCLUnrollHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned UnrollHint ) : StmtAttr(Ctx, CommonInfo, attr::OpenCLUnrollHint, /*IsLateParsed=*/false) , unrollHint(UnrollHint) { } OpenCLUnrollHintAttr::OpenCLUnrollHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : StmtAttr(Ctx, CommonInfo, attr::OpenCLUnrollHint, /*IsLateParsed=*/false) , unrollHint() { } OpenCLUnrollHintAttr *OpenCLUnrollHintAttr::clone(ASTContext &C) const { auto *A = new (C) OpenCLUnrollHintAttr(C, *this, unrollHint); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OpenCLUnrollHintAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((opencl_unroll_hint"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getUnrollHint() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *OpenCLUnrollHintAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "opencl_unroll_hint"; } } // OptimizeNoneAttr implementation OptimizeNoneAttr *OptimizeNoneAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OptimizeNoneAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OptimizeNoneAttr *OptimizeNoneAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OptimizeNoneAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OptimizeNoneAttr *OptimizeNoneAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_optnone: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_optnone, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_optnone: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_optnone, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_optnone: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_optnone, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OptimizeNoneAttr *OptimizeNoneAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_optnone: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_optnone, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_optnone: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_optnone, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_optnone: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_optnone, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OptimizeNoneAttr::OptimizeNoneAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::OptimizeNone, /*IsLateParsed=*/false, false) { } OptimizeNoneAttr *OptimizeNoneAttr::clone(ASTContext &C) const { auto *A = new (C) OptimizeNoneAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OptimizeNoneAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((optnone"; OS << "))"; break; } case 1 : { OS << "[[clang::optnone"; OS << "]]"; break; } case 2 : { OS << "[[clang::optnone"; OS << "]]"; break; } } } const char *OptimizeNoneAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "optnone"; case 1: return "optnone"; case 2: return "optnone"; } } // OverloadableAttr implementation OverloadableAttr *OverloadableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OverloadableAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OverloadableAttr *OverloadableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OverloadableAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OverloadableAttr *OverloadableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_overloadable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_overloadable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_overloadable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_overloadable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_overloadable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_overloadable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } OverloadableAttr *OverloadableAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_overloadable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_overloadable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_overloadable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_overloadable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_overloadable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_overloadable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } OverloadableAttr::OverloadableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::Overloadable, /*IsLateParsed=*/false) { } OverloadableAttr *OverloadableAttr::clone(ASTContext &C) const { auto *A = new (C) OverloadableAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OverloadableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((overloadable"; OS << "))"; break; } case 1 : { OS << "[[clang::overloadable"; OS << "]]"; break; } case 2 : { OS << "[[clang::overloadable"; OS << "]]"; break; } } } const char *OverloadableAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "overloadable"; case 1: return "overloadable"; case 2: return "overloadable"; } } // OverrideAttr implementation OverrideAttr *OverrideAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OverrideAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OverrideAttr *OverrideAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OverrideAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OverrideAttr *OverrideAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } OverrideAttr *OverrideAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } OverrideAttr::OverrideAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Override, /*IsLateParsed=*/false, false) { } OverrideAttr *OverrideAttr::clone(ASTContext &C) const { auto *A = new (C) OverrideAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OverrideAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "override"; OS << ""; break; } } } const char *OverrideAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "override"; } } // OwnerAttr implementation OwnerAttr *OwnerAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * DerefType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OwnerAttr(Ctx, CommonInfo, DerefType); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OwnerAttr *OwnerAttr::Create(ASTContext &Ctx, TypeSourceInfo * DerefType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OwnerAttr(Ctx, CommonInfo, DerefType); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OwnerAttr *OwnerAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * DerefType, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, DerefType, I); } OwnerAttr *OwnerAttr::Create(ASTContext &Ctx, TypeSourceInfo * DerefType, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, DerefType, I); } OwnerAttr::OwnerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , TypeSourceInfo * DerefType ) : InheritableAttr(Ctx, CommonInfo, attr::Owner, /*IsLateParsed=*/false, false) , derefType(DerefType) { } OwnerAttr::OwnerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Owner, /*IsLateParsed=*/false, false) , derefType() { } OwnerAttr *OwnerAttr::clone(ASTContext &C) const { auto *A = new (C) OwnerAttr(C, *this, derefType); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OwnerAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[gsl::Owner"; if (!getDerefTypeLoc()) ++TrailingOmittedArgs; if (!(!getDerefTypeLoc())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getDerefType().getAsString() << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *OwnerAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "Owner"; } } // OwnershipAttr implementation OwnershipAttr *OwnershipAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Module, ParamIdx *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OwnershipAttr(Ctx, CommonInfo, Module, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } OwnershipAttr *OwnershipAttr::Create(ASTContext &Ctx, IdentifierInfo * Module, ParamIdx *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) OwnershipAttr(Ctx, CommonInfo, Module, Args, ArgsSize); return A; } OwnershipAttr *OwnershipAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * Module, ParamIdx *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ownership_holds: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ownership_holds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ownership_holds: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ownership_holds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ownership_holds: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ownership_holds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_ownership_returns: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ownership_returns, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ownership_returns: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ownership_returns, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ownership_returns: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ownership_returns, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_ownership_takes: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ownership_takes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ownership_takes: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ownership_takes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ownership_takes: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ownership_takes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Module, Args, ArgsSize, I); } OwnershipAttr *OwnershipAttr::Create(ASTContext &Ctx, IdentifierInfo * Module, ParamIdx *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ownership_holds: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ownership_holds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ownership_holds: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ownership_holds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ownership_holds: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ownership_holds, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_ownership_returns: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ownership_returns, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ownership_returns: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ownership_returns, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ownership_returns: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ownership_returns, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_ownership_takes: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ownership_takes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ownership_takes: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ownership_takes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ownership_takes: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ownership_takes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Module, Args, ArgsSize, I); } OwnershipAttr::OwnershipAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * Module , ParamIdx *Args, unsigned ArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::Ownership, /*IsLateParsed=*/false, false) , module(Module) , args_Size(ArgsSize), args_(new (Ctx, 16) ParamIdx[args_Size]) { std::copy(Args, Args + args_Size, args_); } OwnershipAttr::OwnershipAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * Module ) : InheritableAttr(Ctx, CommonInfo, attr::Ownership, /*IsLateParsed=*/false, false) , module(Module) , args_Size(0), args_(nullptr) { } OwnershipAttr::Spelling OwnershipAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_ownership_holds; case 1: return CXX11_clang_ownership_holds; case 2: return C23_clang_ownership_holds; case 3: return GNU_ownership_returns; case 4: return CXX11_clang_ownership_returns; case 5: return C23_clang_ownership_returns; case 6: return GNU_ownership_takes; case 7: return CXX11_clang_ownership_takes; case 8: return C23_clang_ownership_takes; } } OwnershipAttr *OwnershipAttr::clone(ASTContext &C) const { auto *A = new (C) OwnershipAttr(C, *this, module, args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void OwnershipAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((ownership_holds"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getModule() ? getModule()->getName() : "") << ""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val.getSourceIndex(); } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::ownership_holds"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getModule() ? getModule()->getName() : "") << ""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val.getSourceIndex(); } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::ownership_holds"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getModule() ? getModule()->getName() : "") << ""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val.getSourceIndex(); } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 3 : { OS << "__attribute__((ownership_returns"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getModule() ? getModule()->getName() : "") << ""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val.getSourceIndex(); } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 4 : { OS << "[[clang::ownership_returns"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getModule() ? getModule()->getName() : "") << ""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val.getSourceIndex(); } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 5 : { OS << "[[clang::ownership_returns"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getModule() ? getModule()->getName() : "") << ""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val.getSourceIndex(); } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 6 : { OS << "__attribute__((ownership_takes"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getModule() ? getModule()->getName() : "") << ""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val.getSourceIndex(); } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 7 : { OS << "[[clang::ownership_takes"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getModule() ? getModule()->getName() : "") << ""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val.getSourceIndex(); } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 8 : { OS << "[[clang::ownership_takes"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getModule() ? getModule()->getName() : "") << ""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val.getSourceIndex(); } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *OwnershipAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "ownership_holds"; case 1: return "ownership_holds"; case 2: return "ownership_holds"; case 3: return "ownership_returns"; case 4: return "ownership_returns"; case 5: return "ownership_returns"; case 6: return "ownership_takes"; case 7: return "ownership_takes"; case 8: return "ownership_takes"; } } // PackedAttr implementation PackedAttr *PackedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PackedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PackedAttr *PackedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PackedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PackedAttr *PackedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_packed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_packed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_packed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_packed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_packed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_packed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } PackedAttr *PackedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_packed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_packed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_packed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_packed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_packed: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_packed, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } PackedAttr::PackedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Packed, /*IsLateParsed=*/false, false) { } PackedAttr *PackedAttr::clone(ASTContext &C) const { auto *A = new (C) PackedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PackedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((packed"; OS << "))"; break; } case 1 : { OS << "[[gnu::packed"; OS << "]]"; break; } case 2 : { OS << "[[gnu::packed"; OS << "]]"; break; } } } const char *PackedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "packed"; case 1: return "packed"; case 2: return "packed"; } } // ParamTypestateAttr implementation ParamTypestateAttr *ParamTypestateAttr::CreateImplicit(ASTContext &Ctx, ParamTypestateAttr::ConsumedState ParamState, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ParamTypestateAttr(Ctx, CommonInfo, ParamState); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ParamTypestateAttr *ParamTypestateAttr::Create(ASTContext &Ctx, ParamTypestateAttr::ConsumedState ParamState, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ParamTypestateAttr(Ctx, CommonInfo, ParamState); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ParamTypestateAttr *ParamTypestateAttr::CreateImplicit(ASTContext &Ctx, ParamTypestateAttr::ConsumedState ParamState, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_param_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_param_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_param_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_param_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, ParamState, I); } ParamTypestateAttr *ParamTypestateAttr::Create(ASTContext &Ctx, ParamTypestateAttr::ConsumedState ParamState, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_param_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_param_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_param_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_param_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, ParamState, I); } ParamTypestateAttr::ParamTypestateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , ParamTypestateAttr::ConsumedState ParamState ) : InheritableAttr(Ctx, CommonInfo, attr::ParamTypestate, /*IsLateParsed=*/false, false) , paramState(ParamState) { } bool ParamTypestateAttr::ConvertStrToConsumedState(StringRef Val, ParamTypestateAttr::ConsumedState &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("unknown", ParamTypestateAttr::ConsumedState::Unknown) .Case("consumed", ParamTypestateAttr::ConsumedState::Consumed) .Case("unconsumed", ParamTypestateAttr::ConsumedState::Unconsumed) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *ParamTypestateAttr::ConvertConsumedStateToStr(ParamTypestateAttr::ConsumedState Val) { switch(Val) { case ParamTypestateAttr::ConsumedState::Unknown: return "unknown"; case ParamTypestateAttr::ConsumedState::Consumed: return "consumed"; case ParamTypestateAttr::ConsumedState::Unconsumed: return "unconsumed"; } llvm_unreachable("No enumerator with that value"); } ParamTypestateAttr *ParamTypestateAttr::clone(ASTContext &C) const { auto *A = new (C) ParamTypestateAttr(C, *this, paramState); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ParamTypestateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((param_typestate"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << ParamTypestateAttr::ConvertConsumedStateToStr(getParamState()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::param_typestate"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << ParamTypestateAttr::ConvertConsumedStateToStr(getParamState()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ParamTypestateAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "param_typestate"; case 1: return "param_typestate"; } } // PascalAttr implementation PascalAttr *PascalAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PascalAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PascalAttr *PascalAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PascalAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PascalAttr *PascalAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_pascal: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_pascal: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_pascal: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_pascal: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } PascalAttr *PascalAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_pascal: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_pascal: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_pascal: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_pascal: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_pascal, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } PascalAttr::PascalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Pascal, /*IsLateParsed=*/false, false) { } PascalAttr *PascalAttr::clone(ASTContext &C) const { auto *A = new (C) PascalAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PascalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((pascal"; OS << "))"; break; } case 1 : { OS << "[[clang::pascal"; OS << "]]"; break; } case 2 : { OS << "[[clang::pascal"; OS << "]]"; break; } case 3 : { OS << "__pascal"; OS << ""; break; } case 4 : { OS << "_pascal"; OS << ""; break; } } } const char *PascalAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "pascal"; case 1: return "pascal"; case 2: return "pascal"; case 3: return "__pascal"; case 4: return "_pascal"; } } // PassObjectSizeAttr implementation PassObjectSizeAttr *PassObjectSizeAttr::CreateImplicit(ASTContext &Ctx, int Type, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PassObjectSizeAttr(Ctx, CommonInfo, Type); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PassObjectSizeAttr *PassObjectSizeAttr::Create(ASTContext &Ctx, int Type, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PassObjectSizeAttr(Ctx, CommonInfo, Type); return A; } PassObjectSizeAttr *PassObjectSizeAttr::CreateImplicit(ASTContext &Ctx, int Type, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_pass_object_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pass_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_pass_object_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pass_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_pass_object_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pass_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_pass_dynamic_object_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pass_dynamic_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_pass_dynamic_object_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pass_dynamic_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_pass_dynamic_object_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pass_dynamic_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Type, I); } PassObjectSizeAttr *PassObjectSizeAttr::Create(ASTContext &Ctx, int Type, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_pass_object_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pass_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_pass_object_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pass_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_pass_object_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pass_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_pass_dynamic_object_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pass_dynamic_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_pass_dynamic_object_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pass_dynamic_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_pass_dynamic_object_size: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_pass_dynamic_object_size, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Type, I); } PassObjectSizeAttr::PassObjectSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , int Type ) : InheritableParamAttr(Ctx, CommonInfo, attr::PassObjectSize, /*IsLateParsed=*/false, false) , type(Type) { } PassObjectSizeAttr::Spelling PassObjectSizeAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_pass_object_size; case 1: return CXX11_clang_pass_object_size; case 2: return C23_clang_pass_object_size; case 3: return GNU_pass_dynamic_object_size; case 4: return CXX11_clang_pass_dynamic_object_size; case 5: return C23_clang_pass_dynamic_object_size; } } PassObjectSizeAttr *PassObjectSizeAttr::clone(ASTContext &C) const { auto *A = new (C) PassObjectSizeAttr(C, *this, type); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PassObjectSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((pass_object_size"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getType() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::pass_object_size"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getType() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::pass_object_size"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getType() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 3 : { OS << "__attribute__((pass_dynamic_object_size"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getType() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 4 : { OS << "[[clang::pass_dynamic_object_size"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getType() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 5 : { OS << "[[clang::pass_dynamic_object_size"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getType() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *PassObjectSizeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "pass_object_size"; case 1: return "pass_object_size"; case 2: return "pass_object_size"; case 3: return "pass_dynamic_object_size"; case 4: return "pass_dynamic_object_size"; case 5: return "pass_dynamic_object_size"; } } // PatchableFunctionEntryAttr implementation PatchableFunctionEntryAttr *PatchableFunctionEntryAttr::CreateImplicit(ASTContext &Ctx, unsigned Count, int Offset, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PatchableFunctionEntryAttr(Ctx, CommonInfo, Count, Offset); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PatchableFunctionEntryAttr *PatchableFunctionEntryAttr::Create(ASTContext &Ctx, unsigned Count, int Offset, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PatchableFunctionEntryAttr(Ctx, CommonInfo, Count, Offset); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PatchableFunctionEntryAttr *PatchableFunctionEntryAttr::CreateImplicit(ASTContext &Ctx, unsigned Count, int Offset, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_patchable_function_entry: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_patchable_function_entry, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_patchable_function_entry: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_patchable_function_entry, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_patchable_function_entry: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_patchable_function_entry, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Count, Offset, I); } PatchableFunctionEntryAttr *PatchableFunctionEntryAttr::Create(ASTContext &Ctx, unsigned Count, int Offset, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_patchable_function_entry: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_patchable_function_entry, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_patchable_function_entry: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_patchable_function_entry, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_patchable_function_entry: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_patchable_function_entry, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Count, Offset, I); } PatchableFunctionEntryAttr::PatchableFunctionEntryAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned Count , int Offset ) : InheritableAttr(Ctx, CommonInfo, attr::PatchableFunctionEntry, /*IsLateParsed=*/false, false) , count(Count) , offset(Offset) { } PatchableFunctionEntryAttr::PatchableFunctionEntryAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned Count ) : InheritableAttr(Ctx, CommonInfo, attr::PatchableFunctionEntry, /*IsLateParsed=*/false, false) , count(Count) , offset() { } PatchableFunctionEntryAttr *PatchableFunctionEntryAttr::clone(ASTContext &C) const { auto *A = new (C) PatchableFunctionEntryAttr(C, *this, count, offset); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PatchableFunctionEntryAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((patchable_function_entry"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getCount() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getOffset() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::patchable_function_entry"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getCount() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getOffset() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::patchable_function_entry"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getCount() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getOffset() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *PatchableFunctionEntryAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "patchable_function_entry"; case 1: return "patchable_function_entry"; case 2: return "patchable_function_entry"; } } // PcsAttr implementation PcsAttr *PcsAttr::CreateImplicit(ASTContext &Ctx, PcsAttr::PCSType PCS, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PcsAttr(Ctx, CommonInfo, PCS); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PcsAttr *PcsAttr::Create(ASTContext &Ctx, PcsAttr::PCSType PCS, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PcsAttr(Ctx, CommonInfo, PCS); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PcsAttr *PcsAttr::CreateImplicit(ASTContext &Ctx, PcsAttr::PCSType PCS, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, PCS, I); } PcsAttr *PcsAttr::Create(ASTContext &Ctx, PcsAttr::PCSType PCS, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_pcs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_pcs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, PCS, I); } PcsAttr::PcsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , PcsAttr::PCSType PCS ) : InheritableAttr(Ctx, CommonInfo, attr::Pcs, /*IsLateParsed=*/false, false) , pCS(PCS) { } bool PcsAttr::ConvertStrToPCSType(StringRef Val, PcsAttr::PCSType &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("aapcs", PcsAttr::PCSType::AAPCS) .Case("aapcs-vfp", PcsAttr::PCSType::AAPCS_VFP) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *PcsAttr::ConvertPCSTypeToStr(PcsAttr::PCSType Val) { switch(Val) { case PcsAttr::PCSType::AAPCS: return "aapcs"; case PcsAttr::PCSType::AAPCS_VFP: return "aapcs-vfp"; } llvm_unreachable("No enumerator with that value"); } PcsAttr *PcsAttr::clone(ASTContext &C) const { auto *A = new (C) PcsAttr(C, *this, pCS); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PcsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((pcs"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << PcsAttr::ConvertPCSTypeToStr(getPCS()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::pcs"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << PcsAttr::ConvertPCSTypeToStr(getPCS()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::pcs"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << PcsAttr::ConvertPCSTypeToStr(getPCS()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *PcsAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "pcs"; case 1: return "pcs"; case 2: return "pcs"; } } // PointerAttr implementation PointerAttr *PointerAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * DerefType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PointerAttr(Ctx, CommonInfo, DerefType); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PointerAttr *PointerAttr::Create(ASTContext &Ctx, TypeSourceInfo * DerefType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PointerAttr(Ctx, CommonInfo, DerefType); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PointerAttr *PointerAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * DerefType, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, DerefType, I); } PointerAttr *PointerAttr::Create(ASTContext &Ctx, TypeSourceInfo * DerefType, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, DerefType, I); } PointerAttr::PointerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , TypeSourceInfo * DerefType ) : InheritableAttr(Ctx, CommonInfo, attr::Pointer, /*IsLateParsed=*/false, false) , derefType(DerefType) { } PointerAttr::PointerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Pointer, /*IsLateParsed=*/false, false) , derefType() { } PointerAttr *PointerAttr::clone(ASTContext &C) const { auto *A = new (C) PointerAttr(C, *this, derefType); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PointerAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[gsl::Pointer"; if (!getDerefTypeLoc()) ++TrailingOmittedArgs; if (!(!getDerefTypeLoc())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getDerefType().getAsString() << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *PointerAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "Pointer"; } } // PragmaClangBSSSectionAttr implementation PragmaClangBSSSectionAttr *PragmaClangBSSSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PragmaClangBSSSectionAttr(Ctx, CommonInfo, Name); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PragmaClangBSSSectionAttr *PragmaClangBSSSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PragmaClangBSSSectionAttr(Ctx, CommonInfo, Name); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PragmaClangBSSSectionAttr *PragmaClangBSSSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, Name, I); } PragmaClangBSSSectionAttr *PragmaClangBSSSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, Name, I); } PragmaClangBSSSectionAttr::PragmaClangBSSSectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Name ) : InheritableAttr(Ctx, CommonInfo, attr::PragmaClangBSSSection, /*IsLateParsed=*/false, false) , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) { if (!Name.empty()) std::memcpy(name, Name.data(), nameLength); } PragmaClangBSSSectionAttr *PragmaClangBSSSectionAttr::clone(ASTContext &C) const { auto *A = new (C) PragmaClangBSSSectionAttr(C, *this, getName()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PragmaClangBSSSectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *PragmaClangBSSSectionAttr::getSpelling() const { return "(No spelling)"; } // PragmaClangDataSectionAttr implementation PragmaClangDataSectionAttr *PragmaClangDataSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PragmaClangDataSectionAttr(Ctx, CommonInfo, Name); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PragmaClangDataSectionAttr *PragmaClangDataSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PragmaClangDataSectionAttr(Ctx, CommonInfo, Name); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PragmaClangDataSectionAttr *PragmaClangDataSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, Name, I); } PragmaClangDataSectionAttr *PragmaClangDataSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, Name, I); } PragmaClangDataSectionAttr::PragmaClangDataSectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Name ) : InheritableAttr(Ctx, CommonInfo, attr::PragmaClangDataSection, /*IsLateParsed=*/false, false) , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) { if (!Name.empty()) std::memcpy(name, Name.data(), nameLength); } PragmaClangDataSectionAttr *PragmaClangDataSectionAttr::clone(ASTContext &C) const { auto *A = new (C) PragmaClangDataSectionAttr(C, *this, getName()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PragmaClangDataSectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *PragmaClangDataSectionAttr::getSpelling() const { return "(No spelling)"; } // PragmaClangRelroSectionAttr implementation PragmaClangRelroSectionAttr *PragmaClangRelroSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PragmaClangRelroSectionAttr(Ctx, CommonInfo, Name); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PragmaClangRelroSectionAttr *PragmaClangRelroSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PragmaClangRelroSectionAttr(Ctx, CommonInfo, Name); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PragmaClangRelroSectionAttr *PragmaClangRelroSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, Name, I); } PragmaClangRelroSectionAttr *PragmaClangRelroSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, Name, I); } PragmaClangRelroSectionAttr::PragmaClangRelroSectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Name ) : InheritableAttr(Ctx, CommonInfo, attr::PragmaClangRelroSection, /*IsLateParsed=*/false, false) , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) { if (!Name.empty()) std::memcpy(name, Name.data(), nameLength); } PragmaClangRelroSectionAttr *PragmaClangRelroSectionAttr::clone(ASTContext &C) const { auto *A = new (C) PragmaClangRelroSectionAttr(C, *this, getName()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PragmaClangRelroSectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *PragmaClangRelroSectionAttr::getSpelling() const { return "(No spelling)"; } // PragmaClangRodataSectionAttr implementation PragmaClangRodataSectionAttr *PragmaClangRodataSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PragmaClangRodataSectionAttr(Ctx, CommonInfo, Name); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PragmaClangRodataSectionAttr *PragmaClangRodataSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PragmaClangRodataSectionAttr(Ctx, CommonInfo, Name); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PragmaClangRodataSectionAttr *PragmaClangRodataSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, Name, I); } PragmaClangRodataSectionAttr *PragmaClangRodataSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, Name, I); } PragmaClangRodataSectionAttr::PragmaClangRodataSectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Name ) : InheritableAttr(Ctx, CommonInfo, attr::PragmaClangRodataSection, /*IsLateParsed=*/false, false) , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) { if (!Name.empty()) std::memcpy(name, Name.data(), nameLength); } PragmaClangRodataSectionAttr *PragmaClangRodataSectionAttr::clone(ASTContext &C) const { auto *A = new (C) PragmaClangRodataSectionAttr(C, *this, getName()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PragmaClangRodataSectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *PragmaClangRodataSectionAttr::getSpelling() const { return "(No spelling)"; } // PragmaClangTextSectionAttr implementation PragmaClangTextSectionAttr *PragmaClangTextSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PragmaClangTextSectionAttr(Ctx, CommonInfo, Name); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PragmaClangTextSectionAttr *PragmaClangTextSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PragmaClangTextSectionAttr(Ctx, CommonInfo, Name); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PragmaClangTextSectionAttr *PragmaClangTextSectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, Name, I); } PragmaClangTextSectionAttr *PragmaClangTextSectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, Name, I); } PragmaClangTextSectionAttr::PragmaClangTextSectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Name ) : InheritableAttr(Ctx, CommonInfo, attr::PragmaClangTextSection, /*IsLateParsed=*/false, false) , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) { if (!Name.empty()) std::memcpy(name, Name.data(), nameLength); } PragmaClangTextSectionAttr *PragmaClangTextSectionAttr::clone(ASTContext &C) const { auto *A = new (C) PragmaClangTextSectionAttr(C, *this, getName()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PragmaClangTextSectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *PragmaClangTextSectionAttr::getSpelling() const { return "(No spelling)"; } // PreferredNameAttr implementation PreferredNameAttr *PreferredNameAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * TypedefType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PreferredNameAttr(Ctx, CommonInfo, TypedefType); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PreferredNameAttr *PreferredNameAttr::Create(ASTContext &Ctx, TypeSourceInfo * TypedefType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PreferredNameAttr(Ctx, CommonInfo, TypedefType); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PreferredNameAttr *PreferredNameAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * TypedefType, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_preferred_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preferred_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_preferred_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preferred_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, TypedefType, I); } PreferredNameAttr *PreferredNameAttr::Create(ASTContext &Ctx, TypeSourceInfo * TypedefType, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_preferred_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preferred_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_preferred_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preferred_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, TypedefType, I); } PreferredNameAttr::PreferredNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , TypeSourceInfo * TypedefType ) : InheritableAttr(Ctx, CommonInfo, attr::PreferredName, /*IsLateParsed=*/false, true) , typedefType(TypedefType) { } PreferredNameAttr *PreferredNameAttr::clone(ASTContext &C) const { auto *A = new (C) PreferredNameAttr(C, *this, typedefType); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PreferredNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((preferred_name"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getTypedefType().getAsString() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::preferred_name"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getTypedefType().getAsString() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *PreferredNameAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "preferred_name"; case 1: return "preferred_name"; } } // PreferredTypeAttr implementation PreferredTypeAttr *PreferredTypeAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * Type, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PreferredTypeAttr(Ctx, CommonInfo, Type); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PreferredTypeAttr *PreferredTypeAttr::Create(ASTContext &Ctx, TypeSourceInfo * Type, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PreferredTypeAttr(Ctx, CommonInfo, Type); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PreferredTypeAttr *PreferredTypeAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * Type, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_preferred_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preferred_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_preferred_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preferred_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_preferred_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preferred_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Type, I); } PreferredTypeAttr *PreferredTypeAttr::Create(ASTContext &Ctx, TypeSourceInfo * Type, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_preferred_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preferred_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_preferred_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preferred_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_preferred_type: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preferred_type, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Type, I); } PreferredTypeAttr::PreferredTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , TypeSourceInfo * Type ) : InheritableAttr(Ctx, CommonInfo, attr::PreferredType, /*IsLateParsed=*/false, false) , type(Type) { } PreferredTypeAttr::PreferredTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::PreferredType, /*IsLateParsed=*/false, false) , type() { } PreferredTypeAttr *PreferredTypeAttr::clone(ASTContext &C) const { auto *A = new (C) PreferredTypeAttr(C, *this, type); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PreferredTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((preferred_type"; if (!getTypeLoc()) ++TrailingOmittedArgs; if (!(!getTypeLoc())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getType().getAsString() << ""; } if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::preferred_type"; if (!getTypeLoc()) ++TrailingOmittedArgs; if (!(!getTypeLoc())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getType().getAsString() << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::preferred_type"; if (!getTypeLoc()) ++TrailingOmittedArgs; if (!(!getTypeLoc())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getType().getAsString() << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *PreferredTypeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "preferred_type"; case 1: return "preferred_type"; case 2: return "preferred_type"; } } // PreserveAllAttr implementation PreserveAllAttr *PreserveAllAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PreserveAllAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PreserveAllAttr *PreserveAllAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PreserveAllAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PreserveAllAttr *PreserveAllAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_preserve_all: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_all, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_preserve_all: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_all, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_preserve_all: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_all, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } PreserveAllAttr *PreserveAllAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_preserve_all: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_all, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_preserve_all: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_all, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_preserve_all: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_all, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } PreserveAllAttr::PreserveAllAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::PreserveAll, /*IsLateParsed=*/false, false) { } PreserveAllAttr *PreserveAllAttr::clone(ASTContext &C) const { auto *A = new (C) PreserveAllAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PreserveAllAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((preserve_all"; OS << "))"; break; } case 1 : { OS << "[[clang::preserve_all"; OS << "]]"; break; } case 2 : { OS << "[[clang::preserve_all"; OS << "]]"; break; } } } const char *PreserveAllAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "preserve_all"; case 1: return "preserve_all"; case 2: return "preserve_all"; } } // PreserveMostAttr implementation PreserveMostAttr *PreserveMostAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PreserveMostAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PreserveMostAttr *PreserveMostAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PreserveMostAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PreserveMostAttr *PreserveMostAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_preserve_most: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_most, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_preserve_most: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_most, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_preserve_most: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_most, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } PreserveMostAttr *PreserveMostAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_preserve_most: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_most, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_preserve_most: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_most, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_preserve_most: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_most, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } PreserveMostAttr::PreserveMostAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::PreserveMost, /*IsLateParsed=*/false, false) { } PreserveMostAttr *PreserveMostAttr::clone(ASTContext &C) const { auto *A = new (C) PreserveMostAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PreserveMostAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((preserve_most"; OS << "))"; break; } case 1 : { OS << "[[clang::preserve_most"; OS << "]]"; break; } case 2 : { OS << "[[clang::preserve_most"; OS << "]]"; break; } } } const char *PreserveMostAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "preserve_most"; case 1: return "preserve_most"; case 2: return "preserve_most"; } } // PreserveNoneAttr implementation PreserveNoneAttr *PreserveNoneAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PreserveNoneAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PreserveNoneAttr *PreserveNoneAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PreserveNoneAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PreserveNoneAttr *PreserveNoneAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_preserve_none: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_none, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_preserve_none: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_none, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_preserve_none: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_none, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } PreserveNoneAttr *PreserveNoneAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_preserve_none: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_preserve_none, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_preserve_none: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_preserve_none, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_preserve_none: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_preserve_none, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } PreserveNoneAttr::PreserveNoneAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::PreserveNone, /*IsLateParsed=*/false, false) { } PreserveNoneAttr *PreserveNoneAttr::clone(ASTContext &C) const { auto *A = new (C) PreserveNoneAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PreserveNoneAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((preserve_none"; OS << "))"; break; } case 1 : { OS << "[[clang::preserve_none"; OS << "]]"; break; } case 2 : { OS << "[[clang::preserve_none"; OS << "]]"; break; } } } const char *PreserveNoneAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "preserve_none"; case 1: return "preserve_none"; case 2: return "preserve_none"; } } // PtGuardedByAttr implementation PtGuardedByAttr *PtGuardedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PtGuardedByAttr(Ctx, CommonInfo, Arg); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PtGuardedByAttr *PtGuardedByAttr::Create(ASTContext &Ctx, Expr * Arg, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PtGuardedByAttr(Ctx, CommonInfo, Arg); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PtGuardedByAttr *PtGuardedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Arg, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Arg, I); } PtGuardedByAttr *PtGuardedByAttr::Create(ASTContext &Ctx, Expr * Arg, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Arg, I); } PtGuardedByAttr::PtGuardedByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Arg ) : InheritableAttr(Ctx, CommonInfo, attr::PtGuardedBy, /*IsLateParsed=*/true, true) , arg(Arg) { } PtGuardedByAttr *PtGuardedByAttr::clone(ASTContext &C) const { auto *A = new (C) PtGuardedByAttr(C, *this, arg); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PtGuardedByAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((pt_guarded_by"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getArg()->printPretty(OS, nullptr, Policy); OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *PtGuardedByAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "pt_guarded_by"; } } // PtGuardedVarAttr implementation PtGuardedVarAttr *PtGuardedVarAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PtGuardedVarAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PtGuardedVarAttr *PtGuardedVarAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PtGuardedVarAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PtGuardedVarAttr *PtGuardedVarAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_pt_guarded_var: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pt_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_pt_guarded_var: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pt_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } PtGuardedVarAttr *PtGuardedVarAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_pt_guarded_var: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pt_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_pt_guarded_var: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_pt_guarded_var, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } PtGuardedVarAttr::PtGuardedVarAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::PtGuardedVar, /*IsLateParsed=*/false, false) { } PtGuardedVarAttr *PtGuardedVarAttr::clone(ASTContext &C) const { auto *A = new (C) PtGuardedVarAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PtGuardedVarAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((pt_guarded_var"; OS << "))"; break; } case 1 : { OS << "[[clang::pt_guarded_var"; OS << "]]"; break; } } } const char *PtGuardedVarAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "pt_guarded_var"; case 1: return "pt_guarded_var"; } } // Ptr32Attr implementation Ptr32Attr *Ptr32Attr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) Ptr32Attr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } Ptr32Attr *Ptr32Attr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) Ptr32Attr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } Ptr32Attr *Ptr32Attr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } Ptr32Attr *Ptr32Attr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } Ptr32Attr::Ptr32Attr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::Ptr32, /*IsLateParsed=*/false) { } Ptr32Attr *Ptr32Attr::clone(ASTContext &C) const { auto *A = new (C) Ptr32Attr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void Ptr32Attr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__ptr32"; OS << ""; break; } } } const char *Ptr32Attr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__ptr32"; } } // Ptr64Attr implementation Ptr64Attr *Ptr64Attr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) Ptr64Attr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } Ptr64Attr *Ptr64Attr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) Ptr64Attr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } Ptr64Attr *Ptr64Attr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } Ptr64Attr *Ptr64Attr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } Ptr64Attr::Ptr64Attr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::Ptr64, /*IsLateParsed=*/false) { } Ptr64Attr *Ptr64Attr::clone(ASTContext &C) const { auto *A = new (C) Ptr64Attr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void Ptr64Attr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__ptr64"; OS << ""; break; } } } const char *Ptr64Attr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__ptr64"; } } // PureAttr implementation PureAttr *PureAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PureAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PureAttr *PureAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) PureAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } PureAttr *PureAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_pure: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pure, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_pure: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_pure, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_pure: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_pure, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } PureAttr *PureAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_pure: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_pure, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_pure: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_pure, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_pure: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_pure, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } PureAttr::PureAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Pure, /*IsLateParsed=*/false, false) { } PureAttr *PureAttr::clone(ASTContext &C) const { auto *A = new (C) PureAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void PureAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((pure"; OS << "))"; break; } case 1 : { OS << "[[gnu::pure"; OS << "]]"; break; } case 2 : { OS << "[[gnu::pure"; OS << "]]"; break; } } } const char *PureAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "pure"; case 1: return "pure"; case 2: return "pure"; } } // RISCVInterruptAttr implementation RISCVInterruptAttr *RISCVInterruptAttr::CreateImplicit(ASTContext &Ctx, RISCVInterruptAttr::InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RISCVInterruptAttr(Ctx, CommonInfo, Interrupt); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } RISCVInterruptAttr *RISCVInterruptAttr::Create(ASTContext &Ctx, RISCVInterruptAttr::InterruptType Interrupt, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RISCVInterruptAttr(Ctx, CommonInfo, Interrupt); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } RISCVInterruptAttr *RISCVInterruptAttr::CreateImplicit(ASTContext &Ctx, RISCVInterruptAttr::InterruptType Interrupt, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Interrupt, I); } RISCVInterruptAttr *RISCVInterruptAttr::Create(ASTContext &Ctx, RISCVInterruptAttr::InterruptType Interrupt, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_interrupt: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_interrupt, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Interrupt, I); } RISCVInterruptAttr::RISCVInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , RISCVInterruptAttr::InterruptType Interrupt ) : InheritableAttr(Ctx, CommonInfo, attr::RISCVInterrupt, /*IsLateParsed=*/false, false) , interrupt(Interrupt) { } RISCVInterruptAttr::RISCVInterruptAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::RISCVInterrupt, /*IsLateParsed=*/false, false) , interrupt(RISCVInterruptAttr::InterruptType(0)) { } bool RISCVInterruptAttr::ConvertStrToInterruptType(StringRef Val, RISCVInterruptAttr::InterruptType &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("supervisor", RISCVInterruptAttr::InterruptType::supervisor) .Case("machine", RISCVInterruptAttr::InterruptType::machine) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *RISCVInterruptAttr::ConvertInterruptTypeToStr(RISCVInterruptAttr::InterruptType Val) { switch(Val) { case RISCVInterruptAttr::InterruptType::supervisor: return "supervisor"; case RISCVInterruptAttr::InterruptType::machine: return "machine"; } llvm_unreachable("No enumerator with that value"); } RISCVInterruptAttr *RISCVInterruptAttr::clone(ASTContext &C) const { auto *A = new (C) RISCVInterruptAttr(C, *this, interrupt); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void RISCVInterruptAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((interrupt"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << RISCVInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::interrupt"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << RISCVInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::interrupt"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << RISCVInterruptAttr::ConvertInterruptTypeToStr(getInterrupt()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *RISCVInterruptAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "interrupt"; case 1: return "interrupt"; case 2: return "interrupt"; } } // RISCVVectorCCAttr implementation RISCVVectorCCAttr *RISCVVectorCCAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RISCVVectorCCAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } RISCVVectorCCAttr *RISCVVectorCCAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RISCVVectorCCAttr(Ctx, CommonInfo); return A; } RISCVVectorCCAttr *RISCVVectorCCAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_riscv_vector_cc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_riscv_vector_cc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_riscv_vector_cc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_riscv_vector_cc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_riscv_vector_cc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } RISCVVectorCCAttr *RISCVVectorCCAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_riscv_vector_cc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_riscv_vector_cc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_riscv_vector_cc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_riscv_vector_cc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_riscv_vector_cc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_riscv_vector_cc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } RISCVVectorCCAttr::RISCVVectorCCAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::RISCVVectorCC, /*IsLateParsed=*/false, false) { } RISCVVectorCCAttr::Spelling RISCVVectorCCAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return CXX11_riscv_vector_cc; case 1: return C23_riscv_vector_cc; case 2: return GNU_riscv_vector_cc; case 3: return CXX11_clang_riscv_vector_cc; case 4: return C23_clang_riscv_vector_cc; } } RISCVVectorCCAttr *RISCVVectorCCAttr::clone(ASTContext &C) const { auto *A = new (C) RISCVVectorCCAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void RISCVVectorCCAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[riscv::vector_cc"; OS << "]]"; break; } case 1 : { OS << "[[riscv::vector_cc"; OS << "]]"; break; } case 2 : { OS << "__attribute__((riscv_vector_cc"; OS << "))"; break; } case 3 : { OS << "[[clang::riscv_vector_cc"; OS << "]]"; break; } case 4 : { OS << "[[clang::riscv_vector_cc"; OS << "]]"; break; } } } const char *RISCVVectorCCAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "vector_cc"; case 1: return "vector_cc"; case 2: return "riscv_vector_cc"; case 3: return "riscv_vector_cc"; case 4: return "riscv_vector_cc"; } } // RandomizeLayoutAttr implementation RandomizeLayoutAttr *RandomizeLayoutAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RandomizeLayoutAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } RandomizeLayoutAttr *RandomizeLayoutAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RandomizeLayoutAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } RandomizeLayoutAttr *RandomizeLayoutAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_randomize_layout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_randomize_layout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_randomize_layout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } RandomizeLayoutAttr *RandomizeLayoutAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_randomize_layout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_randomize_layout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_randomize_layout: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_randomize_layout, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } RandomizeLayoutAttr::RandomizeLayoutAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::RandomizeLayout, /*IsLateParsed=*/false, false) { } RandomizeLayoutAttr *RandomizeLayoutAttr::clone(ASTContext &C) const { auto *A = new (C) RandomizeLayoutAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void RandomizeLayoutAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((randomize_layout"; OS << "))"; break; } case 1 : { OS << "[[gnu::randomize_layout"; OS << "]]"; break; } case 2 : { OS << "[[gnu::randomize_layout"; OS << "]]"; break; } } } const char *RandomizeLayoutAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "randomize_layout"; case 1: return "randomize_layout"; case 2: return "randomize_layout"; } } // ReadOnlyPlacementAttr implementation ReadOnlyPlacementAttr *ReadOnlyPlacementAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReadOnlyPlacementAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ReadOnlyPlacementAttr *ReadOnlyPlacementAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReadOnlyPlacementAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ReadOnlyPlacementAttr *ReadOnlyPlacementAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_enforce_read_only_placement: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enforce_read_only_placement, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_enforce_read_only_placement: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enforce_read_only_placement, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_enforce_read_only_placement: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enforce_read_only_placement, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ReadOnlyPlacementAttr *ReadOnlyPlacementAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_enforce_read_only_placement: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_enforce_read_only_placement, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_enforce_read_only_placement: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_enforce_read_only_placement, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_enforce_read_only_placement: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_enforce_read_only_placement, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ReadOnlyPlacementAttr::ReadOnlyPlacementAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ReadOnlyPlacement, /*IsLateParsed=*/false, false) { } ReadOnlyPlacementAttr *ReadOnlyPlacementAttr::clone(ASTContext &C) const { auto *A = new (C) ReadOnlyPlacementAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ReadOnlyPlacementAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((enforce_read_only_placement"; OS << "))"; break; } case 1 : { OS << "[[clang::enforce_read_only_placement"; OS << "]]"; break; } case 2 : { OS << "[[clang::enforce_read_only_placement"; OS << "]]"; break; } } } const char *ReadOnlyPlacementAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "enforce_read_only_placement"; case 1: return "enforce_read_only_placement"; case 2: return "enforce_read_only_placement"; } } // RegCallAttr implementation RegCallAttr *RegCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RegCallAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } RegCallAttr *RegCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RegCallAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } RegCallAttr *RegCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_regcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_regcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_regcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_regcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } RegCallAttr *RegCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_regcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_regcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_regcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_regcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_regcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } RegCallAttr::RegCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::RegCall, /*IsLateParsed=*/false, false) { } RegCallAttr *RegCallAttr::clone(ASTContext &C) const { auto *A = new (C) RegCallAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void RegCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((regcall"; OS << "))"; break; } case 1 : { OS << "[[gnu::regcall"; OS << "]]"; break; } case 2 : { OS << "[[gnu::regcall"; OS << "]]"; break; } case 3 : { OS << "__regcall"; OS << ""; break; } } } const char *RegCallAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "regcall"; case 1: return "regcall"; case 2: return "regcall"; case 3: return "__regcall"; } } // ReinitializesAttr implementation ReinitializesAttr *ReinitializesAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReinitializesAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ReinitializesAttr *ReinitializesAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReinitializesAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ReinitializesAttr *ReinitializesAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_reinitializes: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_reinitializes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_reinitializes: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_reinitializes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ReinitializesAttr *ReinitializesAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_reinitializes: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_reinitializes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_reinitializes: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_reinitializes, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ReinitializesAttr::ReinitializesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Reinitializes, /*IsLateParsed=*/false, false) { } ReinitializesAttr *ReinitializesAttr::clone(ASTContext &C) const { auto *A = new (C) ReinitializesAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ReinitializesAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((reinitializes"; OS << "))"; break; } case 1 : { OS << "[[clang::reinitializes"; OS << "]]"; break; } } } const char *ReinitializesAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "reinitializes"; case 1: return "reinitializes"; } } // ReleaseCapabilityAttr implementation ReleaseCapabilityAttr *ReleaseCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReleaseCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ReleaseCapabilityAttr *ReleaseCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReleaseCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); return A; } ReleaseCapabilityAttr *ReleaseCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_release_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_release_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_release_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_release_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_release_generic_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_generic_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_release_generic_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_generic_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_unlock_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unlock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_unlock_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unlock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Args, ArgsSize, I); } ReleaseCapabilityAttr *ReleaseCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_release_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_release_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_release_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_release_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_release_generic_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_generic_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_release_generic_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_generic_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_unlock_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unlock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_unlock_function: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unlock_function, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Args, ArgsSize, I); } ReleaseCapabilityAttr::ReleaseCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * *Args, unsigned ArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::ReleaseCapability, /*IsLateParsed=*/true, true) , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) { std::copy(Args, Args + args_Size, args_); } ReleaseCapabilityAttr::ReleaseCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ReleaseCapability, /*IsLateParsed=*/true, true) , args_Size(0), args_(nullptr) { } ReleaseCapabilityAttr::Spelling ReleaseCapabilityAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_release_capability; case 1: return CXX11_clang_release_capability; case 2: return GNU_release_shared_capability; case 3: return CXX11_clang_release_shared_capability; case 4: return GNU_release_generic_capability; case 5: return CXX11_clang_release_generic_capability; case 6: return GNU_unlock_function; case 7: return CXX11_clang_unlock_function; } } ReleaseCapabilityAttr *ReleaseCapabilityAttr::clone(ASTContext &C) const { auto *A = new (C) ReleaseCapabilityAttr(C, *this, args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ReleaseCapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((release_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::release_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "__attribute__((release_shared_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 3 : { OS << "[[clang::release_shared_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 4 : { OS << "__attribute__((release_generic_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 5 : { OS << "[[clang::release_generic_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 6 : { OS << "__attribute__((unlock_function"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 7 : { OS << "[[clang::unlock_function"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ReleaseCapabilityAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "release_capability"; case 1: return "release_capability"; case 2: return "release_shared_capability"; case 3: return "release_shared_capability"; case 4: return "release_generic_capability"; case 5: return "release_generic_capability"; case 6: return "unlock_function"; case 7: return "unlock_function"; } } // ReleaseHandleAttr implementation ReleaseHandleAttr *ReleaseHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReleaseHandleAttr(Ctx, CommonInfo, HandleType); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ReleaseHandleAttr *ReleaseHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReleaseHandleAttr(Ctx, CommonInfo, HandleType); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ReleaseHandleAttr *ReleaseHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_release_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_release_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_release_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_release_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, HandleType, I); } ReleaseHandleAttr *ReleaseHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_release_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_release_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_release_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_release_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_release_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_release_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, HandleType, I); } ReleaseHandleAttr::ReleaseHandleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef HandleType ) : InheritableParamAttr(Ctx, CommonInfo, attr::ReleaseHandle, /*IsLateParsed=*/false, false) , handleTypeLength(HandleType.size()),handleType(new (Ctx, 1) char[handleTypeLength]) { if (!HandleType.empty()) std::memcpy(handleType, HandleType.data(), handleTypeLength); } ReleaseHandleAttr *ReleaseHandleAttr::clone(ASTContext &C) const { auto *A = new (C) ReleaseHandleAttr(C, *this, getHandleType()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ReleaseHandleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((release_handle"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getHandleType() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::release_handle"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getHandleType() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::release_handle"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getHandleType() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ReleaseHandleAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "release_handle"; case 1: return "release_handle"; case 2: return "release_handle"; } } // RenderScriptKernelAttr implementation RenderScriptKernelAttr *RenderScriptKernelAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RenderScriptKernelAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } RenderScriptKernelAttr *RenderScriptKernelAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RenderScriptKernelAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } RenderScriptKernelAttr *RenderScriptKernelAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } RenderScriptKernelAttr *RenderScriptKernelAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } RenderScriptKernelAttr::RenderScriptKernelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::RenderScriptKernel, /*IsLateParsed=*/false) { } RenderScriptKernelAttr *RenderScriptKernelAttr::clone(ASTContext &C) const { auto *A = new (C) RenderScriptKernelAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void RenderScriptKernelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((kernel"; OS << "))"; break; } } } const char *RenderScriptKernelAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "kernel"; } } // ReqdWorkGroupSizeAttr implementation ReqdWorkGroupSizeAttr *ReqdWorkGroupSizeAttr::CreateImplicit(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReqdWorkGroupSizeAttr(Ctx, CommonInfo, XDim, YDim, ZDim); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ReqdWorkGroupSizeAttr *ReqdWorkGroupSizeAttr::Create(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReqdWorkGroupSizeAttr(Ctx, CommonInfo, XDim, YDim, ZDim); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ReqdWorkGroupSizeAttr *ReqdWorkGroupSizeAttr::CreateImplicit(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, XDim, YDim, ZDim, I); } ReqdWorkGroupSizeAttr *ReqdWorkGroupSizeAttr::Create(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, XDim, YDim, ZDim, I); } ReqdWorkGroupSizeAttr::ReqdWorkGroupSizeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned XDim , unsigned YDim , unsigned ZDim ) : InheritableAttr(Ctx, CommonInfo, attr::ReqdWorkGroupSize, /*IsLateParsed=*/false, false) , xDim(XDim) , yDim(YDim) , zDim(ZDim) { } ReqdWorkGroupSizeAttr *ReqdWorkGroupSizeAttr::clone(ASTContext &C) const { auto *A = new (C) ReqdWorkGroupSizeAttr(C, *this, xDim, yDim, zDim); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ReqdWorkGroupSizeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((reqd_work_group_size"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getXDim() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getYDim() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getZDim() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *ReqdWorkGroupSizeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "reqd_work_group_size"; } } // RequiresCapabilityAttr implementation RequiresCapabilityAttr *RequiresCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RequiresCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } RequiresCapabilityAttr *RequiresCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RequiresCapabilityAttr(Ctx, CommonInfo, Args, ArgsSize); return A; } RequiresCapabilityAttr *RequiresCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_requires_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_requires_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_requires_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_requires_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_exclusive_locks_required: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_exclusive_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_exclusive_locks_required: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_exclusive_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_requires_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_requires_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_requires_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_requires_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_shared_locks_required: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_shared_locks_required: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_shared_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Args, ArgsSize, I); } RequiresCapabilityAttr *RequiresCapabilityAttr::Create(ASTContext &Ctx, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_requires_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_requires_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_requires_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_requires_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_exclusive_locks_required: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_exclusive_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_exclusive_locks_required: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_exclusive_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_requires_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_requires_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_requires_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_requires_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_shared_locks_required: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_shared_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_shared_locks_required: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_shared_locks_required, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Args, ArgsSize, I); } RequiresCapabilityAttr::RequiresCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * *Args, unsigned ArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::RequiresCapability, /*IsLateParsed=*/true, true) , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) { std::copy(Args, Args + args_Size, args_); } RequiresCapabilityAttr::RequiresCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::RequiresCapability, /*IsLateParsed=*/true, true) , args_Size(0), args_(nullptr) { } RequiresCapabilityAttr::Spelling RequiresCapabilityAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_requires_capability; case 1: return CXX11_clang_requires_capability; case 2: return GNU_exclusive_locks_required; case 3: return CXX11_clang_exclusive_locks_required; case 4: return GNU_requires_shared_capability; case 5: return CXX11_clang_requires_shared_capability; case 6: return GNU_shared_locks_required; case 7: return CXX11_clang_shared_locks_required; } } RequiresCapabilityAttr *RequiresCapabilityAttr::clone(ASTContext &C) const { auto *A = new (C) RequiresCapabilityAttr(C, *this, args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void RequiresCapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((requires_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::requires_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "__attribute__((exclusive_locks_required"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 3 : { OS << "[[clang::exclusive_locks_required"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 4 : { OS << "__attribute__((requires_shared_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 5 : { OS << "[[clang::requires_shared_capability"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 6 : { OS << "__attribute__((shared_locks_required"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 7 : { OS << "[[clang::shared_locks_required"; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *RequiresCapabilityAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "requires_capability"; case 1: return "requires_capability"; case 2: return "exclusive_locks_required"; case 3: return "exclusive_locks_required"; case 4: return "requires_shared_capability"; case 5: return "requires_shared_capability"; case 6: return "shared_locks_required"; case 7: return "shared_locks_required"; } } // RestrictAttr implementation RestrictAttr *RestrictAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RestrictAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } RestrictAttr *RestrictAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RestrictAttr(Ctx, CommonInfo); return A; } RestrictAttr *RestrictAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_restrict: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_restrict, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_malloc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_malloc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_malloc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_malloc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_malloc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_malloc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } RestrictAttr *RestrictAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_restrict: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_restrict, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_malloc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_malloc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_malloc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_malloc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_malloc: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_malloc, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } RestrictAttr::RestrictAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Restrict, /*IsLateParsed=*/false, false) { } RestrictAttr::Spelling RestrictAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return Declspec_restrict; case 1: return GNU_malloc; case 2: return CXX11_gnu_malloc; case 3: return C23_gnu_malloc; } } RestrictAttr *RestrictAttr::clone(ASTContext &C) const { auto *A = new (C) RestrictAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void RestrictAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__declspec(restrict"; OS << ")"; break; } case 1 : { OS << "__attribute__((malloc"; OS << "))"; break; } case 2 : { OS << "[[gnu::malloc"; OS << "]]"; break; } case 3 : { OS << "[[gnu::malloc"; OS << "]]"; break; } } } const char *RestrictAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "restrict"; case 1: return "malloc"; case 2: return "malloc"; case 3: return "malloc"; } } // RetainAttr implementation RetainAttr *RetainAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RetainAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } RetainAttr *RetainAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) RetainAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } RetainAttr *RetainAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_retain: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_retain, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_retain: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_retain, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_retain: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_retain, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } RetainAttr *RetainAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_retain: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_retain, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_retain: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_retain, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_retain: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_retain, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } RetainAttr::RetainAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Retain, /*IsLateParsed=*/false, false) { } RetainAttr *RetainAttr::clone(ASTContext &C) const { auto *A = new (C) RetainAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void RetainAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((retain"; OS << "))"; break; } case 1 : { OS << "[[gnu::retain"; OS << "]]"; break; } case 2 : { OS << "[[gnu::retain"; OS << "]]"; break; } } } const char *RetainAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "retain"; case 1: return "retain"; case 2: return "retain"; } } // ReturnTypestateAttr implementation ReturnTypestateAttr *ReturnTypestateAttr::CreateImplicit(ASTContext &Ctx, ReturnTypestateAttr::ConsumedState State, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReturnTypestateAttr(Ctx, CommonInfo, State); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ReturnTypestateAttr *ReturnTypestateAttr::Create(ASTContext &Ctx, ReturnTypestateAttr::ConsumedState State, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReturnTypestateAttr(Ctx, CommonInfo, State); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ReturnTypestateAttr *ReturnTypestateAttr::CreateImplicit(ASTContext &Ctx, ReturnTypestateAttr::ConsumedState State, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_return_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_return_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_return_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_return_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, State, I); } ReturnTypestateAttr *ReturnTypestateAttr::Create(ASTContext &Ctx, ReturnTypestateAttr::ConsumedState State, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_return_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_return_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_return_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_return_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, State, I); } ReturnTypestateAttr::ReturnTypestateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , ReturnTypestateAttr::ConsumedState State ) : InheritableAttr(Ctx, CommonInfo, attr::ReturnTypestate, /*IsLateParsed=*/false, false) , state(State) { } bool ReturnTypestateAttr::ConvertStrToConsumedState(StringRef Val, ReturnTypestateAttr::ConsumedState &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("unknown", ReturnTypestateAttr::ConsumedState::Unknown) .Case("consumed", ReturnTypestateAttr::ConsumedState::Consumed) .Case("unconsumed", ReturnTypestateAttr::ConsumedState::Unconsumed) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *ReturnTypestateAttr::ConvertConsumedStateToStr(ReturnTypestateAttr::ConsumedState Val) { switch(Val) { case ReturnTypestateAttr::ConsumedState::Unknown: return "unknown"; case ReturnTypestateAttr::ConsumedState::Consumed: return "consumed"; case ReturnTypestateAttr::ConsumedState::Unconsumed: return "unconsumed"; } llvm_unreachable("No enumerator with that value"); } ReturnTypestateAttr *ReturnTypestateAttr::clone(ASTContext &C) const { auto *A = new (C) ReturnTypestateAttr(C, *this, state); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ReturnTypestateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((return_typestate"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << ReturnTypestateAttr::ConvertConsumedStateToStr(getState()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::return_typestate"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << ReturnTypestateAttr::ConvertConsumedStateToStr(getState()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ReturnTypestateAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "return_typestate"; case 1: return "return_typestate"; } } // ReturnsNonNullAttr implementation ReturnsNonNullAttr *ReturnsNonNullAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReturnsNonNullAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ReturnsNonNullAttr *ReturnsNonNullAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReturnsNonNullAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ReturnsNonNullAttr *ReturnsNonNullAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_returns_nonnull: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_returns_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_returns_nonnull: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_returns_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_returns_nonnull: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_returns_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ReturnsNonNullAttr *ReturnsNonNullAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_returns_nonnull: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_returns_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_returns_nonnull: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_returns_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_returns_nonnull: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_returns_nonnull, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ReturnsNonNullAttr::ReturnsNonNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ReturnsNonNull, /*IsLateParsed=*/false, false) { } ReturnsNonNullAttr *ReturnsNonNullAttr::clone(ASTContext &C) const { auto *A = new (C) ReturnsNonNullAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ReturnsNonNullAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((returns_nonnull"; OS << "))"; break; } case 1 : { OS << "[[gnu::returns_nonnull"; OS << "]]"; break; } case 2 : { OS << "[[gnu::returns_nonnull"; OS << "]]"; break; } } } const char *ReturnsNonNullAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "returns_nonnull"; case 1: return "returns_nonnull"; case 2: return "returns_nonnull"; } } // ReturnsTwiceAttr implementation ReturnsTwiceAttr *ReturnsTwiceAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReturnsTwiceAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ReturnsTwiceAttr *ReturnsTwiceAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ReturnsTwiceAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ReturnsTwiceAttr *ReturnsTwiceAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_returns_twice: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_returns_twice, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_returns_twice: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_returns_twice, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_returns_twice: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_returns_twice, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ReturnsTwiceAttr *ReturnsTwiceAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_returns_twice: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_returns_twice, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_returns_twice: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_returns_twice, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_returns_twice: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_returns_twice, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ReturnsTwiceAttr::ReturnsTwiceAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ReturnsTwice, /*IsLateParsed=*/false, false) { } ReturnsTwiceAttr *ReturnsTwiceAttr::clone(ASTContext &C) const { auto *A = new (C) ReturnsTwiceAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ReturnsTwiceAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((returns_twice"; OS << "))"; break; } case 1 : { OS << "[[gnu::returns_twice"; OS << "]]"; break; } case 2 : { OS << "[[gnu::returns_twice"; OS << "]]"; break; } } } const char *ReturnsTwiceAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "returns_twice"; case 1: return "returns_twice"; case 2: return "returns_twice"; } } // SPtrAttr implementation SPtrAttr *SPtrAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SPtrAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SPtrAttr *SPtrAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SPtrAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SPtrAttr *SPtrAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } SPtrAttr *SPtrAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } SPtrAttr::SPtrAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::SPtr, /*IsLateParsed=*/false) { } SPtrAttr *SPtrAttr::clone(ASTContext &C) const { auto *A = new (C) SPtrAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SPtrAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__sptr"; OS << ""; break; } } } const char *SPtrAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__sptr"; } } // SYCLKernelAttr implementation SYCLKernelAttr *SYCLKernelAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SYCLKernelAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SYCLKernelAttr *SYCLKernelAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SYCLKernelAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SYCLKernelAttr *SYCLKernelAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_sycl_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sycl_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_sycl_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sycl_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_sycl_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sycl_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } SYCLKernelAttr *SYCLKernelAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_sycl_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sycl_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_sycl_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sycl_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_sycl_kernel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sycl_kernel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } SYCLKernelAttr::SYCLKernelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::SYCLKernel, /*IsLateParsed=*/false, false) { } SYCLKernelAttr *SYCLKernelAttr::clone(ASTContext &C) const { auto *A = new (C) SYCLKernelAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SYCLKernelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((sycl_kernel"; OS << "))"; break; } case 1 : { OS << "[[clang::sycl_kernel"; OS << "]]"; break; } case 2 : { OS << "[[clang::sycl_kernel"; OS << "]]"; break; } } } const char *SYCLKernelAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "sycl_kernel"; case 1: return "sycl_kernel"; case 2: return "sycl_kernel"; } } // SYCLSpecialClassAttr implementation SYCLSpecialClassAttr *SYCLSpecialClassAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SYCLSpecialClassAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SYCLSpecialClassAttr *SYCLSpecialClassAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SYCLSpecialClassAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SYCLSpecialClassAttr *SYCLSpecialClassAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_sycl_special_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sycl_special_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_sycl_special_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sycl_special_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_sycl_special_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sycl_special_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } SYCLSpecialClassAttr *SYCLSpecialClassAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_sycl_special_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sycl_special_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_sycl_special_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sycl_special_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_sycl_special_class: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sycl_special_class, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } SYCLSpecialClassAttr::SYCLSpecialClassAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::SYCLSpecialClass, /*IsLateParsed=*/false, false) { } SYCLSpecialClassAttr *SYCLSpecialClassAttr::clone(ASTContext &C) const { auto *A = new (C) SYCLSpecialClassAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SYCLSpecialClassAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((sycl_special_class"; OS << "))"; break; } case 1 : { OS << "[[clang::sycl_special_class"; OS << "]]"; break; } case 2 : { OS << "[[clang::sycl_special_class"; OS << "]]"; break; } } } const char *SYCLSpecialClassAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "sycl_special_class"; case 1: return "sycl_special_class"; case 2: return "sycl_special_class"; } } // ScopedLockableAttr implementation ScopedLockableAttr *ScopedLockableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ScopedLockableAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ScopedLockableAttr *ScopedLockableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ScopedLockableAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ScopedLockableAttr *ScopedLockableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_scoped_lockable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_scoped_lockable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_scoped_lockable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_scoped_lockable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ScopedLockableAttr *ScopedLockableAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_scoped_lockable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_scoped_lockable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_scoped_lockable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_scoped_lockable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ScopedLockableAttr::ScopedLockableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ScopedLockable, /*IsLateParsed=*/false, false) { } ScopedLockableAttr *ScopedLockableAttr::clone(ASTContext &C) const { auto *A = new (C) ScopedLockableAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ScopedLockableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((scoped_lockable"; OS << "))"; break; } case 1 : { OS << "[[clang::scoped_lockable"; OS << "]]"; break; } } } const char *ScopedLockableAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "scoped_lockable"; case 1: return "scoped_lockable"; } } // SectionAttr implementation SectionAttr *SectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SectionAttr(Ctx, CommonInfo, Name); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SectionAttr *SectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SectionAttr(Ctx, CommonInfo, Name); return A; } SectionAttr *SectionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_section: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_section, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_section: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_section, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_section: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_section, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_allocate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_allocate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Name, I); } SectionAttr *SectionAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_section: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_section, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_section: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_section, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_section: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_section, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Declspec_allocate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_allocate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Name, I); } SectionAttr::SectionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Name ) : InheritableAttr(Ctx, CommonInfo, attr::Section, /*IsLateParsed=*/false, false) , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) { if (!Name.empty()) std::memcpy(name, Name.data(), nameLength); } SectionAttr::Spelling SectionAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_section; case 1: return CXX11_gnu_section; case 2: return C23_gnu_section; case 3: return Declspec_allocate; } } SectionAttr *SectionAttr::clone(ASTContext &C) const { auto *A = new (C) SectionAttr(C, *this, getName()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SectionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((section"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::section"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::section"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 3 : { OS << "__declspec(allocate"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getName() << "\""; if (!IsFirstArgument) OS << ")"; OS << ")"; break; } } } const char *SectionAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "section"; case 1: return "section"; case 2: return "section"; case 3: return "allocate"; } } // SelectAnyAttr implementation SelectAnyAttr *SelectAnyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SelectAnyAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SelectAnyAttr *SelectAnyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SelectAnyAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SelectAnyAttr *SelectAnyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_selectany: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_selectany: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_selectany: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_selectany: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } SelectAnyAttr *SelectAnyAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_selectany: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_selectany: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_selectany: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_selectany: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_selectany, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } SelectAnyAttr::SelectAnyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::SelectAny, /*IsLateParsed=*/false, false) { } SelectAnyAttr *SelectAnyAttr::clone(ASTContext &C) const { auto *A = new (C) SelectAnyAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SelectAnyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__declspec(selectany"; OS << ")"; break; } case 1 : { OS << "__attribute__((selectany"; OS << "))"; break; } case 2 : { OS << "[[gnu::selectany"; OS << "]]"; break; } case 3 : { OS << "[[gnu::selectany"; OS << "]]"; break; } } } const char *SelectAnyAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "selectany"; case 1: return "selectany"; case 2: return "selectany"; case 3: return "selectany"; } } // SentinelAttr implementation SentinelAttr *SentinelAttr::CreateImplicit(ASTContext &Ctx, int Sentinel, int NullPos, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SentinelAttr(Ctx, CommonInfo, Sentinel, NullPos); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SentinelAttr *SentinelAttr::Create(ASTContext &Ctx, int Sentinel, int NullPos, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SentinelAttr(Ctx, CommonInfo, Sentinel, NullPos); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SentinelAttr *SentinelAttr::CreateImplicit(ASTContext &Ctx, int Sentinel, int NullPos, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_sentinel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sentinel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_sentinel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_sentinel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_sentinel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_sentinel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Sentinel, NullPos, I); } SentinelAttr *SentinelAttr::Create(ASTContext &Ctx, int Sentinel, int NullPos, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_sentinel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sentinel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_sentinel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_sentinel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_sentinel: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_sentinel, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Sentinel, NullPos, I); } SentinelAttr::SentinelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , int Sentinel , int NullPos ) : InheritableAttr(Ctx, CommonInfo, attr::Sentinel, /*IsLateParsed=*/false, false) , sentinel(Sentinel) , nullPos(NullPos) { } SentinelAttr::SentinelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Sentinel, /*IsLateParsed=*/false, false) , sentinel() , nullPos() { } SentinelAttr *SentinelAttr::clone(ASTContext &C) const { auto *A = new (C) SentinelAttr(C, *this, sentinel, nullPos); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SentinelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((sentinel"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getSentinel() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNullPos() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::sentinel"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getSentinel() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNullPos() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::sentinel"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getSentinel() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNullPos() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *SentinelAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "sentinel"; case 1: return "sentinel"; case 2: return "sentinel"; } } // SetTypestateAttr implementation SetTypestateAttr *SetTypestateAttr::CreateImplicit(ASTContext &Ctx, SetTypestateAttr::ConsumedState NewState, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SetTypestateAttr(Ctx, CommonInfo, NewState); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SetTypestateAttr *SetTypestateAttr::Create(ASTContext &Ctx, SetTypestateAttr::ConsumedState NewState, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SetTypestateAttr(Ctx, CommonInfo, NewState); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SetTypestateAttr *SetTypestateAttr::CreateImplicit(ASTContext &Ctx, SetTypestateAttr::ConsumedState NewState, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_set_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_set_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_set_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_set_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, NewState, I); } SetTypestateAttr *SetTypestateAttr::Create(ASTContext &Ctx, SetTypestateAttr::ConsumedState NewState, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_set_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_set_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_set_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_set_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, NewState, I); } SetTypestateAttr::SetTypestateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , SetTypestateAttr::ConsumedState NewState ) : InheritableAttr(Ctx, CommonInfo, attr::SetTypestate, /*IsLateParsed=*/false, false) , newState(NewState) { } bool SetTypestateAttr::ConvertStrToConsumedState(StringRef Val, SetTypestateAttr::ConsumedState &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("unknown", SetTypestateAttr::ConsumedState::Unknown) .Case("consumed", SetTypestateAttr::ConsumedState::Consumed) .Case("unconsumed", SetTypestateAttr::ConsumedState::Unconsumed) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *SetTypestateAttr::ConvertConsumedStateToStr(SetTypestateAttr::ConsumedState Val) { switch(Val) { case SetTypestateAttr::ConsumedState::Unknown: return "unknown"; case SetTypestateAttr::ConsumedState::Consumed: return "consumed"; case SetTypestateAttr::ConsumedState::Unconsumed: return "unconsumed"; } llvm_unreachable("No enumerator with that value"); } SetTypestateAttr *SetTypestateAttr::clone(ASTContext &C) const { auto *A = new (C) SetTypestateAttr(C, *this, newState); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SetTypestateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((set_typestate"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << SetTypestateAttr::ConvertConsumedStateToStr(getNewState()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::set_typestate"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << SetTypestateAttr::ConvertConsumedStateToStr(getNewState()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *SetTypestateAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "set_typestate"; case 1: return "set_typestate"; } } // SharedTrylockFunctionAttr implementation SharedTrylockFunctionAttr *SharedTrylockFunctionAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SharedTrylockFunctionAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SharedTrylockFunctionAttr *SharedTrylockFunctionAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SharedTrylockFunctionAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SharedTrylockFunctionAttr *SharedTrylockFunctionAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, SuccessValue, Args, ArgsSize, I); } SharedTrylockFunctionAttr *SharedTrylockFunctionAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, SuccessValue, Args, ArgsSize, I); } SharedTrylockFunctionAttr::SharedTrylockFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * SuccessValue , Expr * *Args, unsigned ArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::SharedTrylockFunction, /*IsLateParsed=*/true, true) , successValue(SuccessValue) , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) { std::copy(Args, Args + args_Size, args_); } SharedTrylockFunctionAttr::SharedTrylockFunctionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * SuccessValue ) : InheritableAttr(Ctx, CommonInfo, attr::SharedTrylockFunction, /*IsLateParsed=*/true, true) , successValue(SuccessValue) , args_Size(0), args_(nullptr) { } SharedTrylockFunctionAttr *SharedTrylockFunctionAttr::clone(ASTContext &C) const { auto *A = new (C) SharedTrylockFunctionAttr(C, *this, successValue, args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SharedTrylockFunctionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((shared_trylock_function"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getSuccessValue()->printPretty(OS, nullptr, Policy); OS << ""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *SharedTrylockFunctionAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "shared_trylock_function"; } } // SizedByAttr implementation SizedByAttr *SizedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Size, int NestedLevel, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SizedByAttr(Ctx, CommonInfo, Size, NestedLevel); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SizedByAttr *SizedByAttr::Create(ASTContext &Ctx, Expr * Size, int NestedLevel, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SizedByAttr(Ctx, CommonInfo, Size, NestedLevel); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SizedByAttr *SizedByAttr::CreateImplicit(ASTContext &Ctx, Expr * Size, int NestedLevel, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_sized_by: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sized_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_sized_by: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sized_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_sized_by: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sized_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Size, NestedLevel, I); } SizedByAttr *SizedByAttr::Create(ASTContext &Ctx, Expr * Size, int NestedLevel, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_sized_by: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sized_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_sized_by: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sized_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_sized_by: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sized_by, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Size, NestedLevel, I); } SizedByAttr::SizedByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Size , int NestedLevel ) : InheritableAttr(Ctx, CommonInfo, attr::SizedBy, /*IsLateParsed=*/true, false) , size(Size) , nestedLevel(NestedLevel) { } SizedByAttr::SizedByAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Size ) : InheritableAttr(Ctx, CommonInfo, attr::SizedBy, /*IsLateParsed=*/true, false) , size(Size) , nestedLevel() { } SizedByAttr *SizedByAttr::clone(ASTContext &C) const { auto *A = new (C) SizedByAttr(C, *this, size, nestedLevel); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SizedByAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((sized_by"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getSize()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNestedLevel() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::sized_by"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getSize()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNestedLevel() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::sized_by"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getSize()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNestedLevel() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *SizedByAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "sized_by"; case 1: return "sized_by"; case 2: return "sized_by"; } } // SizedByOrNullAttr implementation SizedByOrNullAttr *SizedByOrNullAttr::CreateImplicit(ASTContext &Ctx, Expr * Size, int NestedLevel, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SizedByOrNullAttr(Ctx, CommonInfo, Size, NestedLevel); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SizedByOrNullAttr *SizedByOrNullAttr::Create(ASTContext &Ctx, Expr * Size, int NestedLevel, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SizedByOrNullAttr(Ctx, CommonInfo, Size, NestedLevel); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SizedByOrNullAttr *SizedByOrNullAttr::CreateImplicit(ASTContext &Ctx, Expr * Size, int NestedLevel, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_sized_by_or_null: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sized_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_sized_by_or_null: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sized_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_sized_by_or_null: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sized_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Size, NestedLevel, I); } SizedByOrNullAttr *SizedByOrNullAttr::Create(ASTContext &Ctx, Expr * Size, int NestedLevel, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_sized_by_or_null: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sized_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_sized_by_or_null: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_sized_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_sized_by_or_null: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_sized_by_or_null, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Size, NestedLevel, I); } SizedByOrNullAttr::SizedByOrNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Size , int NestedLevel ) : InheritableAttr(Ctx, CommonInfo, attr::SizedByOrNull, /*IsLateParsed=*/true, false) , size(Size) , nestedLevel(NestedLevel) { } SizedByOrNullAttr::SizedByOrNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * Size ) : InheritableAttr(Ctx, CommonInfo, attr::SizedByOrNull, /*IsLateParsed=*/true, false) , size(Size) , nestedLevel() { } SizedByOrNullAttr *SizedByOrNullAttr::clone(ASTContext &C) const { auto *A = new (C) SizedByOrNullAttr(C, *this, size, nestedLevel); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SizedByOrNullAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((sized_by_or_null"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getSize()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNestedLevel() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::sized_by_or_null"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getSize()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNestedLevel() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::sized_by_or_null"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getSize()->printPretty(OS, nullptr, Policy); OS << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getNestedLevel() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *SizedByOrNullAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "sized_by_or_null"; case 1: return "sized_by_or_null"; case 2: return "sized_by_or_null"; } } // SpeculativeLoadHardeningAttr implementation SpeculativeLoadHardeningAttr *SpeculativeLoadHardeningAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SpeculativeLoadHardeningAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SpeculativeLoadHardeningAttr *SpeculativeLoadHardeningAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SpeculativeLoadHardeningAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SpeculativeLoadHardeningAttr *SpeculativeLoadHardeningAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_speculative_load_hardening: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_speculative_load_hardening: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_speculative_load_hardening: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } SpeculativeLoadHardeningAttr *SpeculativeLoadHardeningAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_speculative_load_hardening: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_speculative_load_hardening: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_speculative_load_hardening: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_speculative_load_hardening, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } SpeculativeLoadHardeningAttr::SpeculativeLoadHardeningAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::SpeculativeLoadHardening, /*IsLateParsed=*/false, false) { } SpeculativeLoadHardeningAttr *SpeculativeLoadHardeningAttr::clone(ASTContext &C) const { auto *A = new (C) SpeculativeLoadHardeningAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SpeculativeLoadHardeningAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((speculative_load_hardening"; OS << "))"; break; } case 1 : { OS << "[[clang::speculative_load_hardening"; OS << "]]"; break; } case 2 : { OS << "[[clang::speculative_load_hardening"; OS << "]]"; break; } } } const char *SpeculativeLoadHardeningAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "speculative_load_hardening"; case 1: return "speculative_load_hardening"; case 2: return "speculative_load_hardening"; } } // StandaloneDebugAttr implementation StandaloneDebugAttr *StandaloneDebugAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) StandaloneDebugAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } StandaloneDebugAttr *StandaloneDebugAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) StandaloneDebugAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } StandaloneDebugAttr *StandaloneDebugAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_standalone_debug: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_standalone_debug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_standalone_debug: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_standalone_debug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } StandaloneDebugAttr *StandaloneDebugAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_standalone_debug: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_standalone_debug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_standalone_debug: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_standalone_debug, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } StandaloneDebugAttr::StandaloneDebugAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::StandaloneDebug, /*IsLateParsed=*/false, false) { } StandaloneDebugAttr *StandaloneDebugAttr::clone(ASTContext &C) const { auto *A = new (C) StandaloneDebugAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void StandaloneDebugAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((standalone_debug"; OS << "))"; break; } case 1 : { OS << "[[clang::standalone_debug"; OS << "]]"; break; } } } const char *StandaloneDebugAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "standalone_debug"; case 1: return "standalone_debug"; } } // StdCallAttr implementation StdCallAttr *StdCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) StdCallAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } StdCallAttr *StdCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) StdCallAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } StdCallAttr *StdCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_stdcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_stdcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_stdcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_stdcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } StdCallAttr *StdCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_stdcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_stdcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_stdcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_stdcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_stdcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } StdCallAttr::StdCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::StdCall, /*IsLateParsed=*/false, false) { } StdCallAttr *StdCallAttr::clone(ASTContext &C) const { auto *A = new (C) StdCallAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void StdCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((stdcall"; OS << "))"; break; } case 1 : { OS << "[[gnu::stdcall"; OS << "]]"; break; } case 2 : { OS << "[[gnu::stdcall"; OS << "]]"; break; } case 3 : { OS << "__stdcall"; OS << ""; break; } case 4 : { OS << "_stdcall"; OS << ""; break; } } } const char *StdCallAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "stdcall"; case 1: return "stdcall"; case 2: return "stdcall"; case 3: return "__stdcall"; case 4: return "_stdcall"; } } // StrictFPAttr implementation StrictFPAttr *StrictFPAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) StrictFPAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } StrictFPAttr *StrictFPAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) StrictFPAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } StrictFPAttr *StrictFPAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, I); } StrictFPAttr *StrictFPAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, I); } StrictFPAttr::StrictFPAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::StrictFP, /*IsLateParsed=*/false, false) { } StrictFPAttr *StrictFPAttr::clone(ASTContext &C) const { auto *A = new (C) StrictFPAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void StrictFPAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *StrictFPAttr::getSpelling() const { return "(No spelling)"; } // StrictGuardStackCheckAttr implementation StrictGuardStackCheckAttr *StrictGuardStackCheckAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) StrictGuardStackCheckAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } StrictGuardStackCheckAttr *StrictGuardStackCheckAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) StrictGuardStackCheckAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } StrictGuardStackCheckAttr *StrictGuardStackCheckAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } StrictGuardStackCheckAttr *StrictGuardStackCheckAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } StrictGuardStackCheckAttr::StrictGuardStackCheckAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::StrictGuardStackCheck, /*IsLateParsed=*/false, false) { } StrictGuardStackCheckAttr *StrictGuardStackCheckAttr::clone(ASTContext &C) const { auto *A = new (C) StrictGuardStackCheckAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void StrictGuardStackCheckAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__declspec(strict_gs_check"; OS << ")"; break; } } } const char *StrictGuardStackCheckAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "strict_gs_check"; } } // SuppressAttr implementation SuppressAttr *SuppressAttr::CreateImplicit(ASTContext &Ctx, StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SuppressAttr(Ctx, CommonInfo, DiagnosticIdentifiers, DiagnosticIdentifiersSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SuppressAttr *SuppressAttr::Create(ASTContext &Ctx, StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SuppressAttr(Ctx, CommonInfo, DiagnosticIdentifiers, DiagnosticIdentifiersSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SuppressAttr *SuppressAttr::CreateImplicit(ASTContext &Ctx, StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_gsl_suppress: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gsl_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_suppress: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_suppress: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_suppress: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, DiagnosticIdentifiers, DiagnosticIdentifiersSize, I); } SuppressAttr *SuppressAttr::Create(ASTContext &Ctx, StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_gsl_suppress: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gsl_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_suppress: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_suppress: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_suppress: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_suppress, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, DiagnosticIdentifiers, DiagnosticIdentifiersSize, I); } SuppressAttr::SuppressAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , StringRef *DiagnosticIdentifiers, unsigned DiagnosticIdentifiersSize ) : DeclOrStmtAttr(Ctx, CommonInfo, attr::Suppress, /*IsLateParsed=*/false, false) , diagnosticIdentifiers_Size(DiagnosticIdentifiersSize), diagnosticIdentifiers_(new (Ctx, 16) StringRef[diagnosticIdentifiers_Size]) { for (size_t I = 0, E = diagnosticIdentifiers_Size; I != E; ++I) { StringRef Ref = DiagnosticIdentifiers[I]; if (!Ref.empty()) { char *Mem = new (Ctx, 1) char[Ref.size()]; std::memcpy(Mem, Ref.data(), Ref.size()); diagnosticIdentifiers_[I] = StringRef(Mem, Ref.size()); } } } SuppressAttr::SuppressAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : DeclOrStmtAttr(Ctx, CommonInfo, attr::Suppress, /*IsLateParsed=*/false, false) , diagnosticIdentifiers_Size(0), diagnosticIdentifiers_(nullptr) { } SuppressAttr *SuppressAttr::clone(ASTContext &C) const { auto *A = new (C) SuppressAttr(C, *this, diagnosticIdentifiers_, diagnosticIdentifiers_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SuppressAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[gsl::suppress"; OS << ""; for (const auto &Val : diagnosticIdentifiers()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 1 : { OS << "__attribute__((suppress"; OS << ""; for (const auto &Val : diagnosticIdentifiers()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 2 : { OS << "[[clang::suppress"; OS << ""; for (const auto &Val : diagnosticIdentifiers()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 3 : { OS << "[[clang::suppress"; OS << ""; for (const auto &Val : diagnosticIdentifiers()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *SuppressAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "suppress"; case 1: return "suppress"; case 2: return "suppress"; case 3: return "suppress"; } } // SwiftAsyncAttr implementation SwiftAsyncAttr *SwiftAsyncAttr::CreateImplicit(ASTContext &Ctx, SwiftAsyncAttr::Kind Kind, ParamIdx CompletionHandlerIndex, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftAsyncAttr(Ctx, CommonInfo, Kind, CompletionHandlerIndex); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftAsyncAttr *SwiftAsyncAttr::Create(ASTContext &Ctx, SwiftAsyncAttr::Kind Kind, ParamIdx CompletionHandlerIndex, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftAsyncAttr(Ctx, CommonInfo, Kind, CompletionHandlerIndex); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftAsyncAttr *SwiftAsyncAttr::CreateImplicit(ASTContext &Ctx, SwiftAsyncAttr::Kind Kind, ParamIdx CompletionHandlerIndex, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swift_async: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_async, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swift_async: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_async, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swift_async: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_async, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Kind, CompletionHandlerIndex, I); } SwiftAsyncAttr *SwiftAsyncAttr::Create(ASTContext &Ctx, SwiftAsyncAttr::Kind Kind, ParamIdx CompletionHandlerIndex, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swift_async: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_async, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swift_async: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_async, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swift_async: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_async, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Kind, CompletionHandlerIndex, I); } SwiftAsyncAttr::SwiftAsyncAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , SwiftAsyncAttr::Kind Kind , ParamIdx CompletionHandlerIndex ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsync, /*IsLateParsed=*/false, false) , kind(Kind) , completionHandlerIndex(CompletionHandlerIndex) { } SwiftAsyncAttr::SwiftAsyncAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , SwiftAsyncAttr::Kind Kind ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsync, /*IsLateParsed=*/false, false) , kind(Kind) , completionHandlerIndex() { } bool SwiftAsyncAttr::ConvertStrToKind(StringRef Val, SwiftAsyncAttr::Kind &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("none", SwiftAsyncAttr::Kind::None) .Case("swift_private", SwiftAsyncAttr::Kind::SwiftPrivate) .Case("not_swift_private", SwiftAsyncAttr::Kind::NotSwiftPrivate) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *SwiftAsyncAttr::ConvertKindToStr(SwiftAsyncAttr::Kind Val) { switch(Val) { case SwiftAsyncAttr::Kind::None: return "none"; case SwiftAsyncAttr::Kind::SwiftPrivate: return "swift_private"; case SwiftAsyncAttr::Kind::NotSwiftPrivate: return "not_swift_private"; } llvm_unreachable("No enumerator with that value"); } SwiftAsyncAttr *SwiftAsyncAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftAsyncAttr(C, *this, kind, completionHandlerIndex); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftAsyncAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swift_async"; if (!getCompletionHandlerIndex().isValid()) ++TrailingOmittedArgs; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << SwiftAsyncAttr::ConvertKindToStr(getKind()) << "\""; if (!(!getCompletionHandlerIndex().isValid())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getCompletionHandlerIndex().getSourceIndex() << ""; } if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::swift_async"; if (!getCompletionHandlerIndex().isValid()) ++TrailingOmittedArgs; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << SwiftAsyncAttr::ConvertKindToStr(getKind()) << "\""; if (!(!getCompletionHandlerIndex().isValid())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getCompletionHandlerIndex().getSourceIndex() << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::swift_async"; if (!getCompletionHandlerIndex().isValid()) ++TrailingOmittedArgs; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << SwiftAsyncAttr::ConvertKindToStr(getKind()) << "\""; if (!(!getCompletionHandlerIndex().isValid())) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getCompletionHandlerIndex().getSourceIndex() << ""; } if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *SwiftAsyncAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swift_async"; case 1: return "swift_async"; case 2: return "swift_async"; } } // SwiftAsyncCallAttr implementation SwiftAsyncCallAttr *SwiftAsyncCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftAsyncCallAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftAsyncCallAttr *SwiftAsyncCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftAsyncCallAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftAsyncCallAttr *SwiftAsyncCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swiftasynccall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swiftasynccall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swiftasynccall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swiftasynccall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swiftasynccall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swiftasynccall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } SwiftAsyncCallAttr *SwiftAsyncCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swiftasynccall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swiftasynccall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swiftasynccall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swiftasynccall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swiftasynccall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swiftasynccall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } SwiftAsyncCallAttr::SwiftAsyncCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsyncCall, /*IsLateParsed=*/false, false) { } SwiftAsyncCallAttr *SwiftAsyncCallAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftAsyncCallAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftAsyncCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swiftasynccall"; OS << "))"; break; } case 1 : { OS << "[[clang::swiftasynccall"; OS << "]]"; break; } case 2 : { OS << "[[clang::swiftasynccall"; OS << "]]"; break; } } } const char *SwiftAsyncCallAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swiftasynccall"; case 1: return "swiftasynccall"; case 2: return "swiftasynccall"; } } // SwiftAsyncContextAttr implementation SwiftAsyncContextAttr *SwiftAsyncContextAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftAsyncContextAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftAsyncContextAttr *SwiftAsyncContextAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftAsyncContextAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftAsyncContextAttr *SwiftAsyncContextAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swift_async_context: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_async_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swift_async_context: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_async_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swift_async_context: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_async_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } SwiftAsyncContextAttr *SwiftAsyncContextAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swift_async_context: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_async_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swift_async_context: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_async_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swift_async_context: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_async_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } SwiftAsyncContextAttr::SwiftAsyncContextAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : ParameterABIAttr(Ctx, CommonInfo, attr::SwiftAsyncContext, /*IsLateParsed=*/false, false) { } SwiftAsyncContextAttr *SwiftAsyncContextAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftAsyncContextAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftAsyncContextAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swift_async_context"; OS << "))"; break; } case 1 : { OS << "[[clang::swift_async_context"; OS << "]]"; break; } case 2 : { OS << "[[clang::swift_async_context"; OS << "]]"; break; } } } const char *SwiftAsyncContextAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swift_async_context"; case 1: return "swift_async_context"; case 2: return "swift_async_context"; } } // SwiftAsyncErrorAttr implementation SwiftAsyncErrorAttr *SwiftAsyncErrorAttr::CreateImplicit(ASTContext &Ctx, SwiftAsyncErrorAttr::ConventionKind Convention, unsigned HandlerParamIdx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftAsyncErrorAttr(Ctx, CommonInfo, Convention, HandlerParamIdx); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftAsyncErrorAttr *SwiftAsyncErrorAttr::Create(ASTContext &Ctx, SwiftAsyncErrorAttr::ConventionKind Convention, unsigned HandlerParamIdx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftAsyncErrorAttr(Ctx, CommonInfo, Convention, HandlerParamIdx); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftAsyncErrorAttr *SwiftAsyncErrorAttr::CreateImplicit(ASTContext &Ctx, SwiftAsyncErrorAttr::ConventionKind Convention, unsigned HandlerParamIdx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swift_async_error: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_async_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swift_async_error: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_async_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swift_async_error: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_async_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Convention, HandlerParamIdx, I); } SwiftAsyncErrorAttr *SwiftAsyncErrorAttr::Create(ASTContext &Ctx, SwiftAsyncErrorAttr::ConventionKind Convention, unsigned HandlerParamIdx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swift_async_error: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_async_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swift_async_error: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_async_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swift_async_error: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_async_error, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Convention, HandlerParamIdx, I); } SwiftAsyncErrorAttr::SwiftAsyncErrorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , SwiftAsyncErrorAttr::ConventionKind Convention , unsigned HandlerParamIdx ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsyncError, /*IsLateParsed=*/false, false) , convention(Convention) , handlerParamIdx(HandlerParamIdx) { } SwiftAsyncErrorAttr::SwiftAsyncErrorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , SwiftAsyncErrorAttr::ConventionKind Convention ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsyncError, /*IsLateParsed=*/false, false) , convention(Convention) , handlerParamIdx() { } bool SwiftAsyncErrorAttr::ConvertStrToConventionKind(StringRef Val, SwiftAsyncErrorAttr::ConventionKind &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("none", SwiftAsyncErrorAttr::ConventionKind::None) .Case("nonnull_error", SwiftAsyncErrorAttr::ConventionKind::NonNullError) .Case("zero_argument", SwiftAsyncErrorAttr::ConventionKind::ZeroArgument) .Case("nonzero_argument", SwiftAsyncErrorAttr::ConventionKind::NonZeroArgument) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *SwiftAsyncErrorAttr::ConvertConventionKindToStr(SwiftAsyncErrorAttr::ConventionKind Val) { switch(Val) { case SwiftAsyncErrorAttr::ConventionKind::None: return "none"; case SwiftAsyncErrorAttr::ConventionKind::NonNullError: return "nonnull_error"; case SwiftAsyncErrorAttr::ConventionKind::ZeroArgument: return "zero_argument"; case SwiftAsyncErrorAttr::ConventionKind::NonZeroArgument: return "nonzero_argument"; } llvm_unreachable("No enumerator with that value"); } SwiftAsyncErrorAttr *SwiftAsyncErrorAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftAsyncErrorAttr(C, *this, convention, handlerParamIdx); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftAsyncErrorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swift_async_error"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << SwiftAsyncErrorAttr::ConvertConventionKindToStr(getConvention()) << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getHandlerParamIdx() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::swift_async_error"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << SwiftAsyncErrorAttr::ConvertConventionKindToStr(getConvention()) << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getHandlerParamIdx() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::swift_async_error"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << SwiftAsyncErrorAttr::ConvertConventionKindToStr(getConvention()) << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getHandlerParamIdx() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *SwiftAsyncErrorAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swift_async_error"; case 1: return "swift_async_error"; case 2: return "swift_async_error"; } } // SwiftAsyncNameAttr implementation SwiftAsyncNameAttr *SwiftAsyncNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftAsyncNameAttr(Ctx, CommonInfo, Name); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftAsyncNameAttr *SwiftAsyncNameAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftAsyncNameAttr(Ctx, CommonInfo, Name); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftAsyncNameAttr *SwiftAsyncNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Name, I); } SwiftAsyncNameAttr *SwiftAsyncNameAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Name, I); } SwiftAsyncNameAttr::SwiftAsyncNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Name ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftAsyncName, /*IsLateParsed=*/false, false) , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) { if (!Name.empty()) std::memcpy(name, Name.data(), nameLength); } SwiftAsyncNameAttr *SwiftAsyncNameAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftAsyncNameAttr(C, *this, getName()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftAsyncNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swift_async_name"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *SwiftAsyncNameAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swift_async_name"; } } // SwiftAttrAttr implementation SwiftAttrAttr *SwiftAttrAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Attribute, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftAttrAttr(Ctx, CommonInfo, Attribute); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftAttrAttr *SwiftAttrAttr::Create(ASTContext &Ctx, llvm::StringRef Attribute, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftAttrAttr(Ctx, CommonInfo, Attribute); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftAttrAttr *SwiftAttrAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Attribute, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Attribute, I); } SwiftAttrAttr *SwiftAttrAttr::Create(ASTContext &Ctx, llvm::StringRef Attribute, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Attribute, I); } SwiftAttrAttr::SwiftAttrAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Attribute ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftAttr, /*IsLateParsed=*/false, false) , attributeLength(Attribute.size()),attribute(new (Ctx, 1) char[attributeLength]) { if (!Attribute.empty()) std::memcpy(attribute, Attribute.data(), attributeLength); } SwiftAttrAttr *SwiftAttrAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftAttrAttr(C, *this, getAttribute()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftAttrAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swift_attr"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getAttribute() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *SwiftAttrAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swift_attr"; } } // SwiftBridgeAttr implementation SwiftBridgeAttr *SwiftBridgeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef SwiftType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftBridgeAttr(Ctx, CommonInfo, SwiftType); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftBridgeAttr *SwiftBridgeAttr::Create(ASTContext &Ctx, llvm::StringRef SwiftType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftBridgeAttr(Ctx, CommonInfo, SwiftType); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftBridgeAttr *SwiftBridgeAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef SwiftType, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, SwiftType, I); } SwiftBridgeAttr *SwiftBridgeAttr::Create(ASTContext &Ctx, llvm::StringRef SwiftType, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, SwiftType, I); } SwiftBridgeAttr::SwiftBridgeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef SwiftType ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftBridge, /*IsLateParsed=*/false, false) , swiftTypeLength(SwiftType.size()),swiftType(new (Ctx, 1) char[swiftTypeLength]) { if (!SwiftType.empty()) std::memcpy(swiftType, SwiftType.data(), swiftTypeLength); } SwiftBridgeAttr *SwiftBridgeAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftBridgeAttr(C, *this, getSwiftType()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftBridgeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swift_bridge"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getSwiftType() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *SwiftBridgeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swift_bridge"; } } // SwiftBridgedTypedefAttr implementation SwiftBridgedTypedefAttr *SwiftBridgedTypedefAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftBridgedTypedefAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftBridgedTypedefAttr *SwiftBridgedTypedefAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftBridgedTypedefAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftBridgedTypedefAttr *SwiftBridgedTypedefAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } SwiftBridgedTypedefAttr *SwiftBridgedTypedefAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } SwiftBridgedTypedefAttr::SwiftBridgedTypedefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftBridgedTypedef, /*IsLateParsed=*/false, false) { } SwiftBridgedTypedefAttr *SwiftBridgedTypedefAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftBridgedTypedefAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftBridgedTypedefAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swift_bridged_typedef"; OS << "))"; break; } } } const char *SwiftBridgedTypedefAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swift_bridged_typedef"; } } // SwiftCallAttr implementation SwiftCallAttr *SwiftCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftCallAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftCallAttr *SwiftCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftCallAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftCallAttr *SwiftCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swiftcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swiftcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swiftcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swiftcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swiftcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swiftcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } SwiftCallAttr *SwiftCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swiftcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swiftcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swiftcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swiftcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swiftcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swiftcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } SwiftCallAttr::SwiftCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftCall, /*IsLateParsed=*/false, false) { } SwiftCallAttr *SwiftCallAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftCallAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swiftcall"; OS << "))"; break; } case 1 : { OS << "[[clang::swiftcall"; OS << "]]"; break; } case 2 : { OS << "[[clang::swiftcall"; OS << "]]"; break; } } } const char *SwiftCallAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swiftcall"; case 1: return "swiftcall"; case 2: return "swiftcall"; } } // SwiftContextAttr implementation SwiftContextAttr *SwiftContextAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftContextAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftContextAttr *SwiftContextAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftContextAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftContextAttr *SwiftContextAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swift_context: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swift_context: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swift_context: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } SwiftContextAttr *SwiftContextAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swift_context: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swift_context: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swift_context: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_context, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } SwiftContextAttr::SwiftContextAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : ParameterABIAttr(Ctx, CommonInfo, attr::SwiftContext, /*IsLateParsed=*/false, false) { } SwiftContextAttr *SwiftContextAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftContextAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftContextAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swift_context"; OS << "))"; break; } case 1 : { OS << "[[clang::swift_context"; OS << "]]"; break; } case 2 : { OS << "[[clang::swift_context"; OS << "]]"; break; } } } const char *SwiftContextAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swift_context"; case 1: return "swift_context"; case 2: return "swift_context"; } } // SwiftErrorAttr implementation SwiftErrorAttr *SwiftErrorAttr::CreateImplicit(ASTContext &Ctx, SwiftErrorAttr::ConventionKind Convention, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftErrorAttr(Ctx, CommonInfo, Convention); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftErrorAttr *SwiftErrorAttr::Create(ASTContext &Ctx, SwiftErrorAttr::ConventionKind Convention, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftErrorAttr(Ctx, CommonInfo, Convention); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftErrorAttr *SwiftErrorAttr::CreateImplicit(ASTContext &Ctx, SwiftErrorAttr::ConventionKind Convention, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Convention, I); } SwiftErrorAttr *SwiftErrorAttr::Create(ASTContext &Ctx, SwiftErrorAttr::ConventionKind Convention, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Convention, I); } SwiftErrorAttr::SwiftErrorAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , SwiftErrorAttr::ConventionKind Convention ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftError, /*IsLateParsed=*/false, false) , convention(Convention) { } bool SwiftErrorAttr::ConvertStrToConventionKind(StringRef Val, SwiftErrorAttr::ConventionKind &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("none", SwiftErrorAttr::ConventionKind::None) .Case("nonnull_error", SwiftErrorAttr::ConventionKind::NonNullError) .Case("null_result", SwiftErrorAttr::ConventionKind::NullResult) .Case("zero_result", SwiftErrorAttr::ConventionKind::ZeroResult) .Case("nonzero_result", SwiftErrorAttr::ConventionKind::NonZeroResult) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *SwiftErrorAttr::ConvertConventionKindToStr(SwiftErrorAttr::ConventionKind Val) { switch(Val) { case SwiftErrorAttr::ConventionKind::None: return "none"; case SwiftErrorAttr::ConventionKind::NonNullError: return "nonnull_error"; case SwiftErrorAttr::ConventionKind::NullResult: return "null_result"; case SwiftErrorAttr::ConventionKind::ZeroResult: return "zero_result"; case SwiftErrorAttr::ConventionKind::NonZeroResult: return "nonzero_result"; } llvm_unreachable("No enumerator with that value"); } SwiftErrorAttr *SwiftErrorAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftErrorAttr(C, *this, convention); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftErrorAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swift_error"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << SwiftErrorAttr::ConvertConventionKindToStr(getConvention()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *SwiftErrorAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swift_error"; } } // SwiftErrorResultAttr implementation SwiftErrorResultAttr *SwiftErrorResultAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftErrorResultAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftErrorResultAttr *SwiftErrorResultAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftErrorResultAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftErrorResultAttr *SwiftErrorResultAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swift_error_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_error_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swift_error_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_error_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swift_error_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_error_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } SwiftErrorResultAttr *SwiftErrorResultAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swift_error_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_error_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swift_error_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_error_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swift_error_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_error_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } SwiftErrorResultAttr::SwiftErrorResultAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : ParameterABIAttr(Ctx, CommonInfo, attr::SwiftErrorResult, /*IsLateParsed=*/false, false) { } SwiftErrorResultAttr *SwiftErrorResultAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftErrorResultAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftErrorResultAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swift_error_result"; OS << "))"; break; } case 1 : { OS << "[[clang::swift_error_result"; OS << "]]"; break; } case 2 : { OS << "[[clang::swift_error_result"; OS << "]]"; break; } } } const char *SwiftErrorResultAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swift_error_result"; case 1: return "swift_error_result"; case 2: return "swift_error_result"; } } // SwiftImportAsNonGenericAttr implementation SwiftImportAsNonGenericAttr *SwiftImportAsNonGenericAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftImportAsNonGenericAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftImportAsNonGenericAttr *SwiftImportAsNonGenericAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftImportAsNonGenericAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftImportAsNonGenericAttr *SwiftImportAsNonGenericAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, I); } SwiftImportAsNonGenericAttr *SwiftImportAsNonGenericAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, I); } SwiftImportAsNonGenericAttr::SwiftImportAsNonGenericAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftImportAsNonGeneric, /*IsLateParsed=*/false, false) { } SwiftImportAsNonGenericAttr *SwiftImportAsNonGenericAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftImportAsNonGenericAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftImportAsNonGenericAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *SwiftImportAsNonGenericAttr::getSpelling() const { return "(No spelling)"; } // SwiftImportPropertyAsAccessorsAttr implementation SwiftImportPropertyAsAccessorsAttr *SwiftImportPropertyAsAccessorsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftImportPropertyAsAccessorsAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftImportPropertyAsAccessorsAttr *SwiftImportPropertyAsAccessorsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftImportPropertyAsAccessorsAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftImportPropertyAsAccessorsAttr *SwiftImportPropertyAsAccessorsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, I); } SwiftImportPropertyAsAccessorsAttr *SwiftImportPropertyAsAccessorsAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, I); } SwiftImportPropertyAsAccessorsAttr::SwiftImportPropertyAsAccessorsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftImportPropertyAsAccessors, /*IsLateParsed=*/false, false) { } SwiftImportPropertyAsAccessorsAttr *SwiftImportPropertyAsAccessorsAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftImportPropertyAsAccessorsAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftImportPropertyAsAccessorsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *SwiftImportPropertyAsAccessorsAttr::getSpelling() const { return "(No spelling)"; } // SwiftIndirectResultAttr implementation SwiftIndirectResultAttr *SwiftIndirectResultAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftIndirectResultAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftIndirectResultAttr *SwiftIndirectResultAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftIndirectResultAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftIndirectResultAttr *SwiftIndirectResultAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swift_indirect_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_indirect_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swift_indirect_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_indirect_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swift_indirect_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_indirect_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } SwiftIndirectResultAttr *SwiftIndirectResultAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swift_indirect_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_indirect_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_swift_indirect_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_swift_indirect_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_swift_indirect_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_swift_indirect_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } SwiftIndirectResultAttr::SwiftIndirectResultAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : ParameterABIAttr(Ctx, CommonInfo, attr::SwiftIndirectResult, /*IsLateParsed=*/false, false) { } SwiftIndirectResultAttr *SwiftIndirectResultAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftIndirectResultAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftIndirectResultAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swift_indirect_result"; OS << "))"; break; } case 1 : { OS << "[[clang::swift_indirect_result"; OS << "]]"; break; } case 2 : { OS << "[[clang::swift_indirect_result"; OS << "]]"; break; } } } const char *SwiftIndirectResultAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swift_indirect_result"; case 1: return "swift_indirect_result"; case 2: return "swift_indirect_result"; } } // SwiftNameAttr implementation SwiftNameAttr *SwiftNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftNameAttr(Ctx, CommonInfo, Name); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftNameAttr *SwiftNameAttr::Create(ASTContext &Ctx, llvm::StringRef Name, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftNameAttr(Ctx, CommonInfo, Name); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftNameAttr *SwiftNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, Name, I); } SwiftNameAttr *SwiftNameAttr::Create(ASTContext &Ctx, llvm::StringRef Name, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, Name, I); } SwiftNameAttr::SwiftNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Name ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftName, /*IsLateParsed=*/false, false) , nameLength(Name.size()),name(new (Ctx, 1) char[nameLength]) { if (!Name.empty()) std::memcpy(name, Name.data(), nameLength); } SwiftNameAttr *SwiftNameAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftNameAttr(C, *this, getName()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swift_name"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *SwiftNameAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swift_name"; } } // SwiftNewTypeAttr implementation SwiftNewTypeAttr *SwiftNewTypeAttr::CreateImplicit(ASTContext &Ctx, SwiftNewTypeAttr::NewtypeKind NewtypeKind, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftNewTypeAttr(Ctx, CommonInfo, NewtypeKind); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftNewTypeAttr *SwiftNewTypeAttr::Create(ASTContext &Ctx, SwiftNewTypeAttr::NewtypeKind NewtypeKind, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftNewTypeAttr(Ctx, CommonInfo, NewtypeKind); return A; } SwiftNewTypeAttr *SwiftNewTypeAttr::CreateImplicit(ASTContext &Ctx, SwiftNewTypeAttr::NewtypeKind NewtypeKind, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swift_newtype: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_newtype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_swift_wrapper: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, NewtypeKind, I); } SwiftNewTypeAttr *SwiftNewTypeAttr::Create(ASTContext &Ctx, SwiftNewTypeAttr::NewtypeKind NewtypeKind, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_swift_newtype: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_newtype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_swift_wrapper: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_swift_wrapper, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, NewtypeKind, I); } SwiftNewTypeAttr::SwiftNewTypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , SwiftNewTypeAttr::NewtypeKind NewtypeKind ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftNewType, /*IsLateParsed=*/false, false) , newtypeKind(NewtypeKind) { } SwiftNewTypeAttr::Spelling SwiftNewTypeAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_swift_newtype; case 1: return GNU_swift_wrapper; } } bool SwiftNewTypeAttr::ConvertStrToNewtypeKind(StringRef Val, SwiftNewTypeAttr::NewtypeKind &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("struct", SwiftNewTypeAttr::NewtypeKind::NK_Struct) .Case("enum", SwiftNewTypeAttr::NewtypeKind::NK_Enum) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *SwiftNewTypeAttr::ConvertNewtypeKindToStr(SwiftNewTypeAttr::NewtypeKind Val) { switch(Val) { case SwiftNewTypeAttr::NewtypeKind::NK_Struct: return "struct"; case SwiftNewTypeAttr::NewtypeKind::NK_Enum: return "enum"; } llvm_unreachable("No enumerator with that value"); } SwiftNewTypeAttr *SwiftNewTypeAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftNewTypeAttr(C, *this, newtypeKind); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftNewTypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swift_newtype"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << SwiftNewTypeAttr::ConvertNewtypeKindToStr(getNewtypeKind()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "__attribute__((swift_wrapper"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << SwiftNewTypeAttr::ConvertNewtypeKindToStr(getNewtypeKind()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *SwiftNewTypeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swift_newtype"; case 1: return "swift_wrapper"; } } // SwiftObjCMembersAttr implementation SwiftObjCMembersAttr *SwiftObjCMembersAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftObjCMembersAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftObjCMembersAttr *SwiftObjCMembersAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftObjCMembersAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftObjCMembersAttr *SwiftObjCMembersAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } SwiftObjCMembersAttr *SwiftObjCMembersAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } SwiftObjCMembersAttr::SwiftObjCMembersAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::SwiftObjCMembers, /*IsLateParsed=*/false) { } SwiftObjCMembersAttr *SwiftObjCMembersAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftObjCMembersAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftObjCMembersAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swift_objc_members"; OS << "))"; break; } } } const char *SwiftObjCMembersAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swift_objc_members"; } } // SwiftPrivateAttr implementation SwiftPrivateAttr *SwiftPrivateAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftPrivateAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftPrivateAttr *SwiftPrivateAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftPrivateAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftPrivateAttr *SwiftPrivateAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } SwiftPrivateAttr *SwiftPrivateAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } SwiftPrivateAttr::SwiftPrivateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::SwiftPrivate, /*IsLateParsed=*/false, false) { } SwiftPrivateAttr *SwiftPrivateAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftPrivateAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftPrivateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((swift_private"; OS << "))"; break; } } } const char *SwiftPrivateAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "swift_private"; } } // SwiftVersionedAdditionAttr implementation SwiftVersionedAdditionAttr *SwiftVersionedAdditionAttr::CreateImplicit(ASTContext &Ctx, VersionTuple Version, Attr * AdditionalAttr, bool IsReplacedByActive, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftVersionedAdditionAttr(Ctx, CommonInfo, Version, AdditionalAttr, IsReplacedByActive); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftVersionedAdditionAttr *SwiftVersionedAdditionAttr::Create(ASTContext &Ctx, VersionTuple Version, Attr * AdditionalAttr, bool IsReplacedByActive, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftVersionedAdditionAttr(Ctx, CommonInfo, Version, AdditionalAttr, IsReplacedByActive); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftVersionedAdditionAttr *SwiftVersionedAdditionAttr::CreateImplicit(ASTContext &Ctx, VersionTuple Version, Attr * AdditionalAttr, bool IsReplacedByActive, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, Version, AdditionalAttr, IsReplacedByActive, I); } SwiftVersionedAdditionAttr *SwiftVersionedAdditionAttr::Create(ASTContext &Ctx, VersionTuple Version, Attr * AdditionalAttr, bool IsReplacedByActive, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, Version, AdditionalAttr, IsReplacedByActive, I); } SwiftVersionedAdditionAttr::SwiftVersionedAdditionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , VersionTuple Version , Attr * AdditionalAttr , bool IsReplacedByActive ) : Attr(Ctx, CommonInfo, attr::SwiftVersionedAddition, /*IsLateParsed=*/false) , version(Version) , additionalAttr(AdditionalAttr) , isReplacedByActive(IsReplacedByActive) { } SwiftVersionedAdditionAttr *SwiftVersionedAdditionAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftVersionedAdditionAttr(C, *this, getVersion(), additionalAttr, isReplacedByActive); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftVersionedAdditionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *SwiftVersionedAdditionAttr::getSpelling() const { return "(No spelling)"; } // SwiftVersionedRemovalAttr implementation SwiftVersionedRemovalAttr *SwiftVersionedRemovalAttr::CreateImplicit(ASTContext &Ctx, VersionTuple Version, unsigned RawKind, bool IsReplacedByActive, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftVersionedRemovalAttr(Ctx, CommonInfo, Version, RawKind, IsReplacedByActive); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftVersionedRemovalAttr *SwiftVersionedRemovalAttr::Create(ASTContext &Ctx, VersionTuple Version, unsigned RawKind, bool IsReplacedByActive, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SwiftVersionedRemovalAttr(Ctx, CommonInfo, Version, RawKind, IsReplacedByActive); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SwiftVersionedRemovalAttr *SwiftVersionedRemovalAttr::CreateImplicit(ASTContext &Ctx, VersionTuple Version, unsigned RawKind, bool IsReplacedByActive, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return CreateImplicit(Ctx, Version, RawKind, IsReplacedByActive, I); } SwiftVersionedRemovalAttr *SwiftVersionedRemovalAttr::Create(ASTContext &Ctx, VersionTuple Version, unsigned RawKind, bool IsReplacedByActive, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, AttributeCommonInfo::Form::Implicit()); return Create(Ctx, Version, RawKind, IsReplacedByActive, I); } SwiftVersionedRemovalAttr::SwiftVersionedRemovalAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , VersionTuple Version , unsigned RawKind , bool IsReplacedByActive ) : Attr(Ctx, CommonInfo, attr::SwiftVersionedRemoval, /*IsLateParsed=*/false) , version(Version) , rawKind(RawKind) , isReplacedByActive(IsReplacedByActive) { } SwiftVersionedRemovalAttr *SwiftVersionedRemovalAttr::clone(ASTContext &C) const { auto *A = new (C) SwiftVersionedRemovalAttr(C, *this, getVersion(), rawKind, isReplacedByActive); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SwiftVersionedRemovalAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { } const char *SwiftVersionedRemovalAttr::getSpelling() const { return "(No spelling)"; } // SysVABIAttr implementation SysVABIAttr *SysVABIAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SysVABIAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SysVABIAttr *SysVABIAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) SysVABIAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } SysVABIAttr *SysVABIAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_sysv_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sysv_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_sysv_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_sysv_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_sysv_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_sysv_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } SysVABIAttr *SysVABIAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_sysv_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_sysv_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_sysv_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_sysv_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_sysv_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_sysv_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } SysVABIAttr::SysVABIAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::SysVABI, /*IsLateParsed=*/false, false) { } SysVABIAttr *SysVABIAttr::clone(ASTContext &C) const { auto *A = new (C) SysVABIAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void SysVABIAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((sysv_abi"; OS << "))"; break; } case 1 : { OS << "[[gnu::sysv_abi"; OS << "]]"; break; } case 2 : { OS << "[[gnu::sysv_abi"; OS << "]]"; break; } } } const char *SysVABIAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "sysv_abi"; case 1: return "sysv_abi"; case 2: return "sysv_abi"; } } // TLSModelAttr implementation TLSModelAttr *TLSModelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Model, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TLSModelAttr(Ctx, CommonInfo, Model); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TLSModelAttr *TLSModelAttr::Create(ASTContext &Ctx, llvm::StringRef Model, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TLSModelAttr(Ctx, CommonInfo, Model); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TLSModelAttr *TLSModelAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Model, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_tls_model: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_tls_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_tls_model: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_tls_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_tls_model: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_tls_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Model, I); } TLSModelAttr *TLSModelAttr::Create(ASTContext &Ctx, llvm::StringRef Model, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_tls_model: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_tls_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_tls_model: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_tls_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_tls_model: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_tls_model, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Model, I); } TLSModelAttr::TLSModelAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Model ) : InheritableAttr(Ctx, CommonInfo, attr::TLSModel, /*IsLateParsed=*/false, false) , modelLength(Model.size()),model(new (Ctx, 1) char[modelLength]) { if (!Model.empty()) std::memcpy(model, Model.data(), modelLength); } TLSModelAttr *TLSModelAttr::clone(ASTContext &C) const { auto *A = new (C) TLSModelAttr(C, *this, getModel()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void TLSModelAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((tls_model"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getModel() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::tls_model"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getModel() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::tls_model"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getModel() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *TLSModelAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "tls_model"; case 1: return "tls_model"; case 2: return "tls_model"; } } // TargetAttr implementation TargetAttr *TargetAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef FeaturesStr, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TargetAttr(Ctx, CommonInfo, FeaturesStr); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TargetAttr *TargetAttr::Create(ASTContext &Ctx, llvm::StringRef FeaturesStr, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TargetAttr(Ctx, CommonInfo, FeaturesStr); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TargetAttr *TargetAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef FeaturesStr, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_target: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_target, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_target: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_target, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_target: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_target, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, FeaturesStr, I); } TargetAttr *TargetAttr::Create(ASTContext &Ctx, llvm::StringRef FeaturesStr, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_target: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_target, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_target: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_target, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_target: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_target, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, FeaturesStr, I); } TargetAttr::TargetAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef FeaturesStr ) : InheritableAttr(Ctx, CommonInfo, attr::Target, /*IsLateParsed=*/false, false) , featuresStrLength(FeaturesStr.size()),featuresStr(new (Ctx, 1) char[featuresStrLength]) { if (!FeaturesStr.empty()) std::memcpy(featuresStr, FeaturesStr.data(), featuresStrLength); } TargetAttr *TargetAttr::clone(ASTContext &C) const { auto *A = new (C) TargetAttr(C, *this, getFeaturesStr()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void TargetAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((target"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getFeaturesStr() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::target"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getFeaturesStr() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::target"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getFeaturesStr() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *TargetAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "target"; case 1: return "target"; case 2: return "target"; } } // TargetClonesAttr implementation TargetClonesAttr *TargetClonesAttr::CreateImplicit(ASTContext &Ctx, StringRef *FeaturesStrs, unsigned FeaturesStrsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TargetClonesAttr(Ctx, CommonInfo, FeaturesStrs, FeaturesStrsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TargetClonesAttr *TargetClonesAttr::Create(ASTContext &Ctx, StringRef *FeaturesStrs, unsigned FeaturesStrsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TargetClonesAttr(Ctx, CommonInfo, FeaturesStrs, FeaturesStrsSize); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TargetClonesAttr *TargetClonesAttr::CreateImplicit(ASTContext &Ctx, StringRef *FeaturesStrs, unsigned FeaturesStrsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_target_clones: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_target_clones, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_target_clones: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_target_clones, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_target_clones: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_target_clones, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, FeaturesStrs, FeaturesStrsSize, I); } TargetClonesAttr *TargetClonesAttr::Create(ASTContext &Ctx, StringRef *FeaturesStrs, unsigned FeaturesStrsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_target_clones: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_target_clones, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_target_clones: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_target_clones, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_target_clones: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_target_clones, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, FeaturesStrs, FeaturesStrsSize, I); } TargetClonesAttr::TargetClonesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , StringRef *FeaturesStrs, unsigned FeaturesStrsSize ) : InheritableAttr(Ctx, CommonInfo, attr::TargetClones, /*IsLateParsed=*/false, false) , featuresStrs_Size(FeaturesStrsSize), featuresStrs_(new (Ctx, 16) StringRef[featuresStrs_Size]) { for (size_t I = 0, E = featuresStrs_Size; I != E; ++I) { StringRef Ref = FeaturesStrs[I]; if (!Ref.empty()) { char *Mem = new (Ctx, 1) char[Ref.size()]; std::memcpy(Mem, Ref.data(), Ref.size()); featuresStrs_[I] = StringRef(Mem, Ref.size()); } } } TargetClonesAttr::TargetClonesAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::TargetClones, /*IsLateParsed=*/false, false) , featuresStrs_Size(0), featuresStrs_(nullptr) { } TargetClonesAttr *TargetClonesAttr::clone(ASTContext &C) const { auto *A = new (C) TargetClonesAttr(C, *this, featuresStrs_, featuresStrs_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void TargetClonesAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((target_clones"; OS << ""; for (const auto &Val : featuresStrs()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::target_clones"; OS << ""; for (const auto &Val : featuresStrs()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::target_clones"; OS << ""; for (const auto &Val : featuresStrs()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << Val << "\""; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *TargetClonesAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "target_clones"; case 1: return "target_clones"; case 2: return "target_clones"; } } // TargetVersionAttr implementation TargetVersionAttr *TargetVersionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef NamesStr, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TargetVersionAttr(Ctx, CommonInfo, NamesStr); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TargetVersionAttr *TargetVersionAttr::Create(ASTContext &Ctx, llvm::StringRef NamesStr, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TargetVersionAttr(Ctx, CommonInfo, NamesStr); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TargetVersionAttr *TargetVersionAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef NamesStr, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_target_version: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_target_version, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_target_version: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_target_version, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_target_version: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_target_version, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, NamesStr, I); } TargetVersionAttr *TargetVersionAttr::Create(ASTContext &Ctx, llvm::StringRef NamesStr, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_target_version: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_target_version, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_target_version: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_target_version, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_target_version: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_target_version, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, NamesStr, I); } TargetVersionAttr::TargetVersionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef NamesStr ) : InheritableAttr(Ctx, CommonInfo, attr::TargetVersion, /*IsLateParsed=*/false, false) , namesStrLength(NamesStr.size()),namesStr(new (Ctx, 1) char[namesStrLength]) { if (!NamesStr.empty()) std::memcpy(namesStr, NamesStr.data(), namesStrLength); } TargetVersionAttr *TargetVersionAttr::clone(ASTContext &C) const { auto *A = new (C) TargetVersionAttr(C, *this, getNamesStr()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void TargetVersionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((target_version"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getNamesStr() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::target_version"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getNamesStr() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::target_version"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getNamesStr() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *TargetVersionAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "target_version"; case 1: return "target_version"; case 2: return "target_version"; } } // TestTypestateAttr implementation TestTypestateAttr *TestTypestateAttr::CreateImplicit(ASTContext &Ctx, TestTypestateAttr::ConsumedState TestState, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TestTypestateAttr(Ctx, CommonInfo, TestState); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TestTypestateAttr *TestTypestateAttr::Create(ASTContext &Ctx, TestTypestateAttr::ConsumedState TestState, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TestTypestateAttr(Ctx, CommonInfo, TestState); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TestTypestateAttr *TestTypestateAttr::CreateImplicit(ASTContext &Ctx, TestTypestateAttr::ConsumedState TestState, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_test_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_test_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_test_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_test_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, TestState, I); } TestTypestateAttr *TestTypestateAttr::Create(ASTContext &Ctx, TestTypestateAttr::ConsumedState TestState, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_test_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_test_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_test_typestate: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_test_typestate, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, TestState, I); } TestTypestateAttr::TestTypestateAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , TestTypestateAttr::ConsumedState TestState ) : InheritableAttr(Ctx, CommonInfo, attr::TestTypestate, /*IsLateParsed=*/false, false) , testState(TestState) { } bool TestTypestateAttr::ConvertStrToConsumedState(StringRef Val, TestTypestateAttr::ConsumedState &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("consumed", TestTypestateAttr::ConsumedState::Consumed) .Case("unconsumed", TestTypestateAttr::ConsumedState::Unconsumed) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *TestTypestateAttr::ConvertConsumedStateToStr(TestTypestateAttr::ConsumedState Val) { switch(Val) { case TestTypestateAttr::ConsumedState::Consumed: return "consumed"; case TestTypestateAttr::ConsumedState::Unconsumed: return "unconsumed"; } llvm_unreachable("No enumerator with that value"); } TestTypestateAttr *TestTypestateAttr::clone(ASTContext &C) const { auto *A = new (C) TestTypestateAttr(C, *this, testState); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void TestTypestateAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((test_typestate"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << TestTypestateAttr::ConvertConsumedStateToStr(getTestState()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::test_typestate"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << TestTypestateAttr::ConvertConsumedStateToStr(getTestState()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *TestTypestateAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "test_typestate"; case 1: return "test_typestate"; } } // ThisCallAttr implementation ThisCallAttr *ThisCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ThisCallAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ThisCallAttr *ThisCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ThisCallAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ThisCallAttr *ThisCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_thiscall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_thiscall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_thiscall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_thiscall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } ThisCallAttr *ThisCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_thiscall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_thiscall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_thiscall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_thiscall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_thiscall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } ThisCallAttr::ThisCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::ThisCall, /*IsLateParsed=*/false, false) { } ThisCallAttr *ThisCallAttr::clone(ASTContext &C) const { auto *A = new (C) ThisCallAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ThisCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((thiscall"; OS << "))"; break; } case 1 : { OS << "[[gnu::thiscall"; OS << "]]"; break; } case 2 : { OS << "[[gnu::thiscall"; OS << "]]"; break; } case 3 : { OS << "__thiscall"; OS << ""; break; } case 4 : { OS << "_thiscall"; OS << ""; break; } } } const char *ThisCallAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "thiscall"; case 1: return "thiscall"; case 2: return "thiscall"; case 3: return "__thiscall"; case 4: return "_thiscall"; } } // ThreadAttr implementation ThreadAttr *ThreadAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ThreadAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ThreadAttr *ThreadAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ThreadAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ThreadAttr *ThreadAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } ThreadAttr *ThreadAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } ThreadAttr::ThreadAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : Attr(Ctx, CommonInfo, attr::Thread, /*IsLateParsed=*/false) { } ThreadAttr *ThreadAttr::clone(ASTContext &C) const { auto *A = new (C) ThreadAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ThreadAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__declspec(thread"; OS << ")"; break; } } } const char *ThreadAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "thread"; } } // TransparentUnionAttr implementation TransparentUnionAttr *TransparentUnionAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TransparentUnionAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TransparentUnionAttr *TransparentUnionAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TransparentUnionAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TransparentUnionAttr *TransparentUnionAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_transparent_union: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_transparent_union, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_transparent_union: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_transparent_union, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_transparent_union: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_transparent_union, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } TransparentUnionAttr *TransparentUnionAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_transparent_union: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_transparent_union, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_transparent_union: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_transparent_union, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_transparent_union: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_transparent_union, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } TransparentUnionAttr::TransparentUnionAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::TransparentUnion, /*IsLateParsed=*/false, false) { } TransparentUnionAttr *TransparentUnionAttr::clone(ASTContext &C) const { auto *A = new (C) TransparentUnionAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void TransparentUnionAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((transparent_union"; OS << "))"; break; } case 1 : { OS << "[[gnu::transparent_union"; OS << "]]"; break; } case 2 : { OS << "[[gnu::transparent_union"; OS << "]]"; break; } } } const char *TransparentUnionAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "transparent_union"; case 1: return "transparent_union"; case 2: return "transparent_union"; } } // TrivialABIAttr implementation TrivialABIAttr *TrivialABIAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TrivialABIAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TrivialABIAttr *TrivialABIAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TrivialABIAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TrivialABIAttr *TrivialABIAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_trivial_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_trivial_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_trivial_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_trivial_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } TrivialABIAttr *TrivialABIAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_trivial_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_trivial_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_trivial_abi: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_trivial_abi, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } TrivialABIAttr::TrivialABIAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::TrivialABI, /*IsLateParsed=*/false, false) { } TrivialABIAttr *TrivialABIAttr::clone(ASTContext &C) const { auto *A = new (C) TrivialABIAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void TrivialABIAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((trivial_abi"; OS << "))"; break; } case 1 : { OS << "[[clang::trivial_abi"; OS << "]]"; break; } } } const char *TrivialABIAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "trivial_abi"; case 1: return "trivial_abi"; } } // TryAcquireCapabilityAttr implementation TryAcquireCapabilityAttr *TryAcquireCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TryAcquireCapabilityAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TryAcquireCapabilityAttr *TryAcquireCapabilityAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TryAcquireCapabilityAttr(Ctx, CommonInfo, SuccessValue, Args, ArgsSize); return A; } TryAcquireCapabilityAttr *TryAcquireCapabilityAttr::CreateImplicit(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_try_acquire_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_try_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_try_acquire_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_try_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_try_acquire_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_try_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_try_acquire_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_try_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, SuccessValue, Args, ArgsSize, I); } TryAcquireCapabilityAttr *TryAcquireCapabilityAttr::Create(ASTContext &Ctx, Expr * SuccessValue, Expr * *Args, unsigned ArgsSize, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_try_acquire_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_try_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_try_acquire_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_try_acquire_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_try_acquire_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_try_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_try_acquire_shared_capability: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_try_acquire_shared_capability, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, SuccessValue, Args, ArgsSize, I); } TryAcquireCapabilityAttr::TryAcquireCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * SuccessValue , Expr * *Args, unsigned ArgsSize ) : InheritableAttr(Ctx, CommonInfo, attr::TryAcquireCapability, /*IsLateParsed=*/true, true) , successValue(SuccessValue) , args_Size(ArgsSize), args_(new (Ctx, 16) Expr *[args_Size]) { std::copy(Args, Args + args_Size, args_); } TryAcquireCapabilityAttr::TryAcquireCapabilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , Expr * SuccessValue ) : InheritableAttr(Ctx, CommonInfo, attr::TryAcquireCapability, /*IsLateParsed=*/true, true) , successValue(SuccessValue) , args_Size(0), args_(nullptr) { } TryAcquireCapabilityAttr::Spelling TryAcquireCapabilityAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_try_acquire_capability; case 1: return CXX11_clang_try_acquire_capability; case 2: return GNU_try_acquire_shared_capability; case 3: return CXX11_clang_try_acquire_shared_capability; } } TryAcquireCapabilityAttr *TryAcquireCapabilityAttr::clone(ASTContext &C) const { auto *A = new (C) TryAcquireCapabilityAttr(C, *this, successValue, args_, args_Size); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void TryAcquireCapabilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((try_acquire_capability"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getSuccessValue()->printPretty(OS, nullptr, Policy); OS << ""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::try_acquire_capability"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getSuccessValue()->printPretty(OS, nullptr, Policy); OS << ""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "__attribute__((try_acquire_shared_capability"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getSuccessValue()->printPretty(OS, nullptr, Policy); OS << ""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 3 : { OS << "[[clang::try_acquire_shared_capability"; DelimitAttributeArgument(OS, IsFirstArgument); OS << ""; getSuccessValue()->printPretty(OS, nullptr, Policy); OS << ""; OS << ""; for (const auto &Val : args()) { DelimitAttributeArgument(OS, IsFirstArgument); OS << Val; } OS << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *TryAcquireCapabilityAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "try_acquire_capability"; case 1: return "try_acquire_capability"; case 2: return "try_acquire_shared_capability"; case 3: return "try_acquire_shared_capability"; } } // TypeNonNullAttr implementation TypeNonNullAttr *TypeNonNullAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TypeNonNullAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TypeNonNullAttr *TypeNonNullAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TypeNonNullAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TypeNonNullAttr *TypeNonNullAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } TypeNonNullAttr *TypeNonNullAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } TypeNonNullAttr::TypeNonNullAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::TypeNonNull, /*IsLateParsed=*/false) { } TypeNonNullAttr *TypeNonNullAttr::clone(ASTContext &C) const { auto *A = new (C) TypeNonNullAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void TypeNonNullAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "_Nonnull"; OS << ""; break; } } } const char *TypeNonNullAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "_Nonnull"; } } // TypeNullUnspecifiedAttr implementation TypeNullUnspecifiedAttr *TypeNullUnspecifiedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TypeNullUnspecifiedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TypeNullUnspecifiedAttr *TypeNullUnspecifiedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TypeNullUnspecifiedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TypeNullUnspecifiedAttr *TypeNullUnspecifiedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } TypeNullUnspecifiedAttr *TypeNullUnspecifiedAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } TypeNullUnspecifiedAttr::TypeNullUnspecifiedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::TypeNullUnspecified, /*IsLateParsed=*/false) { } TypeNullUnspecifiedAttr *TypeNullUnspecifiedAttr::clone(ASTContext &C) const { auto *A = new (C) TypeNullUnspecifiedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void TypeNullUnspecifiedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "_Null_unspecified"; OS << ""; break; } } } const char *TypeNullUnspecifiedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "_Null_unspecified"; } } // TypeNullableAttr implementation TypeNullableAttr *TypeNullableAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TypeNullableAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TypeNullableAttr *TypeNullableAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TypeNullableAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TypeNullableAttr *TypeNullableAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } TypeNullableAttr *TypeNullableAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } TypeNullableAttr::TypeNullableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::TypeNullable, /*IsLateParsed=*/false, false) { } TypeNullableAttr *TypeNullableAttr::clone(ASTContext &C) const { auto *A = new (C) TypeNullableAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void TypeNullableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "_Nullable"; OS << ""; break; } } } const char *TypeNullableAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "_Nullable"; } } // TypeNullableResultAttr implementation TypeNullableResultAttr *TypeNullableResultAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TypeNullableResultAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TypeNullableResultAttr *TypeNullableResultAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TypeNullableResultAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TypeNullableResultAttr *TypeNullableResultAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } TypeNullableResultAttr *TypeNullableResultAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } TypeNullableResultAttr::TypeNullableResultAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::TypeNullableResult, /*IsLateParsed=*/false) { } TypeNullableResultAttr *TypeNullableResultAttr::clone(ASTContext &C) const { auto *A = new (C) TypeNullableResultAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void TypeNullableResultAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "_Nullable_result"; OS << ""; break; } } } const char *TypeNullableResultAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "_Nullable_result"; } } // TypeTagForDatatypeAttr implementation TypeTagForDatatypeAttr *TypeTagForDatatypeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, TypeSourceInfo * MatchingCType, bool LayoutCompatible, bool MustBeNull, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TypeTagForDatatypeAttr(Ctx, CommonInfo, ArgumentKind, MatchingCType, LayoutCompatible, MustBeNull); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TypeTagForDatatypeAttr *TypeTagForDatatypeAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, TypeSourceInfo * MatchingCType, bool LayoutCompatible, bool MustBeNull, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TypeTagForDatatypeAttr(Ctx, CommonInfo, ArgumentKind, MatchingCType, LayoutCompatible, MustBeNull); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TypeTagForDatatypeAttr *TypeTagForDatatypeAttr::CreateImplicit(ASTContext &Ctx, IdentifierInfo * ArgumentKind, TypeSourceInfo * MatchingCType, bool LayoutCompatible, bool MustBeNull, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_type_tag_for_datatype: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_type_tag_for_datatype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_type_tag_for_datatype: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_type_tag_for_datatype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_type_tag_for_datatype: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_type_tag_for_datatype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, ArgumentKind, MatchingCType, LayoutCompatible, MustBeNull, I); } TypeTagForDatatypeAttr *TypeTagForDatatypeAttr::Create(ASTContext &Ctx, IdentifierInfo * ArgumentKind, TypeSourceInfo * MatchingCType, bool LayoutCompatible, bool MustBeNull, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_type_tag_for_datatype: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_type_tag_for_datatype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_type_tag_for_datatype: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_type_tag_for_datatype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_type_tag_for_datatype: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_type_tag_for_datatype, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, ArgumentKind, MatchingCType, LayoutCompatible, MustBeNull, I); } TypeTagForDatatypeAttr::TypeTagForDatatypeAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , IdentifierInfo * ArgumentKind , TypeSourceInfo * MatchingCType , bool LayoutCompatible , bool MustBeNull ) : InheritableAttr(Ctx, CommonInfo, attr::TypeTagForDatatype, /*IsLateParsed=*/false, false) , argumentKind(ArgumentKind) , matchingCType(MatchingCType) , layoutCompatible(LayoutCompatible) , mustBeNull(MustBeNull) { } TypeTagForDatatypeAttr *TypeTagForDatatypeAttr::clone(ASTContext &C) const { auto *A = new (C) TypeTagForDatatypeAttr(C, *this, argumentKind, matchingCType, layoutCompatible, mustBeNull); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void TypeTagForDatatypeAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((type_tag_for_datatype"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getMatchingCType().getAsString() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getLayoutCompatible() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getMustBeNull() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::type_tag_for_datatype"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getMatchingCType().getAsString() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getLayoutCompatible() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getMustBeNull() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::type_tag_for_datatype"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << (getArgumentKind() ? getArgumentKind()->getName() : "") << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getMatchingCType().getAsString() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getLayoutCompatible() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getMustBeNull() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *TypeTagForDatatypeAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "type_tag_for_datatype"; case 1: return "type_tag_for_datatype"; case 2: return "type_tag_for_datatype"; } } // TypeVisibilityAttr implementation TypeVisibilityAttr *TypeVisibilityAttr::CreateImplicit(ASTContext &Ctx, TypeVisibilityAttr::VisibilityType Visibility, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TypeVisibilityAttr(Ctx, CommonInfo, Visibility); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TypeVisibilityAttr *TypeVisibilityAttr::Create(ASTContext &Ctx, TypeVisibilityAttr::VisibilityType Visibility, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) TypeVisibilityAttr(Ctx, CommonInfo, Visibility); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } TypeVisibilityAttr *TypeVisibilityAttr::CreateImplicit(ASTContext &Ctx, TypeVisibilityAttr::VisibilityType Visibility, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_type_visibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_type_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_type_visibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_type_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_type_visibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_type_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Visibility, I); } TypeVisibilityAttr *TypeVisibilityAttr::Create(ASTContext &Ctx, TypeVisibilityAttr::VisibilityType Visibility, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_type_visibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_type_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_type_visibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_type_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_type_visibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_type_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Visibility, I); } TypeVisibilityAttr::TypeVisibilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , TypeVisibilityAttr::VisibilityType Visibility ) : InheritableAttr(Ctx, CommonInfo, attr::TypeVisibility, /*IsLateParsed=*/false, false) , visibility(Visibility) { } bool TypeVisibilityAttr::ConvertStrToVisibilityType(StringRef Val, TypeVisibilityAttr::VisibilityType &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("default", TypeVisibilityAttr::VisibilityType::Default) .Case("hidden", TypeVisibilityAttr::VisibilityType::Hidden) .Case("internal", TypeVisibilityAttr::VisibilityType::Hidden) .Case("protected", TypeVisibilityAttr::VisibilityType::Protected) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *TypeVisibilityAttr::ConvertVisibilityTypeToStr(TypeVisibilityAttr::VisibilityType Val) { switch(Val) { case TypeVisibilityAttr::VisibilityType::Default: return "default"; case TypeVisibilityAttr::VisibilityType::Hidden: return "hidden"; case TypeVisibilityAttr::VisibilityType::Protected: return "protected"; } llvm_unreachable("No enumerator with that value"); } TypeVisibilityAttr *TypeVisibilityAttr::clone(ASTContext &C) const { auto *A = new (C) TypeVisibilityAttr(C, *this, visibility); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void TypeVisibilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((type_visibility"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << TypeVisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::type_visibility"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << TypeVisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::type_visibility"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << TypeVisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *TypeVisibilityAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "type_visibility"; case 1: return "type_visibility"; case 2: return "type_visibility"; } } // UPtrAttr implementation UPtrAttr *UPtrAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UPtrAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UPtrAttr *UPtrAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UPtrAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UPtrAttr *UPtrAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } UPtrAttr *UPtrAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } UPtrAttr::UPtrAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::UPtr, /*IsLateParsed=*/false) { } UPtrAttr *UPtrAttr::clone(ASTContext &C) const { auto *A = new (C) UPtrAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void UPtrAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__uptr"; OS << ""; break; } } } const char *UPtrAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__uptr"; } } // UnavailableAttr implementation UnavailableAttr *UnavailableAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, UnavailableAttr::ImplicitReason ImplicitReason, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UnavailableAttr(Ctx, CommonInfo, Message, ImplicitReason); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UnavailableAttr *UnavailableAttr::Create(ASTContext &Ctx, llvm::StringRef Message, UnavailableAttr::ImplicitReason ImplicitReason, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UnavailableAttr(Ctx, CommonInfo, Message, ImplicitReason); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UnavailableAttr *UnavailableAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, UnavailableAttr::ImplicitReason ImplicitReason, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Message, ImplicitReason, I); } UnavailableAttr *UnavailableAttr::Create(ASTContext &Ctx, llvm::StringRef Message, UnavailableAttr::ImplicitReason ImplicitReason, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Message, ImplicitReason, I); } UnavailableAttr *UnavailableAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UnavailableAttr(Ctx, CommonInfo, Message); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UnavailableAttr *UnavailableAttr::Create(ASTContext &Ctx, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UnavailableAttr(Ctx, CommonInfo, Message); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UnavailableAttr *UnavailableAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Message, I); } UnavailableAttr *UnavailableAttr::Create(ASTContext &Ctx, llvm::StringRef Message, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_unavailable: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unavailable, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Message, I); } UnavailableAttr::UnavailableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Message , UnavailableAttr::ImplicitReason ImplicitReason ) : InheritableAttr(Ctx, CommonInfo, attr::Unavailable, /*IsLateParsed=*/false, false) , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) , implicitReason(ImplicitReason) { if (!Message.empty()) std::memcpy(message, Message.data(), messageLength); } UnavailableAttr::UnavailableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Message ) : InheritableAttr(Ctx, CommonInfo, attr::Unavailable, /*IsLateParsed=*/false, false) , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) , implicitReason(UnavailableAttr::ImplicitReason(0)) { if (!Message.empty()) std::memcpy(message, Message.data(), messageLength); } UnavailableAttr::UnavailableAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Unavailable, /*IsLateParsed=*/false, false) , messageLength(0),message(nullptr) , implicitReason(UnavailableAttr::ImplicitReason(0)) { } UnavailableAttr *UnavailableAttr::clone(ASTContext &C) const { auto *A = new (C) UnavailableAttr(C, *this, getMessage(), implicitReason); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void UnavailableAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((unavailable"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMessage() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::unavailable"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMessage() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::unavailable"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMessage() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *UnavailableAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "unavailable"; case 1: return "unavailable"; case 2: return "unavailable"; } } // UninitializedAttr implementation UninitializedAttr *UninitializedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UninitializedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UninitializedAttr *UninitializedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UninitializedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UninitializedAttr *UninitializedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_uninitialized: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_uninitialized: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } UninitializedAttr *UninitializedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_uninitialized: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_uninitialized: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_uninitialized, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } UninitializedAttr::UninitializedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Uninitialized, /*IsLateParsed=*/false, false) { } UninitializedAttr *UninitializedAttr::clone(ASTContext &C) const { auto *A = new (C) UninitializedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void UninitializedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((uninitialized"; OS << "))"; break; } case 1 : { OS << "[[clang::uninitialized"; OS << "]]"; break; } } } const char *UninitializedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "uninitialized"; case 1: return "uninitialized"; } } // UnlikelyAttr implementation UnlikelyAttr *UnlikelyAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UnlikelyAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UnlikelyAttr *UnlikelyAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UnlikelyAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UnlikelyAttr *UnlikelyAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_unlikely: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_unlikely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_unlikely: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unlikely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } UnlikelyAttr *UnlikelyAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_unlikely: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_unlikely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_unlikely: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unlikely, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } UnlikelyAttr::UnlikelyAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : StmtAttr(Ctx, CommonInfo, attr::Unlikely, /*IsLateParsed=*/false) { } UnlikelyAttr *UnlikelyAttr::clone(ASTContext &C) const { auto *A = new (C) UnlikelyAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void UnlikelyAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[unlikely"; OS << "]]"; break; } case 1 : { OS << "[[clang::unlikely"; OS << "]]"; break; } } } const char *UnlikelyAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "unlikely"; case 1: return "unlikely"; } } // UnsafeBufferUsageAttr implementation UnsafeBufferUsageAttr *UnsafeBufferUsageAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UnsafeBufferUsageAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UnsafeBufferUsageAttr *UnsafeBufferUsageAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UnsafeBufferUsageAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UnsafeBufferUsageAttr *UnsafeBufferUsageAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_unsafe_buffer_usage: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unsafe_buffer_usage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_unsafe_buffer_usage: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unsafe_buffer_usage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_unsafe_buffer_usage: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unsafe_buffer_usage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } UnsafeBufferUsageAttr *UnsafeBufferUsageAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_unsafe_buffer_usage: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unsafe_buffer_usage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_unsafe_buffer_usage: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_unsafe_buffer_usage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_unsafe_buffer_usage: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_unsafe_buffer_usage, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } UnsafeBufferUsageAttr::UnsafeBufferUsageAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::UnsafeBufferUsage, /*IsLateParsed=*/false, false) { } UnsafeBufferUsageAttr *UnsafeBufferUsageAttr::clone(ASTContext &C) const { auto *A = new (C) UnsafeBufferUsageAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void UnsafeBufferUsageAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((unsafe_buffer_usage"; OS << "))"; break; } case 1 : { OS << "[[clang::unsafe_buffer_usage"; OS << "]]"; break; } case 2 : { OS << "[[clang::unsafe_buffer_usage"; OS << "]]"; break; } } } const char *UnsafeBufferUsageAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "unsafe_buffer_usage"; case 1: return "unsafe_buffer_usage"; case 2: return "unsafe_buffer_usage"; } } // UnusedAttr implementation UnusedAttr *UnusedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UnusedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UnusedAttr *UnusedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UnusedAttr(Ctx, CommonInfo); return A; } UnusedAttr *UnusedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_maybe_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_maybe_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_maybe_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_maybe_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } UnusedAttr *UnusedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_maybe_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_maybe_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_maybe_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_maybe_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } UnusedAttr::UnusedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Unused, /*IsLateParsed=*/false, false) { } UnusedAttr::Spelling UnusedAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return CXX11_maybe_unused; case 1: return GNU_unused; case 2: return CXX11_gnu_unused; case 3: return C23_gnu_unused; case 4: return C23_maybe_unused; } } UnusedAttr *UnusedAttr::clone(ASTContext &C) const { auto *A = new (C) UnusedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void UnusedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[maybe_unused"; OS << "]]"; break; } case 1 : { OS << "__attribute__((unused"; OS << "))"; break; } case 2 : { OS << "[[gnu::unused"; OS << "]]"; break; } case 3 : { OS << "[[gnu::unused"; OS << "]]"; break; } case 4 : { OS << "[[maybe_unused"; OS << "]]"; break; } } } const char *UnusedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "maybe_unused"; case 1: return "unused"; case 2: return "unused"; case 3: return "unused"; case 4: return "maybe_unused"; } } // UseHandleAttr implementation UseHandleAttr *UseHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UseHandleAttr(Ctx, CommonInfo, HandleType); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UseHandleAttr *UseHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UseHandleAttr(Ctx, CommonInfo, HandleType); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UseHandleAttr *UseHandleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_use_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_use_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_use_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_use_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_use_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_use_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, HandleType, I); } UseHandleAttr *UseHandleAttr::Create(ASTContext &Ctx, llvm::StringRef HandleType, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_use_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_use_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_use_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_use_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_use_handle: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_use_handle, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, HandleType, I); } UseHandleAttr::UseHandleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef HandleType ) : InheritableParamAttr(Ctx, CommonInfo, attr::UseHandle, /*IsLateParsed=*/false, false) , handleTypeLength(HandleType.size()),handleType(new (Ctx, 1) char[handleTypeLength]) { if (!HandleType.empty()) std::memcpy(handleType, HandleType.data(), handleTypeLength); } UseHandleAttr *UseHandleAttr::clone(ASTContext &C) const { auto *A = new (C) UseHandleAttr(C, *this, getHandleType()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void UseHandleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((use_handle"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getHandleType() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::use_handle"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getHandleType() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::use_handle"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getHandleType() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *UseHandleAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "use_handle"; case 1: return "use_handle"; case 2: return "use_handle"; } } // UsedAttr implementation UsedAttr *UsedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UsedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UsedAttr *UsedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UsedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UsedAttr *UsedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_used: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_used, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_used: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_used, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_used: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_used, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } UsedAttr *UsedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_used: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_used, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_used: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_used, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_used: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_used, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } UsedAttr::UsedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Used, /*IsLateParsed=*/false, false) { } UsedAttr *UsedAttr::clone(ASTContext &C) const { auto *A = new (C) UsedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void UsedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((used"; OS << "))"; break; } case 1 : { OS << "[[gnu::used"; OS << "]]"; break; } case 2 : { OS << "[[gnu::used"; OS << "]]"; break; } } } const char *UsedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "used"; case 1: return "used"; case 2: return "used"; } } // UsingIfExistsAttr implementation UsingIfExistsAttr *UsingIfExistsAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UsingIfExistsAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UsingIfExistsAttr *UsingIfExistsAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UsingIfExistsAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UsingIfExistsAttr *UsingIfExistsAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_using_if_exists: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_using_if_exists, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_using_if_exists: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_using_if_exists, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } UsingIfExistsAttr *UsingIfExistsAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_using_if_exists: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_using_if_exists, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_using_if_exists: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_using_if_exists, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } UsingIfExistsAttr::UsingIfExistsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::UsingIfExists, /*IsLateParsed=*/false, false) { } UsingIfExistsAttr *UsingIfExistsAttr::clone(ASTContext &C) const { auto *A = new (C) UsingIfExistsAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void UsingIfExistsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((using_if_exists"; OS << "))"; break; } case 1 : { OS << "[[clang::using_if_exists"; OS << "]]"; break; } } } const char *UsingIfExistsAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "using_if_exists"; case 1: return "using_if_exists"; } } // UuidAttr implementation UuidAttr *UuidAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Guid, MSGuidDecl * GuidDecl, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UuidAttr(Ctx, CommonInfo, Guid, GuidDecl); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UuidAttr *UuidAttr::Create(ASTContext &Ctx, llvm::StringRef Guid, MSGuidDecl * GuidDecl, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UuidAttr(Ctx, CommonInfo, Guid, GuidDecl); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UuidAttr *UuidAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Guid, MSGuidDecl * GuidDecl, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_uuid: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Microsoft_uuid: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Guid, GuidDecl, I); } UuidAttr *UuidAttr::Create(ASTContext &Ctx, llvm::StringRef Guid, MSGuidDecl * GuidDecl, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_uuid: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Microsoft_uuid: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Guid, GuidDecl, I); } UuidAttr *UuidAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Guid, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UuidAttr(Ctx, CommonInfo, Guid); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UuidAttr *UuidAttr::Create(ASTContext &Ctx, llvm::StringRef Guid, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) UuidAttr(Ctx, CommonInfo, Guid); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } UuidAttr *UuidAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Guid, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_uuid: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Microsoft_uuid: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Guid, I); } UuidAttr *UuidAttr::Create(ASTContext &Ctx, llvm::StringRef Guid, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case Declspec_uuid: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, Declspec_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Microsoft_uuid: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Microsoft, Microsoft_uuid, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Declspec, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Guid, I); } UuidAttr::UuidAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Guid , MSGuidDecl * GuidDecl ) : InheritableAttr(Ctx, CommonInfo, attr::Uuid, /*IsLateParsed=*/false, false) , guidLength(Guid.size()),guid(new (Ctx, 1) char[guidLength]) , guidDecl(GuidDecl) { if (!Guid.empty()) std::memcpy(guid, Guid.data(), guidLength); } UuidAttr::UuidAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Guid ) : InheritableAttr(Ctx, CommonInfo, attr::Uuid, /*IsLateParsed=*/false, false) , guidLength(Guid.size()),guid(new (Ctx, 1) char[guidLength]) , guidDecl() { if (!Guid.empty()) std::memcpy(guid, Guid.data(), guidLength); } UuidAttr *UuidAttr::clone(ASTContext &C) const { auto *A = new (C) UuidAttr(C, *this, getGuid(), guidDecl); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void UuidAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__declspec(uuid"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getGuid() << "\""; if (!IsFirstArgument) OS << ")"; OS << ")"; break; } case 1 : { OS << "[uuid"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getGuid() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]"; break; } } } const char *UuidAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "uuid"; case 1: return "uuid"; } } // VTablePointerAuthenticationAttr implementation VTablePointerAuthenticationAttr *VTablePointerAuthenticationAttr::CreateImplicit(ASTContext &Ctx, VTablePointerAuthenticationAttr::VPtrAuthKeyType Key, VTablePointerAuthenticationAttr::AddressDiscriminationMode AddressDiscrimination, VTablePointerAuthenticationAttr::ExtraDiscrimination ExtraDiscrimination, int CustomDiscriminationValue, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) VTablePointerAuthenticationAttr(Ctx, CommonInfo, Key, AddressDiscrimination, ExtraDiscrimination, CustomDiscriminationValue); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } VTablePointerAuthenticationAttr *VTablePointerAuthenticationAttr::Create(ASTContext &Ctx, VTablePointerAuthenticationAttr::VPtrAuthKeyType Key, VTablePointerAuthenticationAttr::AddressDiscriminationMode AddressDiscrimination, VTablePointerAuthenticationAttr::ExtraDiscrimination ExtraDiscrimination, int CustomDiscriminationValue, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) VTablePointerAuthenticationAttr(Ctx, CommonInfo, Key, AddressDiscrimination, ExtraDiscrimination, CustomDiscriminationValue); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } VTablePointerAuthenticationAttr *VTablePointerAuthenticationAttr::CreateImplicit(ASTContext &Ctx, VTablePointerAuthenticationAttr::VPtrAuthKeyType Key, VTablePointerAuthenticationAttr::AddressDiscriminationMode AddressDiscrimination, VTablePointerAuthenticationAttr::ExtraDiscrimination ExtraDiscrimination, int CustomDiscriminationValue, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ptrauth_vtable_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ptrauth_vtable_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ptrauth_vtable_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ptrauth_vtable_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ptrauth_vtable_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ptrauth_vtable_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Key, AddressDiscrimination, ExtraDiscrimination, CustomDiscriminationValue, I); } VTablePointerAuthenticationAttr *VTablePointerAuthenticationAttr::Create(ASTContext &Ctx, VTablePointerAuthenticationAttr::VPtrAuthKeyType Key, VTablePointerAuthenticationAttr::AddressDiscriminationMode AddressDiscrimination, VTablePointerAuthenticationAttr::ExtraDiscrimination ExtraDiscrimination, int CustomDiscriminationValue, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_ptrauth_vtable_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_ptrauth_vtable_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_ptrauth_vtable_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_ptrauth_vtable_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_ptrauth_vtable_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_ptrauth_vtable_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Key, AddressDiscrimination, ExtraDiscrimination, CustomDiscriminationValue, I); } VTablePointerAuthenticationAttr::VTablePointerAuthenticationAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , VTablePointerAuthenticationAttr::VPtrAuthKeyType Key , VTablePointerAuthenticationAttr::AddressDiscriminationMode AddressDiscrimination , VTablePointerAuthenticationAttr::ExtraDiscrimination ExtraDiscrimination , int CustomDiscriminationValue ) : InheritableAttr(Ctx, CommonInfo, attr::VTablePointerAuthentication, /*IsLateParsed=*/false, false) , key(Key) , addressDiscrimination(AddressDiscrimination) , extraDiscrimination(ExtraDiscrimination) , customDiscriminationValue(CustomDiscriminationValue) { } VTablePointerAuthenticationAttr::VTablePointerAuthenticationAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , VTablePointerAuthenticationAttr::VPtrAuthKeyType Key , VTablePointerAuthenticationAttr::AddressDiscriminationMode AddressDiscrimination , VTablePointerAuthenticationAttr::ExtraDiscrimination ExtraDiscrimination ) : InheritableAttr(Ctx, CommonInfo, attr::VTablePointerAuthentication, /*IsLateParsed=*/false, false) , key(Key) , addressDiscrimination(AddressDiscrimination) , extraDiscrimination(ExtraDiscrimination) , customDiscriminationValue() { } bool VTablePointerAuthenticationAttr::ConvertStrToVPtrAuthKeyType(StringRef Val, VTablePointerAuthenticationAttr::VPtrAuthKeyType &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("default_key", VTablePointerAuthenticationAttr::VPtrAuthKeyType::DefaultKey) .Case("no_authentication", VTablePointerAuthenticationAttr::VPtrAuthKeyType::NoKey) .Case("process_dependent", VTablePointerAuthenticationAttr::VPtrAuthKeyType::ProcessDependent) .Case("process_independent", VTablePointerAuthenticationAttr::VPtrAuthKeyType::ProcessIndependent) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *VTablePointerAuthenticationAttr::ConvertVPtrAuthKeyTypeToStr(VTablePointerAuthenticationAttr::VPtrAuthKeyType Val) { switch(Val) { case VTablePointerAuthenticationAttr::VPtrAuthKeyType::DefaultKey: return "default_key"; case VTablePointerAuthenticationAttr::VPtrAuthKeyType::NoKey: return "no_authentication"; case VTablePointerAuthenticationAttr::VPtrAuthKeyType::ProcessDependent: return "process_dependent"; case VTablePointerAuthenticationAttr::VPtrAuthKeyType::ProcessIndependent: return "process_independent"; } llvm_unreachable("No enumerator with that value"); } bool VTablePointerAuthenticationAttr::ConvertStrToAddressDiscriminationMode(StringRef Val, VTablePointerAuthenticationAttr::AddressDiscriminationMode &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("default_address_discrimination", VTablePointerAuthenticationAttr::AddressDiscriminationMode::DefaultAddressDiscrimination) .Case("no_address_discrimination", VTablePointerAuthenticationAttr::AddressDiscriminationMode::NoAddressDiscrimination) .Case("address_discrimination", VTablePointerAuthenticationAttr::AddressDiscriminationMode::AddressDiscrimination) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *VTablePointerAuthenticationAttr::ConvertAddressDiscriminationModeToStr(VTablePointerAuthenticationAttr::AddressDiscriminationMode Val) { switch(Val) { case VTablePointerAuthenticationAttr::AddressDiscriminationMode::DefaultAddressDiscrimination: return "default_address_discrimination"; case VTablePointerAuthenticationAttr::AddressDiscriminationMode::NoAddressDiscrimination: return "no_address_discrimination"; case VTablePointerAuthenticationAttr::AddressDiscriminationMode::AddressDiscrimination: return "address_discrimination"; } llvm_unreachable("No enumerator with that value"); } bool VTablePointerAuthenticationAttr::ConvertStrToExtraDiscrimination(StringRef Val, VTablePointerAuthenticationAttr::ExtraDiscrimination &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("default_extra_discrimination", VTablePointerAuthenticationAttr::ExtraDiscrimination::DefaultExtraDiscrimination) .Case("no_extra_discrimination", VTablePointerAuthenticationAttr::ExtraDiscrimination::NoExtraDiscrimination) .Case("type_discrimination", VTablePointerAuthenticationAttr::ExtraDiscrimination::TypeDiscrimination) .Case("custom_discrimination", VTablePointerAuthenticationAttr::ExtraDiscrimination::CustomDiscrimination) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *VTablePointerAuthenticationAttr::ConvertExtraDiscriminationToStr(VTablePointerAuthenticationAttr::ExtraDiscrimination Val) { switch(Val) { case VTablePointerAuthenticationAttr::ExtraDiscrimination::DefaultExtraDiscrimination: return "default_extra_discrimination"; case VTablePointerAuthenticationAttr::ExtraDiscrimination::NoExtraDiscrimination: return "no_extra_discrimination"; case VTablePointerAuthenticationAttr::ExtraDiscrimination::TypeDiscrimination: return "type_discrimination"; case VTablePointerAuthenticationAttr::ExtraDiscrimination::CustomDiscrimination: return "custom_discrimination"; } llvm_unreachable("No enumerator with that value"); } VTablePointerAuthenticationAttr *VTablePointerAuthenticationAttr::clone(ASTContext &C) const { auto *A = new (C) VTablePointerAuthenticationAttr(C, *this, key, addressDiscrimination, extraDiscrimination, customDiscriminationValue); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void VTablePointerAuthenticationAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((ptrauth_vtable_pointer"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << VTablePointerAuthenticationAttr::ConvertVPtrAuthKeyTypeToStr(getKey()) << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << VTablePointerAuthenticationAttr::ConvertAddressDiscriminationModeToStr(getAddressDiscrimination()) << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << VTablePointerAuthenticationAttr::ConvertExtraDiscriminationToStr(getExtraDiscrimination()) << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getCustomDiscriminationValue() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::ptrauth_vtable_pointer"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << VTablePointerAuthenticationAttr::ConvertVPtrAuthKeyTypeToStr(getKey()) << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << VTablePointerAuthenticationAttr::ConvertAddressDiscriminationModeToStr(getAddressDiscrimination()) << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << VTablePointerAuthenticationAttr::ConvertExtraDiscriminationToStr(getExtraDiscrimination()) << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getCustomDiscriminationValue() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::ptrauth_vtable_pointer"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << VTablePointerAuthenticationAttr::ConvertVPtrAuthKeyTypeToStr(getKey()) << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << VTablePointerAuthenticationAttr::ConvertAddressDiscriminationModeToStr(getAddressDiscrimination()) << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << VTablePointerAuthenticationAttr::ConvertExtraDiscriminationToStr(getExtraDiscrimination()) << "\""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getCustomDiscriminationValue() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *VTablePointerAuthenticationAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "ptrauth_vtable_pointer"; case 1: return "ptrauth_vtable_pointer"; case 2: return "ptrauth_vtable_pointer"; } } // VecReturnAttr implementation VecReturnAttr *VecReturnAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) VecReturnAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } VecReturnAttr *VecReturnAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) VecReturnAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } VecReturnAttr *VecReturnAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_vecreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_vecreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_vecreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_vecreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } VecReturnAttr *VecReturnAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_vecreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_vecreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_vecreturn: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_vecreturn, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } VecReturnAttr::VecReturnAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::VecReturn, /*IsLateParsed=*/false, false) { } VecReturnAttr *VecReturnAttr::clone(ASTContext &C) const { auto *A = new (C) VecReturnAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void VecReturnAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((vecreturn"; OS << "))"; break; } case 1 : { OS << "[[clang::vecreturn"; OS << "]]"; break; } } } const char *VecReturnAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "vecreturn"; case 1: return "vecreturn"; } } // VecTypeHintAttr implementation VecTypeHintAttr *VecTypeHintAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * TypeHint, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) VecTypeHintAttr(Ctx, CommonInfo, TypeHint); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } VecTypeHintAttr *VecTypeHintAttr::Create(ASTContext &Ctx, TypeSourceInfo * TypeHint, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) VecTypeHintAttr(Ctx, CommonInfo, TypeHint); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } VecTypeHintAttr *VecTypeHintAttr::CreateImplicit(ASTContext &Ctx, TypeSourceInfo * TypeHint, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, TypeHint, I); } VecTypeHintAttr *VecTypeHintAttr::Create(ASTContext &Ctx, TypeSourceInfo * TypeHint, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, TypeHint, I); } VecTypeHintAttr::VecTypeHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , TypeSourceInfo * TypeHint ) : InheritableAttr(Ctx, CommonInfo, attr::VecTypeHint, /*IsLateParsed=*/false, false) , typeHint(TypeHint) { } VecTypeHintAttr *VecTypeHintAttr::clone(ASTContext &C) const { auto *A = new (C) VecTypeHintAttr(C, *this, typeHint); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void VecTypeHintAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((vec_type_hint"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getTypeHint().getAsString() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *VecTypeHintAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "vec_type_hint"; } } // VectorCallAttr implementation VectorCallAttr *VectorCallAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) VectorCallAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } VectorCallAttr *VectorCallAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) VectorCallAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } VectorCallAttr *VectorCallAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_vectorcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_vectorcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_vectorcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_vectorcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } VectorCallAttr *VectorCallAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_vectorcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_vectorcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_vectorcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case Keyword_vectorcall: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_Keyword, Keyword_vectorcall, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } VectorCallAttr::VectorCallAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::VectorCall, /*IsLateParsed=*/false, false) { } VectorCallAttr *VectorCallAttr::clone(ASTContext &C) const { auto *A = new (C) VectorCallAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void VectorCallAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((vectorcall"; OS << "))"; break; } case 1 : { OS << "[[clang::vectorcall"; OS << "]]"; break; } case 2 : { OS << "[[clang::vectorcall"; OS << "]]"; break; } case 3 : { OS << "__vectorcall"; OS << ""; break; } case 4 : { OS << "_vectorcall"; OS << ""; break; } } } const char *VectorCallAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "vectorcall"; case 1: return "vectorcall"; case 2: return "vectorcall"; case 3: return "__vectorcall"; case 4: return "_vectorcall"; } } // VisibilityAttr implementation VisibilityAttr *VisibilityAttr::CreateImplicit(ASTContext &Ctx, VisibilityAttr::VisibilityType Visibility, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) VisibilityAttr(Ctx, CommonInfo, Visibility); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } VisibilityAttr *VisibilityAttr::Create(ASTContext &Ctx, VisibilityAttr::VisibilityType Visibility, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) VisibilityAttr(Ctx, CommonInfo, Visibility); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } VisibilityAttr *VisibilityAttr::CreateImplicit(ASTContext &Ctx, VisibilityAttr::VisibilityType Visibility, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_visibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_visibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_visibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Visibility, I); } VisibilityAttr *VisibilityAttr::Create(ASTContext &Ctx, VisibilityAttr::VisibilityType Visibility, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_visibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_visibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_visibility: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_visibility, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Visibility, I); } VisibilityAttr::VisibilityAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , VisibilityAttr::VisibilityType Visibility ) : InheritableAttr(Ctx, CommonInfo, attr::Visibility, /*IsLateParsed=*/false, false) , visibility(Visibility) { } bool VisibilityAttr::ConvertStrToVisibilityType(StringRef Val, VisibilityAttr::VisibilityType &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("default", VisibilityAttr::VisibilityType::Default) .Case("hidden", VisibilityAttr::VisibilityType::Hidden) .Case("internal", VisibilityAttr::VisibilityType::Hidden) .Case("protected", VisibilityAttr::VisibilityType::Protected) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *VisibilityAttr::ConvertVisibilityTypeToStr(VisibilityAttr::VisibilityType Val) { switch(Val) { case VisibilityAttr::VisibilityType::Default: return "default"; case VisibilityAttr::VisibilityType::Hidden: return "hidden"; case VisibilityAttr::VisibilityType::Protected: return "protected"; } llvm_unreachable("No enumerator with that value"); } VisibilityAttr *VisibilityAttr::clone(ASTContext &C) const { auto *A = new (C) VisibilityAttr(C, *this, visibility); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void VisibilityAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((visibility"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << VisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::visibility"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << VisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::visibility"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << VisibilityAttr::ConvertVisibilityTypeToStr(getVisibility()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *VisibilityAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "visibility"; case 1: return "visibility"; case 2: return "visibility"; } } // WarnUnusedAttr implementation WarnUnusedAttr *WarnUnusedAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WarnUnusedAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WarnUnusedAttr *WarnUnusedAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WarnUnusedAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WarnUnusedAttr *WarnUnusedAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_warn_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_warn_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_warn_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_warn_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_warn_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_warn_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } WarnUnusedAttr *WarnUnusedAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_warn_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_warn_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_warn_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_warn_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_warn_unused: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_warn_unused, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } WarnUnusedAttr::WarnUnusedAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::WarnUnused, /*IsLateParsed=*/false, false) { } WarnUnusedAttr *WarnUnusedAttr::clone(ASTContext &C) const { auto *A = new (C) WarnUnusedAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void WarnUnusedAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((warn_unused"; OS << "))"; break; } case 1 : { OS << "[[gnu::warn_unused"; OS << "]]"; break; } case 2 : { OS << "[[gnu::warn_unused"; OS << "]]"; break; } } } const char *WarnUnusedAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "warn_unused"; case 1: return "warn_unused"; case 2: return "warn_unused"; } } // WarnUnusedResultAttr implementation WarnUnusedResultAttr *WarnUnusedResultAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WarnUnusedResultAttr(Ctx, CommonInfo, Message); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WarnUnusedResultAttr *WarnUnusedResultAttr::Create(ASTContext &Ctx, llvm::StringRef Message, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WarnUnusedResultAttr(Ctx, CommonInfo, Message); return A; } WarnUnusedResultAttr *WarnUnusedResultAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Message, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_nodiscard: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_nodiscard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_nodiscard: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_nodiscard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_warn_unused_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_warn_unused_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_warn_unused_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_warn_unused_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Message, I); } WarnUnusedResultAttr *WarnUnusedResultAttr::Create(ASTContext &Ctx, llvm::StringRef Message, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case CXX11_nodiscard: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_nodiscard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_nodiscard: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_nodiscard, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_warn_unused_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_warn_unused_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_warn_unused_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_warn_unused_result: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_warn_unused_result, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Message, I); } WarnUnusedResultAttr::WarnUnusedResultAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Message ) : InheritableAttr(Ctx, CommonInfo, attr::WarnUnusedResult, /*IsLateParsed=*/false, false) , messageLength(Message.size()),message(new (Ctx, 1) char[messageLength]) { if (!Message.empty()) std::memcpy(message, Message.data(), messageLength); } WarnUnusedResultAttr::WarnUnusedResultAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::WarnUnusedResult, /*IsLateParsed=*/false, false) , messageLength(0),message(nullptr) { } WarnUnusedResultAttr::Spelling WarnUnusedResultAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return CXX11_nodiscard; case 1: return C23_nodiscard; case 2: return CXX11_clang_warn_unused_result; case 3: return GNU_warn_unused_result; case 4: return CXX11_gnu_warn_unused_result; case 5: return C23_gnu_warn_unused_result; } } WarnUnusedResultAttr *WarnUnusedResultAttr::clone(ASTContext &C) const { auto *A = new (C) WarnUnusedResultAttr(C, *this, getMessage()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void WarnUnusedResultAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "[[nodiscard"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMessage() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 1 : { OS << "[[nodiscard"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMessage() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::warn_unused_result"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMessage() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 3 : { OS << "__attribute__((warn_unused_result"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMessage() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 4 : { OS << "[[gnu::warn_unused_result"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMessage() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 5 : { OS << "[[gnu::warn_unused_result"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getMessage() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *WarnUnusedResultAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "nodiscard"; case 1: return "nodiscard"; case 2: return "warn_unused_result"; case 3: return "warn_unused_result"; case 4: return "warn_unused_result"; case 5: return "warn_unused_result"; } } // WeakAttr implementation WeakAttr *WeakAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WeakAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WeakAttr *WeakAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WeakAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WeakAttr *WeakAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_weak: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_weak, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_weak: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_weak, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_weak: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_weak, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } WeakAttr *WeakAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_weak: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_weak, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_weak: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_weak, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_weak: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_weak, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } WeakAttr::WeakAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::Weak, /*IsLateParsed=*/false, false) { } WeakAttr *WeakAttr::clone(ASTContext &C) const { auto *A = new (C) WeakAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void WeakAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((weak"; OS << "))"; break; } case 1 : { OS << "[[gnu::weak"; OS << "]]"; break; } case 2 : { OS << "[[gnu::weak"; OS << "]]"; break; } } } const char *WeakAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "weak"; case 1: return "weak"; case 2: return "weak"; } } // WeakImportAttr implementation WeakImportAttr *WeakImportAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WeakImportAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WeakImportAttr *WeakImportAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WeakImportAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WeakImportAttr *WeakImportAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_weak_import: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_weak_import, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_weak_import: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_weak_import, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_weak_import: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_weak_import, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } WeakImportAttr *WeakImportAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_weak_import: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_weak_import, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_weak_import: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_weak_import, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_weak_import: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_weak_import, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } WeakImportAttr::WeakImportAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::WeakImport, /*IsLateParsed=*/false, false) { } WeakImportAttr *WeakImportAttr::clone(ASTContext &C) const { auto *A = new (C) WeakImportAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void WeakImportAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((weak_import"; OS << "))"; break; } case 1 : { OS << "[[clang::weak_import"; OS << "]]"; break; } case 2 : { OS << "[[clang::weak_import"; OS << "]]"; break; } } } const char *WeakImportAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "weak_import"; case 1: return "weak_import"; case 2: return "weak_import"; } } // WeakRefAttr implementation WeakRefAttr *WeakRefAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Aliasee, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WeakRefAttr(Ctx, CommonInfo, Aliasee); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WeakRefAttr *WeakRefAttr::Create(ASTContext &Ctx, llvm::StringRef Aliasee, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WeakRefAttr(Ctx, CommonInfo, Aliasee); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WeakRefAttr *WeakRefAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef Aliasee, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_weakref: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_weakref, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_weakref: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_weakref, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_weakref: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_weakref, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, Aliasee, I); } WeakRefAttr *WeakRefAttr::Create(ASTContext &Ctx, llvm::StringRef Aliasee, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_weakref: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_weakref, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_weakref: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_weakref, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_weakref: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_weakref, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, Aliasee, I); } WeakRefAttr::WeakRefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef Aliasee ) : InheritableAttr(Ctx, CommonInfo, attr::WeakRef, /*IsLateParsed=*/false, false) , aliaseeLength(Aliasee.size()),aliasee(new (Ctx, 1) char[aliaseeLength]) { if (!Aliasee.empty()) std::memcpy(aliasee, Aliasee.data(), aliaseeLength); } WeakRefAttr::WeakRefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::WeakRef, /*IsLateParsed=*/false, false) , aliaseeLength(0),aliasee(nullptr) { } WeakRefAttr *WeakRefAttr::clone(ASTContext &C) const { auto *A = new (C) WeakRefAttr(C, *this, getAliasee()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void WeakRefAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((weakref"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getAliasee() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::weakref"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getAliasee() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::weakref"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getAliasee() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *WeakRefAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "weakref"; case 1: return "weakref"; case 2: return "weakref"; } } // WebAssemblyExportNameAttr implementation WebAssemblyExportNameAttr *WebAssemblyExportNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ExportName, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WebAssemblyExportNameAttr(Ctx, CommonInfo, ExportName); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WebAssemblyExportNameAttr *WebAssemblyExportNameAttr::Create(ASTContext &Ctx, llvm::StringRef ExportName, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WebAssemblyExportNameAttr(Ctx, CommonInfo, ExportName); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WebAssemblyExportNameAttr *WebAssemblyExportNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ExportName, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_export_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_export_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_export_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_export_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_export_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_export_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, ExportName, I); } WebAssemblyExportNameAttr *WebAssemblyExportNameAttr::Create(ASTContext &Ctx, llvm::StringRef ExportName, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_export_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_export_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_export_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_export_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_export_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_export_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, ExportName, I); } WebAssemblyExportNameAttr::WebAssemblyExportNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef ExportName ) : InheritableAttr(Ctx, CommonInfo, attr::WebAssemblyExportName, /*IsLateParsed=*/false, false) , exportNameLength(ExportName.size()),exportName(new (Ctx, 1) char[exportNameLength]) { if (!ExportName.empty()) std::memcpy(exportName, ExportName.data(), exportNameLength); } WebAssemblyExportNameAttr *WebAssemblyExportNameAttr::clone(ASTContext &C) const { auto *A = new (C) WebAssemblyExportNameAttr(C, *this, getExportName()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void WebAssemblyExportNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((export_name"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getExportName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::export_name"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getExportName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::export_name"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getExportName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *WebAssemblyExportNameAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "export_name"; case 1: return "export_name"; case 2: return "export_name"; } } // WebAssemblyFuncrefAttr implementation WebAssemblyFuncrefAttr *WebAssemblyFuncrefAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WebAssemblyFuncrefAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WebAssemblyFuncrefAttr *WebAssemblyFuncrefAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WebAssemblyFuncrefAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WebAssemblyFuncrefAttr *WebAssemblyFuncrefAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, I); } WebAssemblyFuncrefAttr *WebAssemblyFuncrefAttr::Create(ASTContext &Ctx, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_Keyword, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, I); } WebAssemblyFuncrefAttr::WebAssemblyFuncrefAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : TypeAttr(Ctx, CommonInfo, attr::WebAssemblyFuncref, /*IsLateParsed=*/false) { } WebAssemblyFuncrefAttr *WebAssemblyFuncrefAttr::clone(ASTContext &C) const { auto *A = new (C) WebAssemblyFuncrefAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void WebAssemblyFuncrefAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__funcref"; OS << ""; break; } } } const char *WebAssemblyFuncrefAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "__funcref"; } } // WebAssemblyImportModuleAttr implementation WebAssemblyImportModuleAttr *WebAssemblyImportModuleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ImportModule, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WebAssemblyImportModuleAttr(Ctx, CommonInfo, ImportModule); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WebAssemblyImportModuleAttr *WebAssemblyImportModuleAttr::Create(ASTContext &Ctx, llvm::StringRef ImportModule, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WebAssemblyImportModuleAttr(Ctx, CommonInfo, ImportModule); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WebAssemblyImportModuleAttr *WebAssemblyImportModuleAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ImportModule, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_import_module: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_import_module, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_import_module: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_import_module, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_import_module: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_import_module, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, ImportModule, I); } WebAssemblyImportModuleAttr *WebAssemblyImportModuleAttr::Create(ASTContext &Ctx, llvm::StringRef ImportModule, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_import_module: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_import_module, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_import_module: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_import_module, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_import_module: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_import_module, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, ImportModule, I); } WebAssemblyImportModuleAttr::WebAssemblyImportModuleAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef ImportModule ) : InheritableAttr(Ctx, CommonInfo, attr::WebAssemblyImportModule, /*IsLateParsed=*/false, false) , importModuleLength(ImportModule.size()),importModule(new (Ctx, 1) char[importModuleLength]) { if (!ImportModule.empty()) std::memcpy(importModule, ImportModule.data(), importModuleLength); } WebAssemblyImportModuleAttr *WebAssemblyImportModuleAttr::clone(ASTContext &C) const { auto *A = new (C) WebAssemblyImportModuleAttr(C, *this, getImportModule()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void WebAssemblyImportModuleAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((import_module"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getImportModule() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::import_module"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getImportModule() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::import_module"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getImportModule() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *WebAssemblyImportModuleAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "import_module"; case 1: return "import_module"; case 2: return "import_module"; } } // WebAssemblyImportNameAttr implementation WebAssemblyImportNameAttr *WebAssemblyImportNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ImportName, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WebAssemblyImportNameAttr(Ctx, CommonInfo, ImportName); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WebAssemblyImportNameAttr *WebAssemblyImportNameAttr::Create(ASTContext &Ctx, llvm::StringRef ImportName, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WebAssemblyImportNameAttr(Ctx, CommonInfo, ImportName); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WebAssemblyImportNameAttr *WebAssemblyImportNameAttr::CreateImplicit(ASTContext &Ctx, llvm::StringRef ImportName, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_import_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_import_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_import_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_import_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_import_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_import_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, ImportName, I); } WebAssemblyImportNameAttr *WebAssemblyImportNameAttr::Create(ASTContext &Ctx, llvm::StringRef ImportName, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_import_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_import_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_import_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_import_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_import_name: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_import_name, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, ImportName, I); } WebAssemblyImportNameAttr::WebAssemblyImportNameAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , llvm::StringRef ImportName ) : InheritableAttr(Ctx, CommonInfo, attr::WebAssemblyImportName, /*IsLateParsed=*/false, false) , importNameLength(ImportName.size()),importName(new (Ctx, 1) char[importNameLength]) { if (!ImportName.empty()) std::memcpy(importName, ImportName.data(), importNameLength); } WebAssemblyImportNameAttr *WebAssemblyImportNameAttr::clone(ASTContext &C) const { auto *A = new (C) WebAssemblyImportNameAttr(C, *this, getImportName()); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void WebAssemblyImportNameAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((import_name"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getImportName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::import_name"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getImportName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::import_name"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << getImportName() << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *WebAssemblyImportNameAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "import_name"; case 1: return "import_name"; case 2: return "import_name"; } } // WorkGroupSizeHintAttr implementation WorkGroupSizeHintAttr *WorkGroupSizeHintAttr::CreateImplicit(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WorkGroupSizeHintAttr(Ctx, CommonInfo, XDim, YDim, ZDim); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WorkGroupSizeHintAttr *WorkGroupSizeHintAttr::Create(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) WorkGroupSizeHintAttr(Ctx, CommonInfo, XDim, YDim, ZDim); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } WorkGroupSizeHintAttr *WorkGroupSizeHintAttr::CreateImplicit(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return CreateImplicit(Ctx, XDim, YDim, ZDim, I); } WorkGroupSizeHintAttr *WorkGroupSizeHintAttr::Create(ASTContext &Ctx, unsigned XDim, unsigned YDim, unsigned ZDim, SourceRange Range) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, {AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}); return Create(Ctx, XDim, YDim, ZDim, I); } WorkGroupSizeHintAttr::WorkGroupSizeHintAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned XDim , unsigned YDim , unsigned ZDim ) : InheritableAttr(Ctx, CommonInfo, attr::WorkGroupSizeHint, /*IsLateParsed=*/false, false) , xDim(XDim) , yDim(YDim) , zDim(ZDim) { } WorkGroupSizeHintAttr *WorkGroupSizeHintAttr::clone(ASTContext &C) const { auto *A = new (C) WorkGroupSizeHintAttr(C, *this, xDim, yDim, zDim); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void WorkGroupSizeHintAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((work_group_size_hint"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getXDim() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getYDim() << ""; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getZDim() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } } } const char *WorkGroupSizeHintAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "work_group_size_hint"; } } // X86ForceAlignArgPointerAttr implementation X86ForceAlignArgPointerAttr *X86ForceAlignArgPointerAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) X86ForceAlignArgPointerAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } X86ForceAlignArgPointerAttr *X86ForceAlignArgPointerAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) X86ForceAlignArgPointerAttr(Ctx, CommonInfo); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } X86ForceAlignArgPointerAttr *X86ForceAlignArgPointerAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_force_align_arg_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_force_align_arg_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_force_align_arg_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_force_align_arg_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_force_align_arg_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_force_align_arg_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } X86ForceAlignArgPointerAttr *X86ForceAlignArgPointerAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_force_align_arg_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_force_align_arg_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_force_align_arg_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_force_align_arg_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_force_align_arg_pointer: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_force_align_arg_pointer, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } X86ForceAlignArgPointerAttr::X86ForceAlignArgPointerAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::X86ForceAlignArgPointer, /*IsLateParsed=*/false, false) { } X86ForceAlignArgPointerAttr *X86ForceAlignArgPointerAttr::clone(ASTContext &C) const { auto *A = new (C) X86ForceAlignArgPointerAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void X86ForceAlignArgPointerAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((force_align_arg_pointer"; OS << "))"; break; } case 1 : { OS << "[[gnu::force_align_arg_pointer"; OS << "]]"; break; } case 2 : { OS << "[[gnu::force_align_arg_pointer"; OS << "]]"; break; } } } const char *X86ForceAlignArgPointerAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "force_align_arg_pointer"; case 1: return "force_align_arg_pointer"; case 2: return "force_align_arg_pointer"; } } // XRayInstrumentAttr implementation XRayInstrumentAttr *XRayInstrumentAttr::CreateImplicit(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) XRayInstrumentAttr(Ctx, CommonInfo); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } XRayInstrumentAttr *XRayInstrumentAttr::Create(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) XRayInstrumentAttr(Ctx, CommonInfo); return A; } XRayInstrumentAttr *XRayInstrumentAttr::CreateImplicit(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_xray_always_instrument: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_xray_always_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_xray_always_instrument: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_xray_always_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_xray_always_instrument: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_xray_always_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_xray_never_instrument: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_xray_never_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_xray_never_instrument: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_xray_never_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_xray_never_instrument: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_xray_never_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, I); } XRayInstrumentAttr *XRayInstrumentAttr::Create(ASTContext &Ctx, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_xray_always_instrument: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_xray_always_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_xray_always_instrument: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_xray_always_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_xray_always_instrument: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_xray_always_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case GNU_xray_never_instrument: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_xray_never_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_xray_never_instrument: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_xray_never_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_xray_never_instrument: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_xray_never_instrument, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, I); } XRayInstrumentAttr::XRayInstrumentAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo ) : InheritableAttr(Ctx, CommonInfo, attr::XRayInstrument, /*IsLateParsed=*/false, false) { } XRayInstrumentAttr::Spelling XRayInstrumentAttr::getSemanticSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown spelling list index"); case 0: return GNU_xray_always_instrument; case 1: return CXX11_clang_xray_always_instrument; case 2: return C23_clang_xray_always_instrument; case 3: return GNU_xray_never_instrument; case 4: return CXX11_clang_xray_never_instrument; case 5: return C23_clang_xray_never_instrument; } } XRayInstrumentAttr *XRayInstrumentAttr::clone(ASTContext &C) const { auto *A = new (C) XRayInstrumentAttr(C, *this); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void XRayInstrumentAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((xray_always_instrument"; OS << "))"; break; } case 1 : { OS << "[[clang::xray_always_instrument"; OS << "]]"; break; } case 2 : { OS << "[[clang::xray_always_instrument"; OS << "]]"; break; } case 3 : { OS << "__attribute__((xray_never_instrument"; OS << "))"; break; } case 4 : { OS << "[[clang::xray_never_instrument"; OS << "]]"; break; } case 5 : { OS << "[[clang::xray_never_instrument"; OS << "]]"; break; } } } const char *XRayInstrumentAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "xray_always_instrument"; case 1: return "xray_always_instrument"; case 2: return "xray_always_instrument"; case 3: return "xray_never_instrument"; case 4: return "xray_never_instrument"; case 5: return "xray_never_instrument"; } } // XRayLogArgsAttr implementation XRayLogArgsAttr *XRayLogArgsAttr::CreateImplicit(ASTContext &Ctx, unsigned ArgumentCount, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) XRayLogArgsAttr(Ctx, CommonInfo, ArgumentCount); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } XRayLogArgsAttr *XRayLogArgsAttr::Create(ASTContext &Ctx, unsigned ArgumentCount, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) XRayLogArgsAttr(Ctx, CommonInfo, ArgumentCount); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } XRayLogArgsAttr *XRayLogArgsAttr::CreateImplicit(ASTContext &Ctx, unsigned ArgumentCount, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_xray_log_args: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_xray_log_args, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_xray_log_args: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_xray_log_args, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_xray_log_args: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_xray_log_args, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, ArgumentCount, I); } XRayLogArgsAttr *XRayLogArgsAttr::Create(ASTContext &Ctx, unsigned ArgumentCount, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_xray_log_args: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_xray_log_args, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_clang_xray_log_args: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_clang_xray_log_args, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_clang_xray_log_args: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_clang_xray_log_args, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, ArgumentCount, I); } XRayLogArgsAttr::XRayLogArgsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , unsigned ArgumentCount ) : InheritableAttr(Ctx, CommonInfo, attr::XRayLogArgs, /*IsLateParsed=*/false, false) , argumentCount(ArgumentCount) { } XRayLogArgsAttr *XRayLogArgsAttr::clone(ASTContext &C) const { auto *A = new (C) XRayLogArgsAttr(C, *this, argumentCount); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void XRayLogArgsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((xray_log_args"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getArgumentCount() << ""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[clang::xray_log_args"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getArgumentCount() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[clang::xray_log_args"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "" << getArgumentCount() << ""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *XRayLogArgsAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "xray_log_args"; case 1: return "xray_log_args"; case 2: return "xray_log_args"; } } // ZeroCallUsedRegsAttr implementation ZeroCallUsedRegsAttr *ZeroCallUsedRegsAttr::CreateImplicit(ASTContext &Ctx, ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind ZeroCallUsedRegs, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ZeroCallUsedRegsAttr(Ctx, CommonInfo, ZeroCallUsedRegs); A->setImplicit(true); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ZeroCallUsedRegsAttr *ZeroCallUsedRegsAttr::Create(ASTContext &Ctx, ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind ZeroCallUsedRegs, const AttributeCommonInfo &CommonInfo) { auto *A = new (Ctx) ZeroCallUsedRegsAttr(Ctx, CommonInfo, ZeroCallUsedRegs); if (!A->isAttributeSpellingListCalculated() && !A->getAttrName()) A->setAttributeSpellingListIndex(0); return A; } ZeroCallUsedRegsAttr *ZeroCallUsedRegsAttr::CreateImplicit(ASTContext &Ctx, ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind ZeroCallUsedRegs, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_zero_call_used_regs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_zero_call_used_regs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_zero_call_used_regs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_zero_call_used_regs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_zero_call_used_regs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_zero_call_used_regs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return CreateImplicit(Ctx, ZeroCallUsedRegs, I); } ZeroCallUsedRegsAttr *ZeroCallUsedRegsAttr::Create(ASTContext &Ctx, ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind ZeroCallUsedRegs, SourceRange Range, Spelling S) { AttributeCommonInfo I(Range, NoSemaHandlerAttribute, [&]() { switch (S) { case GNU_zero_call_used_regs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, GNU_zero_call_used_regs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case CXX11_gnu_zero_call_used_regs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_CXX11, CXX11_gnu_zero_call_used_regs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; case C23_gnu_zero_call_used_regs: return AttributeCommonInfo::Form{AttributeCommonInfo::AS_C23, C23_gnu_zero_call_used_regs, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; default: llvm_unreachable("Unknown attribute spelling!"); return AttributeCommonInfo::Form{AttributeCommonInfo::AS_GNU, 0, false /*IsAlignas*/, false /*IsRegularKeywordAttribute*/}; } }()); return Create(Ctx, ZeroCallUsedRegs, I); } ZeroCallUsedRegsAttr::ZeroCallUsedRegsAttr(ASTContext &Ctx, const AttributeCommonInfo &CommonInfo , ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind ZeroCallUsedRegs ) : InheritableAttr(Ctx, CommonInfo, attr::ZeroCallUsedRegs, /*IsLateParsed=*/false, false) , zeroCallUsedRegs(ZeroCallUsedRegs) { } bool ZeroCallUsedRegsAttr::ConvertStrToZeroCallUsedRegsKind(StringRef Val, ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind &Out) { std::optional R = llvm::StringSwitch>(Val) .Case("skip", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::Skip) .Case("used-gpr-arg", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::UsedGPRArg) .Case("used-gpr", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::UsedGPR) .Case("used-arg", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::UsedArg) .Case("used", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::Used) .Case("all-gpr-arg", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::AllGPRArg) .Case("all-gpr", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::AllGPR) .Case("all-arg", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::AllArg) .Case("all", ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::All) .Default(std::optional()); if (R) { Out = *R; return true; } return false; } const char *ZeroCallUsedRegsAttr::ConvertZeroCallUsedRegsKindToStr(ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind Val) { switch(Val) { case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::Skip: return "skip"; case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::UsedGPRArg: return "used-gpr-arg"; case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::UsedGPR: return "used-gpr"; case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::UsedArg: return "used-arg"; case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::Used: return "used"; case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::AllGPRArg: return "all-gpr-arg"; case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::AllGPR: return "all-gpr"; case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::AllArg: return "all-arg"; case ZeroCallUsedRegsAttr::ZeroCallUsedRegsKind::All: return "all"; } llvm_unreachable("No enumerator with that value"); } ZeroCallUsedRegsAttr *ZeroCallUsedRegsAttr::clone(ASTContext &C) const { auto *A = new (C) ZeroCallUsedRegsAttr(C, *this, zeroCallUsedRegs); A->Inherited = Inherited; A->IsPackExpansion = IsPackExpansion; A->setImplicit(Implicit); return A; } void ZeroCallUsedRegsAttr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { bool IsFirstArgument = true; (void)IsFirstArgument; unsigned TrailingOmittedArgs = 0; (void)TrailingOmittedArgs; switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); break; case 0 : { OS << "__attribute__((zero_call_used_regs"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << ZeroCallUsedRegsAttr::ConvertZeroCallUsedRegsKindToStr(getZeroCallUsedRegs()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "))"; break; } case 1 : { OS << "[[gnu::zero_call_used_regs"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << ZeroCallUsedRegsAttr::ConvertZeroCallUsedRegsKindToStr(getZeroCallUsedRegs()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } case 2 : { OS << "[[gnu::zero_call_used_regs"; DelimitAttributeArgument(OS, IsFirstArgument); OS << "\"" << ZeroCallUsedRegsAttr::ConvertZeroCallUsedRegsKindToStr(getZeroCallUsedRegs()) << "\""; if (!IsFirstArgument) OS << ")"; OS << "]]"; break; } } } const char *ZeroCallUsedRegsAttr::getSpelling() const { switch (getAttributeSpellingListIndex()) { default: llvm_unreachable("Unknown attribute spelling!"); return "(No spelling)"; case 0: return "zero_call_used_regs"; case 1: return "zero_call_used_regs"; case 2: return "zero_call_used_regs"; } } const char *Attr::getSpelling() const { switch (getKind()) { case attr::AArch64SVEPcs: return cast(this)->getSpelling(); case attr::AArch64VectorPcs: return cast(this)->getSpelling(); case attr::AMDGPUFlatWorkGroupSize: return cast(this)->getSpelling(); case attr::AMDGPUKernelCall: return cast(this)->getSpelling(); case attr::AMDGPUMaxNumWorkGroups: return cast(this)->getSpelling(); case attr::AMDGPUNumSGPR: return cast(this)->getSpelling(); case attr::AMDGPUNumVGPR: return cast(this)->getSpelling(); case attr::AMDGPUWavesPerEU: return cast(this)->getSpelling(); case attr::ARMInterrupt: return cast(this)->getSpelling(); case attr::AVRInterrupt: return cast(this)->getSpelling(); case attr::AVRSignal: return cast(this)->getSpelling(); case attr::AbiTag: return cast(this)->getSpelling(); case attr::AcquireCapability: return cast(this)->getSpelling(); case attr::AcquireHandle: return cast(this)->getSpelling(); case attr::AcquiredAfter: return cast(this)->getSpelling(); case attr::AcquiredBefore: return cast(this)->getSpelling(); case attr::AddressSpace: return cast(this)->getSpelling(); case attr::Alias: return cast(this)->getSpelling(); case attr::AlignMac68k: return cast(this)->getSpelling(); case attr::AlignNatural: return cast(this)->getSpelling(); case attr::AlignValue: return cast(this)->getSpelling(); case attr::Aligned: return cast(this)->getSpelling(); case attr::AllocAlign: return cast(this)->getSpelling(); case attr::AllocSize: return cast(this)->getSpelling(); case attr::Allocating: return cast(this)->getSpelling(); case attr::AlwaysDestroy: return cast(this)->getSpelling(); case attr::AlwaysInline: return cast(this)->getSpelling(); case attr::AnalyzerNoReturn: return cast(this)->getSpelling(); case attr::Annotate: return cast(this)->getSpelling(); case attr::AnnotateType: return cast(this)->getSpelling(); case attr::AnyX86Interrupt: return cast(this)->getSpelling(); case attr::AnyX86NoCallerSavedRegisters: return cast(this)->getSpelling(); case attr::AnyX86NoCfCheck: return cast(this)->getSpelling(); case attr::ArcWeakrefUnavailable: return cast(this)->getSpelling(); case attr::ArgumentWithTypeTag: return cast(this)->getSpelling(); case attr::ArmBuiltinAlias: return cast(this)->getSpelling(); case attr::ArmIn: return cast(this)->getSpelling(); case attr::ArmInOut: return cast(this)->getSpelling(); case attr::ArmLocallyStreaming: return cast(this)->getSpelling(); case attr::ArmMveStrictPolymorphism: return cast(this)->getSpelling(); case attr::ArmNew: return cast(this)->getSpelling(); case attr::ArmOut: return cast(this)->getSpelling(); case attr::ArmPreserves: return cast(this)->getSpelling(); case attr::ArmStreaming: return cast(this)->getSpelling(); case attr::ArmStreamingCompatible: return cast(this)->getSpelling(); case attr::Artificial: return cast(this)->getSpelling(); case attr::AsmLabel: return cast(this)->getSpelling(); case attr::AssertCapability: return cast(this)->getSpelling(); case attr::AssertExclusiveLock: return cast(this)->getSpelling(); case attr::AssertSharedLock: return cast(this)->getSpelling(); case attr::AssumeAligned: return cast(this)->getSpelling(); case attr::Availability: return cast(this)->getSpelling(); case attr::AvailableOnlyInDefaultEvalMethod: return cast(this)->getSpelling(); case attr::BPFFastCall: return cast(this)->getSpelling(); case attr::BPFPreserveAccessIndex: return cast(this)->getSpelling(); case attr::BPFPreserveStaticOffset: return cast(this)->getSpelling(); case attr::BTFDeclTag: return cast(this)->getSpelling(); case attr::BTFTypeTag: return cast(this)->getSpelling(); case attr::Blocking: return cast(this)->getSpelling(); case attr::Blocks: return cast(this)->getSpelling(); case attr::Builtin: return cast(this)->getSpelling(); case attr::BuiltinAlias: return cast(this)->getSpelling(); case attr::C11NoReturn: return cast(this)->getSpelling(); case attr::CDecl: return cast(this)->getSpelling(); case attr::CFAuditedTransfer: return cast(this)->getSpelling(); case attr::CFConsumed: return cast(this)->getSpelling(); case attr::CFGuard: return cast(this)->getSpelling(); case attr::CFICanonicalJumpTable: return cast(this)->getSpelling(); case attr::CFReturnsNotRetained: return cast(this)->getSpelling(); case attr::CFReturnsRetained: return cast(this)->getSpelling(); case attr::CFUnknownTransfer: return cast(this)->getSpelling(); case attr::CPUDispatch: return cast(this)->getSpelling(); case attr::CPUSpecific: return cast(this)->getSpelling(); case attr::CUDAConstant: return cast(this)->getSpelling(); case attr::CUDADevice: return cast(this)->getSpelling(); case attr::CUDADeviceBuiltinSurfaceType: return cast(this)->getSpelling(); case attr::CUDADeviceBuiltinTextureType: return cast(this)->getSpelling(); case attr::CUDAGlobal: return cast(this)->getSpelling(); case attr::CUDAHost: return cast(this)->getSpelling(); case attr::CUDAInvalidTarget: return cast(this)->getSpelling(); case attr::CUDALaunchBounds: return cast(this)->getSpelling(); case attr::CUDAShared: return cast(this)->getSpelling(); case attr::CXX11NoReturn: return cast(this)->getSpelling(); case attr::CXXAssume: return cast(this)->getSpelling(); case attr::CallableWhen: return cast(this)->getSpelling(); case attr::Callback: return cast(this)->getSpelling(); case attr::CalledOnce: return cast(this)->getSpelling(); case attr::Capability: return cast(this)->getSpelling(); case attr::CapturedRecord: return cast(this)->getSpelling(); case attr::CarriesDependency: return cast(this)->getSpelling(); case attr::Cleanup: return cast(this)->getSpelling(); case attr::ClspvLibclcBuiltin: return cast(this)->getSpelling(); case attr::CmseNSCall: return cast(this)->getSpelling(); case attr::CmseNSEntry: return cast(this)->getSpelling(); case attr::CodeAlign: return cast(this)->getSpelling(); case attr::CodeModel: return cast(this)->getSpelling(); case attr::CodeSeg: return cast(this)->getSpelling(); case attr::Cold: return cast(this)->getSpelling(); case attr::Common: return cast(this)->getSpelling(); case attr::Const: return cast(this)->getSpelling(); case attr::ConstInit: return cast(this)->getSpelling(); case attr::Constructor: return cast(this)->getSpelling(); case attr::Consumable: return cast(this)->getSpelling(); case attr::ConsumableAutoCast: return cast(this)->getSpelling(); case attr::ConsumableSetOnRead: return cast(this)->getSpelling(); case attr::Convergent: return cast(this)->getSpelling(); case attr::CoroDisableLifetimeBound: return cast(this)->getSpelling(); case attr::CoroLifetimeBound: return cast(this)->getSpelling(); case attr::CoroOnlyDestroyWhenComplete: return cast(this)->getSpelling(); case attr::CoroReturnType: return cast(this)->getSpelling(); case attr::CoroWrapper: return cast(this)->getSpelling(); case attr::CountedBy: return cast(this)->getSpelling(); case attr::CountedByOrNull: return cast(this)->getSpelling(); case attr::DLLExport: return cast(this)->getSpelling(); case attr::DLLExportStaticLocal: return cast(this)->getSpelling(); case attr::DLLImport: return cast(this)->getSpelling(); case attr::DLLImportStaticLocal: return cast(this)->getSpelling(); case attr::Deprecated: return cast(this)->getSpelling(); case attr::Destructor: return cast(this)->getSpelling(); case attr::DiagnoseAsBuiltin: return cast(this)->getSpelling(); case attr::DiagnoseIf: return cast(this)->getSpelling(); case attr::DisableSanitizerInstrumentation: return cast(this)->getSpelling(); case attr::DisableTailCalls: return cast(this)->getSpelling(); case attr::EmptyBases: return cast(this)->getSpelling(); case attr::EnableIf: return cast(this)->getSpelling(); case attr::EnforceTCB: return cast(this)->getSpelling(); case attr::EnforceTCBLeaf: return cast(this)->getSpelling(); case attr::EnumExtensibility: return cast(this)->getSpelling(); case attr::Error: return cast(this)->getSpelling(); case attr::ExcludeFromExplicitInstantiation: return cast(this)->getSpelling(); case attr::ExclusiveTrylockFunction: return cast(this)->getSpelling(); case attr::ExternalSourceSymbol: return cast(this)->getSpelling(); case attr::FallThrough: return cast(this)->getSpelling(); case attr::FastCall: return cast(this)->getSpelling(); case attr::Final: return cast(this)->getSpelling(); case attr::FlagEnum: return cast(this)->getSpelling(); case attr::Flatten: return cast(this)->getSpelling(); case attr::Format: return cast(this)->getSpelling(); case attr::FormatArg: return cast(this)->getSpelling(); case attr::FunctionReturnThunks: return cast(this)->getSpelling(); case attr::GNUInline: return cast(this)->getSpelling(); case attr::GuardedBy: return cast(this)->getSpelling(); case attr::GuardedVar: return cast(this)->getSpelling(); case attr::HIPManaged: return cast(this)->getSpelling(); case attr::HLSLGroupSharedAddressSpace: return cast(this)->getSpelling(); case attr::HLSLLoopHint: return cast(this)->getSpelling(); case attr::HLSLNumThreads: return cast(this)->getSpelling(); case attr::HLSLPackOffset: return cast(this)->getSpelling(); case attr::HLSLParamModifier: return cast(this)->getSpelling(); case attr::HLSLROV: return cast(this)->getSpelling(); case attr::HLSLResource: return cast(this)->getSpelling(); case attr::HLSLResourceBinding: return cast(this)->getSpelling(); case attr::HLSLResourceClass: return cast(this)->getSpelling(); case attr::HLSLSV_DispatchThreadID: return cast(this)->getSpelling(); case attr::HLSLSV_GroupIndex: return cast(this)->getSpelling(); case attr::HLSLShader: return cast(this)->getSpelling(); case attr::Hot: return cast(this)->getSpelling(); case attr::HybridPatchable: return cast(this)->getSpelling(); case attr::IBAction: return cast(this)->getSpelling(); case attr::IBOutlet: return cast(this)->getSpelling(); case attr::IBOutletCollection: return cast(this)->getSpelling(); case attr::IFunc: return cast(this)->getSpelling(); case attr::InitPriority: return cast(this)->getSpelling(); case attr::InitSeg: return cast(this)->getSpelling(); case attr::IntelOclBicc: return cast(this)->getSpelling(); case attr::InternalLinkage: return cast(this)->getSpelling(); case attr::LTOVisibilityPublic: return cast(this)->getSpelling(); case attr::LayoutVersion: return cast(this)->getSpelling(); case attr::Leaf: return cast(this)->getSpelling(); case attr::LifetimeBound: return cast(this)->getSpelling(); case attr::Likely: return cast(this)->getSpelling(); case attr::LoaderUninitialized: return cast(this)->getSpelling(); case attr::LockReturned: return cast(this)->getSpelling(); case attr::LocksExcluded: return cast(this)->getSpelling(); case attr::LoopHint: return cast(this)->getSpelling(); case attr::M68kInterrupt: return cast(this)->getSpelling(); case attr::M68kRTD: return cast(this)->getSpelling(); case attr::MIGServerRoutine: return cast(this)->getSpelling(); case attr::MSABI: return cast(this)->getSpelling(); case attr::MSAllocator: return cast(this)->getSpelling(); case attr::MSConstexpr: return cast(this)->getSpelling(); case attr::MSInheritance: return cast(this)->getSpelling(); case attr::MSNoVTable: return cast(this)->getSpelling(); case attr::MSP430Interrupt: return cast(this)->getSpelling(); case attr::MSStruct: return cast(this)->getSpelling(); case attr::MSVtorDisp: return cast(this)->getSpelling(); case attr::MaxFieldAlignment: return cast(this)->getSpelling(); case attr::MayAlias: return cast(this)->getSpelling(); case attr::MaybeUndef: return cast(this)->getSpelling(); case attr::MicroMips: return cast(this)->getSpelling(); case attr::MinSize: return cast(this)->getSpelling(); case attr::MinVectorWidth: return cast(this)->getSpelling(); case attr::Mips16: return cast(this)->getSpelling(); case attr::MipsInterrupt: return cast(this)->getSpelling(); case attr::MipsLongCall: return cast(this)->getSpelling(); case attr::MipsShortCall: return cast(this)->getSpelling(); case attr::Mode: return cast(this)->getSpelling(); case attr::MustTail: return cast(this)->getSpelling(); case attr::NSConsumed: return cast(this)->getSpelling(); case attr::NSConsumesSelf: return cast(this)->getSpelling(); case attr::NSErrorDomain: return cast(this)->getSpelling(); case attr::NSReturnsAutoreleased: return cast(this)->getSpelling(); case attr::NSReturnsNotRetained: return cast(this)->getSpelling(); case attr::NSReturnsRetained: return cast(this)->getSpelling(); case attr::NVPTXKernel: return cast(this)->getSpelling(); case attr::Naked: return cast(this)->getSpelling(); case attr::NoAlias: return cast(this)->getSpelling(); case attr::NoBuiltin: return cast(this)->getSpelling(); case attr::NoCommon: return cast(this)->getSpelling(); case attr::NoConvergent: return cast(this)->getSpelling(); case attr::NoDebug: return cast(this)->getSpelling(); case attr::NoDeref: return cast(this)->getSpelling(); case attr::NoDestroy: return cast(this)->getSpelling(); case attr::NoDuplicate: return cast(this)->getSpelling(); case attr::NoEscape: return cast(this)->getSpelling(); case attr::NoInline: return cast(this)->getSpelling(); case attr::NoInstrumentFunction: return cast(this)->getSpelling(); case attr::NoMerge: return cast(this)->getSpelling(); case attr::NoMicroMips: return cast(this)->getSpelling(); case attr::NoMips16: return cast(this)->getSpelling(); case attr::NoProfileFunction: return cast(this)->getSpelling(); case attr::NoRandomizeLayout: return cast(this)->getSpelling(); case attr::NoReturn: return cast(this)->getSpelling(); case attr::NoSanitize: return cast(this)->getSpelling(); case attr::NoSpeculativeLoadHardening: return cast(this)->getSpelling(); case attr::NoSplitStack: return cast(this)->getSpelling(); case attr::NoStackProtector: return cast(this)->getSpelling(); case attr::NoThreadSafetyAnalysis: return cast(this)->getSpelling(); case attr::NoThrow: return cast(this)->getSpelling(); case attr::NoUniqueAddress: return cast(this)->getSpelling(); case attr::NoUwtable: return cast(this)->getSpelling(); case attr::NonAllocating: return cast(this)->getSpelling(); case attr::NonBlocking: return cast(this)->getSpelling(); case attr::NonNull: return cast(this)->getSpelling(); case attr::NotTailCalled: return cast(this)->getSpelling(); case attr::OMPAllocateDecl: return cast(this)->getSpelling(); case attr::OMPAssume: return cast(this)->getSpelling(); case attr::OMPCaptureKind: return cast(this)->getSpelling(); case attr::OMPCaptureNoInit: return cast(this)->getSpelling(); case attr::OMPDeclareSimdDecl: return cast(this)->getSpelling(); case attr::OMPDeclareTargetDecl: return cast(this)->getSpelling(); case attr::OMPDeclareVariant: return cast(this)->getSpelling(); case attr::OMPReferencedVar: return cast(this)->getSpelling(); case attr::OMPThreadPrivateDecl: return cast(this)->getSpelling(); case attr::OSConsumed: return cast(this)->getSpelling(); case attr::OSConsumesThis: return cast(this)->getSpelling(); case attr::OSReturnsNotRetained: return cast(this)->getSpelling(); case attr::OSReturnsRetained: return cast(this)->getSpelling(); case attr::OSReturnsRetainedOnNonZero: return cast(this)->getSpelling(); case attr::OSReturnsRetainedOnZero: return cast(this)->getSpelling(); case attr::ObjCBoxable: return cast(this)->getSpelling(); case attr::ObjCBridge: return cast(this)->getSpelling(); case attr::ObjCBridgeMutable: return cast(this)->getSpelling(); case attr::ObjCBridgeRelated: return cast(this)->getSpelling(); case attr::ObjCClassStub: return cast(this)->getSpelling(); case attr::ObjCDesignatedInitializer: return cast(this)->getSpelling(); case attr::ObjCDirect: return cast(this)->getSpelling(); case attr::ObjCDirectMembers: return cast(this)->getSpelling(); case attr::ObjCException: return cast(this)->getSpelling(); case attr::ObjCExplicitProtocolImpl: return cast(this)->getSpelling(); case attr::ObjCExternallyRetained: return cast(this)->getSpelling(); case attr::ObjCGC: return cast(this)->getSpelling(); case attr::ObjCIndependentClass: return cast(this)->getSpelling(); case attr::ObjCInertUnsafeUnretained: return cast(this)->getSpelling(); case attr::ObjCKindOf: return cast(this)->getSpelling(); case attr::ObjCMethodFamily: return cast(this)->getSpelling(); case attr::ObjCNSObject: return cast(this)->getSpelling(); case attr::ObjCNonLazyClass: return cast(this)->getSpelling(); case attr::ObjCNonRuntimeProtocol: return cast(this)->getSpelling(); case attr::ObjCOwnership: return cast(this)->getSpelling(); case attr::ObjCPreciseLifetime: return cast(this)->getSpelling(); case attr::ObjCRequiresPropertyDefs: return cast(this)->getSpelling(); case attr::ObjCRequiresSuper: return cast(this)->getSpelling(); case attr::ObjCReturnsInnerPointer: return cast(this)->getSpelling(); case attr::ObjCRootClass: return cast(this)->getSpelling(); case attr::ObjCRuntimeName: return cast(this)->getSpelling(); case attr::ObjCRuntimeVisible: return cast(this)->getSpelling(); case attr::ObjCSubclassingRestricted: return cast(this)->getSpelling(); case attr::OpenCLAccess: return cast(this)->getSpelling(); case attr::OpenCLConstantAddressSpace: return cast(this)->getSpelling(); case attr::OpenCLGenericAddressSpace: return cast(this)->getSpelling(); case attr::OpenCLGlobalAddressSpace: return cast(this)->getSpelling(); case attr::OpenCLGlobalDeviceAddressSpace: return cast(this)->getSpelling(); case attr::OpenCLGlobalHostAddressSpace: return cast(this)->getSpelling(); case attr::OpenCLIntelReqdSubGroupSize: return cast(this)->getSpelling(); case attr::OpenCLKernel: return cast(this)->getSpelling(); case attr::OpenCLLocalAddressSpace: return cast(this)->getSpelling(); case attr::OpenCLPrivateAddressSpace: return cast(this)->getSpelling(); case attr::OpenCLUnrollHint: return cast(this)->getSpelling(); case attr::OptimizeNone: return cast(this)->getSpelling(); case attr::Overloadable: return cast(this)->getSpelling(); case attr::Override: return cast(this)->getSpelling(); case attr::Owner: return cast(this)->getSpelling(); case attr::Ownership: return cast(this)->getSpelling(); case attr::Packed: return cast(this)->getSpelling(); case attr::ParamTypestate: return cast(this)->getSpelling(); case attr::Pascal: return cast(this)->getSpelling(); case attr::PassObjectSize: return cast(this)->getSpelling(); case attr::PatchableFunctionEntry: return cast(this)->getSpelling(); case attr::Pcs: return cast(this)->getSpelling(); case attr::Pointer: return cast(this)->getSpelling(); case attr::PragmaClangBSSSection: return cast(this)->getSpelling(); case attr::PragmaClangDataSection: return cast(this)->getSpelling(); case attr::PragmaClangRelroSection: return cast(this)->getSpelling(); case attr::PragmaClangRodataSection: return cast(this)->getSpelling(); case attr::PragmaClangTextSection: return cast(this)->getSpelling(); case attr::PreferredName: return cast(this)->getSpelling(); case attr::PreferredType: return cast(this)->getSpelling(); case attr::PreserveAll: return cast(this)->getSpelling(); case attr::PreserveMost: return cast(this)->getSpelling(); case attr::PreserveNone: return cast(this)->getSpelling(); case attr::PtGuardedBy: return cast(this)->getSpelling(); case attr::PtGuardedVar: return cast(this)->getSpelling(); case attr::Ptr32: return cast(this)->getSpelling(); case attr::Ptr64: return cast(this)->getSpelling(); case attr::Pure: return cast(this)->getSpelling(); case attr::RISCVInterrupt: return cast(this)->getSpelling(); case attr::RISCVVectorCC: return cast(this)->getSpelling(); case attr::RandomizeLayout: return cast(this)->getSpelling(); case attr::ReadOnlyPlacement: return cast(this)->getSpelling(); case attr::RegCall: return cast(this)->getSpelling(); case attr::Reinitializes: return cast(this)->getSpelling(); case attr::ReleaseCapability: return cast(this)->getSpelling(); case attr::ReleaseHandle: return cast(this)->getSpelling(); case attr::RenderScriptKernel: return cast(this)->getSpelling(); case attr::ReqdWorkGroupSize: return cast(this)->getSpelling(); case attr::RequiresCapability: return cast(this)->getSpelling(); case attr::Restrict: return cast(this)->getSpelling(); case attr::Retain: return cast(this)->getSpelling(); case attr::ReturnTypestate: return cast(this)->getSpelling(); case attr::ReturnsNonNull: return cast(this)->getSpelling(); case attr::ReturnsTwice: return cast(this)->getSpelling(); case attr::SPtr: return cast(this)->getSpelling(); case attr::SYCLKernel: return cast(this)->getSpelling(); case attr::SYCLSpecialClass: return cast(this)->getSpelling(); case attr::ScopedLockable: return cast(this)->getSpelling(); case attr::Section: return cast(this)->getSpelling(); case attr::SelectAny: return cast(this)->getSpelling(); case attr::Sentinel: return cast(this)->getSpelling(); case attr::SetTypestate: return cast(this)->getSpelling(); case attr::SharedTrylockFunction: return cast(this)->getSpelling(); case attr::SizedBy: return cast(this)->getSpelling(); case attr::SizedByOrNull: return cast(this)->getSpelling(); case attr::SpeculativeLoadHardening: return cast(this)->getSpelling(); case attr::StandaloneDebug: return cast(this)->getSpelling(); case attr::StdCall: return cast(this)->getSpelling(); case attr::StrictFP: return cast(this)->getSpelling(); case attr::StrictGuardStackCheck: return cast(this)->getSpelling(); case attr::Suppress: return cast(this)->getSpelling(); case attr::SwiftAsync: return cast(this)->getSpelling(); case attr::SwiftAsyncCall: return cast(this)->getSpelling(); case attr::SwiftAsyncContext: return cast(this)->getSpelling(); case attr::SwiftAsyncError: return cast(this)->getSpelling(); case attr::SwiftAsyncName: return cast(this)->getSpelling(); case attr::SwiftAttr: return cast(this)->getSpelling(); case attr::SwiftBridge: return cast(this)->getSpelling(); case attr::SwiftBridgedTypedef: return cast(this)->getSpelling(); case attr::SwiftCall: return cast(this)->getSpelling(); case attr::SwiftContext: return cast(this)->getSpelling(); case attr::SwiftError: return cast(this)->getSpelling(); case attr::SwiftErrorResult: return cast(this)->getSpelling(); case attr::SwiftImportAsNonGeneric: return cast(this)->getSpelling(); case attr::SwiftImportPropertyAsAccessors: return cast(this)->getSpelling(); case attr::SwiftIndirectResult: return cast(this)->getSpelling(); case attr::SwiftName: return cast(this)->getSpelling(); case attr::SwiftNewType: return cast(this)->getSpelling(); case attr::SwiftObjCMembers: return cast(this)->getSpelling(); case attr::SwiftPrivate: return cast(this)->getSpelling(); case attr::SwiftVersionedAddition: return cast(this)->getSpelling(); case attr::SwiftVersionedRemoval: return cast(this)->getSpelling(); case attr::SysVABI: return cast(this)->getSpelling(); case attr::TLSModel: return cast(this)->getSpelling(); case attr::Target: return cast(this)->getSpelling(); case attr::TargetClones: return cast(this)->getSpelling(); case attr::TargetVersion: return cast(this)->getSpelling(); case attr::TestTypestate: return cast(this)->getSpelling(); case attr::ThisCall: return cast(this)->getSpelling(); case attr::Thread: return cast(this)->getSpelling(); case attr::TransparentUnion: return cast(this)->getSpelling(); case attr::TrivialABI: return cast(this)->getSpelling(); case attr::TryAcquireCapability: return cast(this)->getSpelling(); case attr::TypeNonNull: return cast(this)->getSpelling(); case attr::TypeNullUnspecified: return cast(this)->getSpelling(); case attr::TypeNullable: return cast(this)->getSpelling(); case attr::TypeNullableResult: return cast(this)->getSpelling(); case attr::TypeTagForDatatype: return cast(this)->getSpelling(); case attr::TypeVisibility: return cast(this)->getSpelling(); case attr::UPtr: return cast(this)->getSpelling(); case attr::Unavailable: return cast(this)->getSpelling(); case attr::Uninitialized: return cast(this)->getSpelling(); case attr::Unlikely: return cast(this)->getSpelling(); case attr::UnsafeBufferUsage: return cast(this)->getSpelling(); case attr::Unused: return cast(this)->getSpelling(); case attr::UseHandle: return cast(this)->getSpelling(); case attr::Used: return cast(this)->getSpelling(); case attr::UsingIfExists: return cast(this)->getSpelling(); case attr::Uuid: return cast(this)->getSpelling(); case attr::VTablePointerAuthentication: return cast(this)->getSpelling(); case attr::VecReturn: return cast(this)->getSpelling(); case attr::VecTypeHint: return cast(this)->getSpelling(); case attr::VectorCall: return cast(this)->getSpelling(); case attr::Visibility: return cast(this)->getSpelling(); case attr::WarnUnused: return cast(this)->getSpelling(); case attr::WarnUnusedResult: return cast(this)->getSpelling(); case attr::Weak: return cast(this)->getSpelling(); case attr::WeakImport: return cast(this)->getSpelling(); case attr::WeakRef: return cast(this)->getSpelling(); case attr::WebAssemblyExportName: return cast(this)->getSpelling(); case attr::WebAssemblyFuncref: return cast(this)->getSpelling(); case attr::WebAssemblyImportModule: return cast(this)->getSpelling(); case attr::WebAssemblyImportName: return cast(this)->getSpelling(); case attr::WorkGroupSizeHint: return cast(this)->getSpelling(); case attr::X86ForceAlignArgPointer: return cast(this)->getSpelling(); case attr::XRayInstrument: return cast(this)->getSpelling(); case attr::XRayLogArgs: return cast(this)->getSpelling(); case attr::ZeroCallUsedRegs: return cast(this)->getSpelling(); } llvm_unreachable("Unexpected attribute kind!"); } Attr *Attr::clone(ASTContext &C) const { switch (getKind()) { case attr::AArch64SVEPcs: return cast(this)->clone(C); case attr::AArch64VectorPcs: return cast(this)->clone(C); case attr::AMDGPUFlatWorkGroupSize: return cast(this)->clone(C); case attr::AMDGPUKernelCall: return cast(this)->clone(C); case attr::AMDGPUMaxNumWorkGroups: return cast(this)->clone(C); case attr::AMDGPUNumSGPR: return cast(this)->clone(C); case attr::AMDGPUNumVGPR: return cast(this)->clone(C); case attr::AMDGPUWavesPerEU: return cast(this)->clone(C); case attr::ARMInterrupt: return cast(this)->clone(C); case attr::AVRInterrupt: return cast(this)->clone(C); case attr::AVRSignal: return cast(this)->clone(C); case attr::AbiTag: return cast(this)->clone(C); case attr::AcquireCapability: return cast(this)->clone(C); case attr::AcquireHandle: return cast(this)->clone(C); case attr::AcquiredAfter: return cast(this)->clone(C); case attr::AcquiredBefore: return cast(this)->clone(C); case attr::AddressSpace: return cast(this)->clone(C); case attr::Alias: return cast(this)->clone(C); case attr::AlignMac68k: return cast(this)->clone(C); case attr::AlignNatural: return cast(this)->clone(C); case attr::AlignValue: return cast(this)->clone(C); case attr::Aligned: return cast(this)->clone(C); case attr::AllocAlign: return cast(this)->clone(C); case attr::AllocSize: return cast(this)->clone(C); case attr::Allocating: return cast(this)->clone(C); case attr::AlwaysDestroy: return cast(this)->clone(C); case attr::AlwaysInline: return cast(this)->clone(C); case attr::AnalyzerNoReturn: return cast(this)->clone(C); case attr::Annotate: return cast(this)->clone(C); case attr::AnnotateType: return cast(this)->clone(C); case attr::AnyX86Interrupt: return cast(this)->clone(C); case attr::AnyX86NoCallerSavedRegisters: return cast(this)->clone(C); case attr::AnyX86NoCfCheck: return cast(this)->clone(C); case attr::ArcWeakrefUnavailable: return cast(this)->clone(C); case attr::ArgumentWithTypeTag: return cast(this)->clone(C); case attr::ArmBuiltinAlias: return cast(this)->clone(C); case attr::ArmIn: return cast(this)->clone(C); case attr::ArmInOut: return cast(this)->clone(C); case attr::ArmLocallyStreaming: return cast(this)->clone(C); case attr::ArmMveStrictPolymorphism: return cast(this)->clone(C); case attr::ArmNew: return cast(this)->clone(C); case attr::ArmOut: return cast(this)->clone(C); case attr::ArmPreserves: return cast(this)->clone(C); case attr::ArmStreaming: return cast(this)->clone(C); case attr::ArmStreamingCompatible: return cast(this)->clone(C); case attr::Artificial: return cast(this)->clone(C); case attr::AsmLabel: return cast(this)->clone(C); case attr::AssertCapability: return cast(this)->clone(C); case attr::AssertExclusiveLock: return cast(this)->clone(C); case attr::AssertSharedLock: return cast(this)->clone(C); case attr::AssumeAligned: return cast(this)->clone(C); case attr::Availability: return cast(this)->clone(C); case attr::AvailableOnlyInDefaultEvalMethod: return cast(this)->clone(C); case attr::BPFFastCall: return cast(this)->clone(C); case attr::BPFPreserveAccessIndex: return cast(this)->clone(C); case attr::BPFPreserveStaticOffset: return cast(this)->clone(C); case attr::BTFDeclTag: return cast(this)->clone(C); case attr::BTFTypeTag: return cast(this)->clone(C); case attr::Blocking: return cast(this)->clone(C); case attr::Blocks: return cast(this)->clone(C); case attr::Builtin: return cast(this)->clone(C); case attr::BuiltinAlias: return cast(this)->clone(C); case attr::C11NoReturn: return cast(this)->clone(C); case attr::CDecl: return cast(this)->clone(C); case attr::CFAuditedTransfer: return cast(this)->clone(C); case attr::CFConsumed: return cast(this)->clone(C); case attr::CFGuard: return cast(this)->clone(C); case attr::CFICanonicalJumpTable: return cast(this)->clone(C); case attr::CFReturnsNotRetained: return cast(this)->clone(C); case attr::CFReturnsRetained: return cast(this)->clone(C); case attr::CFUnknownTransfer: return cast(this)->clone(C); case attr::CPUDispatch: return cast(this)->clone(C); case attr::CPUSpecific: return cast(this)->clone(C); case attr::CUDAConstant: return cast(this)->clone(C); case attr::CUDADevice: return cast(this)->clone(C); case attr::CUDADeviceBuiltinSurfaceType: return cast(this)->clone(C); case attr::CUDADeviceBuiltinTextureType: return cast(this)->clone(C); case attr::CUDAGlobal: return cast(this)->clone(C); case attr::CUDAHost: return cast(this)->clone(C); case attr::CUDAInvalidTarget: return cast(this)->clone(C); case attr::CUDALaunchBounds: return cast(this)->clone(C); case attr::CUDAShared: return cast(this)->clone(C); case attr::CXX11NoReturn: return cast(this)->clone(C); case attr::CXXAssume: return cast(this)->clone(C); case attr::CallableWhen: return cast(this)->clone(C); case attr::Callback: return cast(this)->clone(C); case attr::CalledOnce: return cast(this)->clone(C); case attr::Capability: return cast(this)->clone(C); case attr::CapturedRecord: return cast(this)->clone(C); case attr::CarriesDependency: return cast(this)->clone(C); case attr::Cleanup: return cast(this)->clone(C); case attr::ClspvLibclcBuiltin: return cast(this)->clone(C); case attr::CmseNSCall: return cast(this)->clone(C); case attr::CmseNSEntry: return cast(this)->clone(C); case attr::CodeAlign: return cast(this)->clone(C); case attr::CodeModel: return cast(this)->clone(C); case attr::CodeSeg: return cast(this)->clone(C); case attr::Cold: return cast(this)->clone(C); case attr::Common: return cast(this)->clone(C); case attr::Const: return cast(this)->clone(C); case attr::ConstInit: return cast(this)->clone(C); case attr::Constructor: return cast(this)->clone(C); case attr::Consumable: return cast(this)->clone(C); case attr::ConsumableAutoCast: return cast(this)->clone(C); case attr::ConsumableSetOnRead: return cast(this)->clone(C); case attr::Convergent: return cast(this)->clone(C); case attr::CoroDisableLifetimeBound: return cast(this)->clone(C); case attr::CoroLifetimeBound: return cast(this)->clone(C); case attr::CoroOnlyDestroyWhenComplete: return cast(this)->clone(C); case attr::CoroReturnType: return cast(this)->clone(C); case attr::CoroWrapper: return cast(this)->clone(C); case attr::CountedBy: return cast(this)->clone(C); case attr::CountedByOrNull: return cast(this)->clone(C); case attr::DLLExport: return cast(this)->clone(C); case attr::DLLExportStaticLocal: return cast(this)->clone(C); case attr::DLLImport: return cast(this)->clone(C); case attr::DLLImportStaticLocal: return cast(this)->clone(C); case attr::Deprecated: return cast(this)->clone(C); case attr::Destructor: return cast(this)->clone(C); case attr::DiagnoseAsBuiltin: return cast(this)->clone(C); case attr::DiagnoseIf: return cast(this)->clone(C); case attr::DisableSanitizerInstrumentation: return cast(this)->clone(C); case attr::DisableTailCalls: return cast(this)->clone(C); case attr::EmptyBases: return cast(this)->clone(C); case attr::EnableIf: return cast(this)->clone(C); case attr::EnforceTCB: return cast(this)->clone(C); case attr::EnforceTCBLeaf: return cast(this)->clone(C); case attr::EnumExtensibility: return cast(this)->clone(C); case attr::Error: return cast(this)->clone(C); case attr::ExcludeFromExplicitInstantiation: return cast(this)->clone(C); case attr::ExclusiveTrylockFunction: return cast(this)->clone(C); case attr::ExternalSourceSymbol: return cast(this)->clone(C); case attr::FallThrough: return cast(this)->clone(C); case attr::FastCall: return cast(this)->clone(C); case attr::Final: return cast(this)->clone(C); case attr::FlagEnum: return cast(this)->clone(C); case attr::Flatten: return cast(this)->clone(C); case attr::Format: return cast(this)->clone(C); case attr::FormatArg: return cast(this)->clone(C); case attr::FunctionReturnThunks: return cast(this)->clone(C); case attr::GNUInline: return cast(this)->clone(C); case attr::GuardedBy: return cast(this)->clone(C); case attr::GuardedVar: return cast(this)->clone(C); case attr::HIPManaged: return cast(this)->clone(C); case attr::HLSLGroupSharedAddressSpace: return cast(this)->clone(C); case attr::HLSLLoopHint: return cast(this)->clone(C); case attr::HLSLNumThreads: return cast(this)->clone(C); case attr::HLSLPackOffset: return cast(this)->clone(C); case attr::HLSLParamModifier: return cast(this)->clone(C); case attr::HLSLROV: return cast(this)->clone(C); case attr::HLSLResource: return cast(this)->clone(C); case attr::HLSLResourceBinding: return cast(this)->clone(C); case attr::HLSLResourceClass: return cast(this)->clone(C); case attr::HLSLSV_DispatchThreadID: return cast(this)->clone(C); case attr::HLSLSV_GroupIndex: return cast(this)->clone(C); case attr::HLSLShader: return cast(this)->clone(C); case attr::Hot: return cast(this)->clone(C); case attr::HybridPatchable: return cast(this)->clone(C); case attr::IBAction: return cast(this)->clone(C); case attr::IBOutlet: return cast(this)->clone(C); case attr::IBOutletCollection: return cast(this)->clone(C); case attr::IFunc: return cast(this)->clone(C); case attr::InitPriority: return cast(this)->clone(C); case attr::InitSeg: return cast(this)->clone(C); case attr::IntelOclBicc: return cast(this)->clone(C); case attr::InternalLinkage: return cast(this)->clone(C); case attr::LTOVisibilityPublic: return cast(this)->clone(C); case attr::LayoutVersion: return cast(this)->clone(C); case attr::Leaf: return cast(this)->clone(C); case attr::LifetimeBound: return cast(this)->clone(C); case attr::Likely: return cast(this)->clone(C); case attr::LoaderUninitialized: return cast(this)->clone(C); case attr::LockReturned: return cast(this)->clone(C); case attr::LocksExcluded: return cast(this)->clone(C); case attr::LoopHint: return cast(this)->clone(C); case attr::M68kInterrupt: return cast(this)->clone(C); case attr::M68kRTD: return cast(this)->clone(C); case attr::MIGServerRoutine: return cast(this)->clone(C); case attr::MSABI: return cast(this)->clone(C); case attr::MSAllocator: return cast(this)->clone(C); case attr::MSConstexpr: return cast(this)->clone(C); case attr::MSInheritance: return cast(this)->clone(C); case attr::MSNoVTable: return cast(this)->clone(C); case attr::MSP430Interrupt: return cast(this)->clone(C); case attr::MSStruct: return cast(this)->clone(C); case attr::MSVtorDisp: return cast(this)->clone(C); case attr::MaxFieldAlignment: return cast(this)->clone(C); case attr::MayAlias: return cast(this)->clone(C); case attr::MaybeUndef: return cast(this)->clone(C); case attr::MicroMips: return cast(this)->clone(C); case attr::MinSize: return cast(this)->clone(C); case attr::MinVectorWidth: return cast(this)->clone(C); case attr::Mips16: return cast(this)->clone(C); case attr::MipsInterrupt: return cast(this)->clone(C); case attr::MipsLongCall: return cast(this)->clone(C); case attr::MipsShortCall: return cast(this)->clone(C); case attr::Mode: return cast(this)->clone(C); case attr::MustTail: return cast(this)->clone(C); case attr::NSConsumed: return cast(this)->clone(C); case attr::NSConsumesSelf: return cast(this)->clone(C); case attr::NSErrorDomain: return cast(this)->clone(C); case attr::NSReturnsAutoreleased: return cast(this)->clone(C); case attr::NSReturnsNotRetained: return cast(this)->clone(C); case attr::NSReturnsRetained: return cast(this)->clone(C); case attr::NVPTXKernel: return cast(this)->clone(C); case attr::Naked: return cast(this)->clone(C); case attr::NoAlias: return cast(this)->clone(C); case attr::NoBuiltin: return cast(this)->clone(C); case attr::NoCommon: return cast(this)->clone(C); case attr::NoConvergent: return cast(this)->clone(C); case attr::NoDebug: return cast(this)->clone(C); case attr::NoDeref: return cast(this)->clone(C); case attr::NoDestroy: return cast(this)->clone(C); case attr::NoDuplicate: return cast(this)->clone(C); case attr::NoEscape: return cast(this)->clone(C); case attr::NoInline: return cast(this)->clone(C); case attr::NoInstrumentFunction: return cast(this)->clone(C); case attr::NoMerge: return cast(this)->clone(C); case attr::NoMicroMips: return cast(this)->clone(C); case attr::NoMips16: return cast(this)->clone(C); case attr::NoProfileFunction: return cast(this)->clone(C); case attr::NoRandomizeLayout: return cast(this)->clone(C); case attr::NoReturn: return cast(this)->clone(C); case attr::NoSanitize: return cast(this)->clone(C); case attr::NoSpeculativeLoadHardening: return cast(this)->clone(C); case attr::NoSplitStack: return cast(this)->clone(C); case attr::NoStackProtector: return cast(this)->clone(C); case attr::NoThreadSafetyAnalysis: return cast(this)->clone(C); case attr::NoThrow: return cast(this)->clone(C); case attr::NoUniqueAddress: return cast(this)->clone(C); case attr::NoUwtable: return cast(this)->clone(C); case attr::NonAllocating: return cast(this)->clone(C); case attr::NonBlocking: return cast(this)->clone(C); case attr::NonNull: return cast(this)->clone(C); case attr::NotTailCalled: return cast(this)->clone(C); case attr::OMPAllocateDecl: return cast(this)->clone(C); case attr::OMPAssume: return cast(this)->clone(C); case attr::OMPCaptureKind: return cast(this)->clone(C); case attr::OMPCaptureNoInit: return cast(this)->clone(C); case attr::OMPDeclareSimdDecl: return cast(this)->clone(C); case attr::OMPDeclareTargetDecl: return cast(this)->clone(C); case attr::OMPDeclareVariant: return cast(this)->clone(C); case attr::OMPReferencedVar: return cast(this)->clone(C); case attr::OMPThreadPrivateDecl: return cast(this)->clone(C); case attr::OSConsumed: return cast(this)->clone(C); case attr::OSConsumesThis: return cast(this)->clone(C); case attr::OSReturnsNotRetained: return cast(this)->clone(C); case attr::OSReturnsRetained: return cast(this)->clone(C); case attr::OSReturnsRetainedOnNonZero: return cast(this)->clone(C); case attr::OSReturnsRetainedOnZero: return cast(this)->clone(C); case attr::ObjCBoxable: return cast(this)->clone(C); case attr::ObjCBridge: return cast(this)->clone(C); case attr::ObjCBridgeMutable: return cast(this)->clone(C); case attr::ObjCBridgeRelated: return cast(this)->clone(C); case attr::ObjCClassStub: return cast(this)->clone(C); case attr::ObjCDesignatedInitializer: return cast(this)->clone(C); case attr::ObjCDirect: return cast(this)->clone(C); case attr::ObjCDirectMembers: return cast(this)->clone(C); case attr::ObjCException: return cast(this)->clone(C); case attr::ObjCExplicitProtocolImpl: return cast(this)->clone(C); case attr::ObjCExternallyRetained: return cast(this)->clone(C); case attr::ObjCGC: return cast(this)->clone(C); case attr::ObjCIndependentClass: return cast(this)->clone(C); case attr::ObjCInertUnsafeUnretained: return cast(this)->clone(C); case attr::ObjCKindOf: return cast(this)->clone(C); case attr::ObjCMethodFamily: return cast(this)->clone(C); case attr::ObjCNSObject: return cast(this)->clone(C); case attr::ObjCNonLazyClass: return cast(this)->clone(C); case attr::ObjCNonRuntimeProtocol: return cast(this)->clone(C); case attr::ObjCOwnership: return cast(this)->clone(C); case attr::ObjCPreciseLifetime: return cast(this)->clone(C); case attr::ObjCRequiresPropertyDefs: return cast(this)->clone(C); case attr::ObjCRequiresSuper: return cast(this)->clone(C); case attr::ObjCReturnsInnerPointer: return cast(this)->clone(C); case attr::ObjCRootClass: return cast(this)->clone(C); case attr::ObjCRuntimeName: return cast(this)->clone(C); case attr::ObjCRuntimeVisible: return cast(this)->clone(C); case attr::ObjCSubclassingRestricted: return cast(this)->clone(C); case attr::OpenCLAccess: return cast(this)->clone(C); case attr::OpenCLConstantAddressSpace: return cast(this)->clone(C); case attr::OpenCLGenericAddressSpace: return cast(this)->clone(C); case attr::OpenCLGlobalAddressSpace: return cast(this)->clone(C); case attr::OpenCLGlobalDeviceAddressSpace: return cast(this)->clone(C); case attr::OpenCLGlobalHostAddressSpace: return cast(this)->clone(C); case attr::OpenCLIntelReqdSubGroupSize: return cast(this)->clone(C); case attr::OpenCLKernel: return cast(this)->clone(C); case attr::OpenCLLocalAddressSpace: return cast(this)->clone(C); case attr::OpenCLPrivateAddressSpace: return cast(this)->clone(C); case attr::OpenCLUnrollHint: return cast(this)->clone(C); case attr::OptimizeNone: return cast(this)->clone(C); case attr::Overloadable: return cast(this)->clone(C); case attr::Override: return cast(this)->clone(C); case attr::Owner: return cast(this)->clone(C); case attr::Ownership: return cast(this)->clone(C); case attr::Packed: return cast(this)->clone(C); case attr::ParamTypestate: return cast(this)->clone(C); case attr::Pascal: return cast(this)->clone(C); case attr::PassObjectSize: return cast(this)->clone(C); case attr::PatchableFunctionEntry: return cast(this)->clone(C); case attr::Pcs: return cast(this)->clone(C); case attr::Pointer: return cast(this)->clone(C); case attr::PragmaClangBSSSection: return cast(this)->clone(C); case attr::PragmaClangDataSection: return cast(this)->clone(C); case attr::PragmaClangRelroSection: return cast(this)->clone(C); case attr::PragmaClangRodataSection: return cast(this)->clone(C); case attr::PragmaClangTextSection: return cast(this)->clone(C); case attr::PreferredName: return cast(this)->clone(C); case attr::PreferredType: return cast(this)->clone(C); case attr::PreserveAll: return cast(this)->clone(C); case attr::PreserveMost: return cast(this)->clone(C); case attr::PreserveNone: return cast(this)->clone(C); case attr::PtGuardedBy: return cast(this)->clone(C); case attr::PtGuardedVar: return cast(this)->clone(C); case attr::Ptr32: return cast(this)->clone(C); case attr::Ptr64: return cast(this)->clone(C); case attr::Pure: return cast(this)->clone(C); case attr::RISCVInterrupt: return cast(this)->clone(C); case attr::RISCVVectorCC: return cast(this)->clone(C); case attr::RandomizeLayout: return cast(this)->clone(C); case attr::ReadOnlyPlacement: return cast(this)->clone(C); case attr::RegCall: return cast(this)->clone(C); case attr::Reinitializes: return cast(this)->clone(C); case attr::ReleaseCapability: return cast(this)->clone(C); case attr::ReleaseHandle: return cast(this)->clone(C); case attr::RenderScriptKernel: return cast(this)->clone(C); case attr::ReqdWorkGroupSize: return cast(this)->clone(C); case attr::RequiresCapability: return cast(this)->clone(C); case attr::Restrict: return cast(this)->clone(C); case attr::Retain: return cast(this)->clone(C); case attr::ReturnTypestate: return cast(this)->clone(C); case attr::ReturnsNonNull: return cast(this)->clone(C); case attr::ReturnsTwice: return cast(this)->clone(C); case attr::SPtr: return cast(this)->clone(C); case attr::SYCLKernel: return cast(this)->clone(C); case attr::SYCLSpecialClass: return cast(this)->clone(C); case attr::ScopedLockable: return cast(this)->clone(C); case attr::Section: return cast(this)->clone(C); case attr::SelectAny: return cast(this)->clone(C); case attr::Sentinel: return cast(this)->clone(C); case attr::SetTypestate: return cast(this)->clone(C); case attr::SharedTrylockFunction: return cast(this)->clone(C); case attr::SizedBy: return cast(this)->clone(C); case attr::SizedByOrNull: return cast(this)->clone(C); case attr::SpeculativeLoadHardening: return cast(this)->clone(C); case attr::StandaloneDebug: return cast(this)->clone(C); case attr::StdCall: return cast(this)->clone(C); case attr::StrictFP: return cast(this)->clone(C); case attr::StrictGuardStackCheck: return cast(this)->clone(C); case attr::Suppress: return cast(this)->clone(C); case attr::SwiftAsync: return cast(this)->clone(C); case attr::SwiftAsyncCall: return cast(this)->clone(C); case attr::SwiftAsyncContext: return cast(this)->clone(C); case attr::SwiftAsyncError: return cast(this)->clone(C); case attr::SwiftAsyncName: return cast(this)->clone(C); case attr::SwiftAttr: return cast(this)->clone(C); case attr::SwiftBridge: return cast(this)->clone(C); case attr::SwiftBridgedTypedef: return cast(this)->clone(C); case attr::SwiftCall: return cast(this)->clone(C); case attr::SwiftContext: return cast(this)->clone(C); case attr::SwiftError: return cast(this)->clone(C); case attr::SwiftErrorResult: return cast(this)->clone(C); case attr::SwiftImportAsNonGeneric: return cast(this)->clone(C); case attr::SwiftImportPropertyAsAccessors: return cast(this)->clone(C); case attr::SwiftIndirectResult: return cast(this)->clone(C); case attr::SwiftName: return cast(this)->clone(C); case attr::SwiftNewType: return cast(this)->clone(C); case attr::SwiftObjCMembers: return cast(this)->clone(C); case attr::SwiftPrivate: return cast(this)->clone(C); case attr::SwiftVersionedAddition: return cast(this)->clone(C); case attr::SwiftVersionedRemoval: return cast(this)->clone(C); case attr::SysVABI: return cast(this)->clone(C); case attr::TLSModel: return cast(this)->clone(C); case attr::Target: return cast(this)->clone(C); case attr::TargetClones: return cast(this)->clone(C); case attr::TargetVersion: return cast(this)->clone(C); case attr::TestTypestate: return cast(this)->clone(C); case attr::ThisCall: return cast(this)->clone(C); case attr::Thread: return cast(this)->clone(C); case attr::TransparentUnion: return cast(this)->clone(C); case attr::TrivialABI: return cast(this)->clone(C); case attr::TryAcquireCapability: return cast(this)->clone(C); case attr::TypeNonNull: return cast(this)->clone(C); case attr::TypeNullUnspecified: return cast(this)->clone(C); case attr::TypeNullable: return cast(this)->clone(C); case attr::TypeNullableResult: return cast(this)->clone(C); case attr::TypeTagForDatatype: return cast(this)->clone(C); case attr::TypeVisibility: return cast(this)->clone(C); case attr::UPtr: return cast(this)->clone(C); case attr::Unavailable: return cast(this)->clone(C); case attr::Uninitialized: return cast(this)->clone(C); case attr::Unlikely: return cast(this)->clone(C); case attr::UnsafeBufferUsage: return cast(this)->clone(C); case attr::Unused: return cast(this)->clone(C); case attr::UseHandle: return cast(this)->clone(C); case attr::Used: return cast(this)->clone(C); case attr::UsingIfExists: return cast(this)->clone(C); case attr::Uuid: return cast(this)->clone(C); case attr::VTablePointerAuthentication: return cast(this)->clone(C); case attr::VecReturn: return cast(this)->clone(C); case attr::VecTypeHint: return cast(this)->clone(C); case attr::VectorCall: return cast(this)->clone(C); case attr::Visibility: return cast(this)->clone(C); case attr::WarnUnused: return cast(this)->clone(C); case attr::WarnUnusedResult: return cast(this)->clone(C); case attr::Weak: return cast(this)->clone(C); case attr::WeakImport: return cast(this)->clone(C); case attr::WeakRef: return cast(this)->clone(C); case attr::WebAssemblyExportName: return cast(this)->clone(C); case attr::WebAssemblyFuncref: return cast(this)->clone(C); case attr::WebAssemblyImportModule: return cast(this)->clone(C); case attr::WebAssemblyImportName: return cast(this)->clone(C); case attr::WorkGroupSizeHint: return cast(this)->clone(C); case attr::X86ForceAlignArgPointer: return cast(this)->clone(C); case attr::XRayInstrument: return cast(this)->clone(C); case attr::XRayLogArgs: return cast(this)->clone(C); case attr::ZeroCallUsedRegs: return cast(this)->clone(C); } llvm_unreachable("Unexpected attribute kind!"); } void Attr::printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const { switch (getKind()) { case attr::AArch64SVEPcs: return cast(this)->printPretty(OS, Policy); case attr::AArch64VectorPcs: return cast(this)->printPretty(OS, Policy); case attr::AMDGPUFlatWorkGroupSize: return cast(this)->printPretty(OS, Policy); case attr::AMDGPUKernelCall: return cast(this)->printPretty(OS, Policy); case attr::AMDGPUMaxNumWorkGroups: return cast(this)->printPretty(OS, Policy); case attr::AMDGPUNumSGPR: return cast(this)->printPretty(OS, Policy); case attr::AMDGPUNumVGPR: return cast(this)->printPretty(OS, Policy); case attr::AMDGPUWavesPerEU: return cast(this)->printPretty(OS, Policy); case attr::ARMInterrupt: return cast(this)->printPretty(OS, Policy); case attr::AVRInterrupt: return cast(this)->printPretty(OS, Policy); case attr::AVRSignal: return cast(this)->printPretty(OS, Policy); case attr::AbiTag: return cast(this)->printPretty(OS, Policy); case attr::AcquireCapability: return cast(this)->printPretty(OS, Policy); case attr::AcquireHandle: return cast(this)->printPretty(OS, Policy); case attr::AcquiredAfter: return cast(this)->printPretty(OS, Policy); case attr::AcquiredBefore: return cast(this)->printPretty(OS, Policy); case attr::AddressSpace: return cast(this)->printPretty(OS, Policy); case attr::Alias: return cast(this)->printPretty(OS, Policy); case attr::AlignMac68k: return cast(this)->printPretty(OS, Policy); case attr::AlignNatural: return cast(this)->printPretty(OS, Policy); case attr::AlignValue: return cast(this)->printPretty(OS, Policy); case attr::Aligned: return cast(this)->printPretty(OS, Policy); case attr::AllocAlign: return cast(this)->printPretty(OS, Policy); case attr::AllocSize: return cast(this)->printPretty(OS, Policy); case attr::Allocating: return cast(this)->printPretty(OS, Policy); case attr::AlwaysDestroy: return cast(this)->printPretty(OS, Policy); case attr::AlwaysInline: return cast(this)->printPretty(OS, Policy); case attr::AnalyzerNoReturn: return cast(this)->printPretty(OS, Policy); case attr::Annotate: return cast(this)->printPretty(OS, Policy); case attr::AnnotateType: return cast(this)->printPretty(OS, Policy); case attr::AnyX86Interrupt: return cast(this)->printPretty(OS, Policy); case attr::AnyX86NoCallerSavedRegisters: return cast(this)->printPretty(OS, Policy); case attr::AnyX86NoCfCheck: return cast(this)->printPretty(OS, Policy); case attr::ArcWeakrefUnavailable: return cast(this)->printPretty(OS, Policy); case attr::ArgumentWithTypeTag: return cast(this)->printPretty(OS, Policy); case attr::ArmBuiltinAlias: return cast(this)->printPretty(OS, Policy); case attr::ArmIn: return cast(this)->printPretty(OS, Policy); case attr::ArmInOut: return cast(this)->printPretty(OS, Policy); case attr::ArmLocallyStreaming: return cast(this)->printPretty(OS, Policy); case attr::ArmMveStrictPolymorphism: return cast(this)->printPretty(OS, Policy); case attr::ArmNew: return cast(this)->printPretty(OS, Policy); case attr::ArmOut: return cast(this)->printPretty(OS, Policy); case attr::ArmPreserves: return cast(this)->printPretty(OS, Policy); case attr::ArmStreaming: return cast(this)->printPretty(OS, Policy); case attr::ArmStreamingCompatible: return cast(this)->printPretty(OS, Policy); case attr::Artificial: return cast(this)->printPretty(OS, Policy); case attr::AsmLabel: return cast(this)->printPretty(OS, Policy); case attr::AssertCapability: return cast(this)->printPretty(OS, Policy); case attr::AssertExclusiveLock: return cast(this)->printPretty(OS, Policy); case attr::AssertSharedLock: return cast(this)->printPretty(OS, Policy); case attr::AssumeAligned: return cast(this)->printPretty(OS, Policy); case attr::Availability: return cast(this)->printPretty(OS, Policy); case attr::AvailableOnlyInDefaultEvalMethod: return cast(this)->printPretty(OS, Policy); case attr::BPFFastCall: return cast(this)->printPretty(OS, Policy); case attr::BPFPreserveAccessIndex: return cast(this)->printPretty(OS, Policy); case attr::BPFPreserveStaticOffset: return cast(this)->printPretty(OS, Policy); case attr::BTFDeclTag: return cast(this)->printPretty(OS, Policy); case attr::BTFTypeTag: return cast(this)->printPretty(OS, Policy); case attr::Blocking: return cast(this)->printPretty(OS, Policy); case attr::Blocks: return cast(this)->printPretty(OS, Policy); case attr::Builtin: return cast(this)->printPretty(OS, Policy); case attr::BuiltinAlias: return cast(this)->printPretty(OS, Policy); case attr::C11NoReturn: return cast(this)->printPretty(OS, Policy); case attr::CDecl: return cast(this)->printPretty(OS, Policy); case attr::CFAuditedTransfer: return cast(this)->printPretty(OS, Policy); case attr::CFConsumed: return cast(this)->printPretty(OS, Policy); case attr::CFGuard: return cast(this)->printPretty(OS, Policy); case attr::CFICanonicalJumpTable: return cast(this)->printPretty(OS, Policy); case attr::CFReturnsNotRetained: return cast(this)->printPretty(OS, Policy); case attr::CFReturnsRetained: return cast(this)->printPretty(OS, Policy); case attr::CFUnknownTransfer: return cast(this)->printPretty(OS, Policy); case attr::CPUDispatch: return cast(this)->printPretty(OS, Policy); case attr::CPUSpecific: return cast(this)->printPretty(OS, Policy); case attr::CUDAConstant: return cast(this)->printPretty(OS, Policy); case attr::CUDADevice: return cast(this)->printPretty(OS, Policy); case attr::CUDADeviceBuiltinSurfaceType: return cast(this)->printPretty(OS, Policy); case attr::CUDADeviceBuiltinTextureType: return cast(this)->printPretty(OS, Policy); case attr::CUDAGlobal: return cast(this)->printPretty(OS, Policy); case attr::CUDAHost: return cast(this)->printPretty(OS, Policy); case attr::CUDAInvalidTarget: return cast(this)->printPretty(OS, Policy); case attr::CUDALaunchBounds: return cast(this)->printPretty(OS, Policy); case attr::CUDAShared: return cast(this)->printPretty(OS, Policy); case attr::CXX11NoReturn: return cast(this)->printPretty(OS, Policy); case attr::CXXAssume: return cast(this)->printPretty(OS, Policy); case attr::CallableWhen: return cast(this)->printPretty(OS, Policy); case attr::Callback: return cast(this)->printPretty(OS, Policy); case attr::CalledOnce: return cast(this)->printPretty(OS, Policy); case attr::Capability: return cast(this)->printPretty(OS, Policy); case attr::CapturedRecord: return cast(this)->printPretty(OS, Policy); case attr::CarriesDependency: return cast(this)->printPretty(OS, Policy); case attr::Cleanup: return cast(this)->printPretty(OS, Policy); case attr::ClspvLibclcBuiltin: return cast(this)->printPretty(OS, Policy); case attr::CmseNSCall: return cast(this)->printPretty(OS, Policy); case attr::CmseNSEntry: return cast(this)->printPretty(OS, Policy); case attr::CodeAlign: return cast(this)->printPretty(OS, Policy); case attr::CodeModel: return cast(this)->printPretty(OS, Policy); case attr::CodeSeg: return cast(this)->printPretty(OS, Policy); case attr::Cold: return cast(this)->printPretty(OS, Policy); case attr::Common: return cast(this)->printPretty(OS, Policy); case attr::Const: return cast(this)->printPretty(OS, Policy); case attr::ConstInit: return cast(this)->printPretty(OS, Policy); case attr::Constructor: return cast(this)->printPretty(OS, Policy); case attr::Consumable: return cast(this)->printPretty(OS, Policy); case attr::ConsumableAutoCast: return cast(this)->printPretty(OS, Policy); case attr::ConsumableSetOnRead: return cast(this)->printPretty(OS, Policy); case attr::Convergent: return cast(this)->printPretty(OS, Policy); case attr::CoroDisableLifetimeBound: return cast(this)->printPretty(OS, Policy); case attr::CoroLifetimeBound: return cast(this)->printPretty(OS, Policy); case attr::CoroOnlyDestroyWhenComplete: return cast(this)->printPretty(OS, Policy); case attr::CoroReturnType: return cast(this)->printPretty(OS, Policy); case attr::CoroWrapper: return cast(this)->printPretty(OS, Policy); case attr::CountedBy: return cast(this)->printPretty(OS, Policy); case attr::CountedByOrNull: return cast(this)->printPretty(OS, Policy); case attr::DLLExport: return cast(this)->printPretty(OS, Policy); case attr::DLLExportStaticLocal: return cast(this)->printPretty(OS, Policy); case attr::DLLImport: return cast(this)->printPretty(OS, Policy); case attr::DLLImportStaticLocal: return cast(this)->printPretty(OS, Policy); case attr::Deprecated: return cast(this)->printPretty(OS, Policy); case attr::Destructor: return cast(this)->printPretty(OS, Policy); case attr::DiagnoseAsBuiltin: return cast(this)->printPretty(OS, Policy); case attr::DiagnoseIf: return cast(this)->printPretty(OS, Policy); case attr::DisableSanitizerInstrumentation: return cast(this)->printPretty(OS, Policy); case attr::DisableTailCalls: return cast(this)->printPretty(OS, Policy); case attr::EmptyBases: return cast(this)->printPretty(OS, Policy); case attr::EnableIf: return cast(this)->printPretty(OS, Policy); case attr::EnforceTCB: return cast(this)->printPretty(OS, Policy); case attr::EnforceTCBLeaf: return cast(this)->printPretty(OS, Policy); case attr::EnumExtensibility: return cast(this)->printPretty(OS, Policy); case attr::Error: return cast(this)->printPretty(OS, Policy); case attr::ExcludeFromExplicitInstantiation: return cast(this)->printPretty(OS, Policy); case attr::ExclusiveTrylockFunction: return cast(this)->printPretty(OS, Policy); case attr::ExternalSourceSymbol: return cast(this)->printPretty(OS, Policy); case attr::FallThrough: return cast(this)->printPretty(OS, Policy); case attr::FastCall: return cast(this)->printPretty(OS, Policy); case attr::Final: return cast(this)->printPretty(OS, Policy); case attr::FlagEnum: return cast(this)->printPretty(OS, Policy); case attr::Flatten: return cast(this)->printPretty(OS, Policy); case attr::Format: return cast(this)->printPretty(OS, Policy); case attr::FormatArg: return cast(this)->printPretty(OS, Policy); case attr::FunctionReturnThunks: return cast(this)->printPretty(OS, Policy); case attr::GNUInline: return cast(this)->printPretty(OS, Policy); case attr::GuardedBy: return cast(this)->printPretty(OS, Policy); case attr::GuardedVar: return cast(this)->printPretty(OS, Policy); case attr::HIPManaged: return cast(this)->printPretty(OS, Policy); case attr::HLSLGroupSharedAddressSpace: return cast(this)->printPretty(OS, Policy); case attr::HLSLLoopHint: return cast(this)->printPretty(OS, Policy); case attr::HLSLNumThreads: return cast(this)->printPretty(OS, Policy); case attr::HLSLPackOffset: return cast(this)->printPretty(OS, Policy); case attr::HLSLParamModifier: return cast(this)->printPretty(OS, Policy); case attr::HLSLROV: return cast(this)->printPretty(OS, Policy); case attr::HLSLResource: return cast(this)->printPretty(OS, Policy); case attr::HLSLResourceBinding: return cast(this)->printPretty(OS, Policy); case attr::HLSLResourceClass: return cast(this)->printPretty(OS, Policy); case attr::HLSLSV_DispatchThreadID: return cast(this)->printPretty(OS, Policy); case attr::HLSLSV_GroupIndex: return cast(this)->printPretty(OS, Policy); case attr::HLSLShader: return cast(this)->printPretty(OS, Policy); case attr::Hot: return cast(this)->printPretty(OS, Policy); case attr::HybridPatchable: return cast(this)->printPretty(OS, Policy); case attr::IBAction: return cast(this)->printPretty(OS, Policy); case attr::IBOutlet: return cast(this)->printPretty(OS, Policy); case attr::IBOutletCollection: return cast(this)->printPretty(OS, Policy); case attr::IFunc: return cast(this)->printPretty(OS, Policy); case attr::InitPriority: return cast(this)->printPretty(OS, Policy); case attr::InitSeg: return cast(this)->printPretty(OS, Policy); case attr::IntelOclBicc: return cast(this)->printPretty(OS, Policy); case attr::InternalLinkage: return cast(this)->printPretty(OS, Policy); case attr::LTOVisibilityPublic: return cast(this)->printPretty(OS, Policy); case attr::LayoutVersion: return cast(this)->printPretty(OS, Policy); case attr::Leaf: return cast(this)->printPretty(OS, Policy); case attr::LifetimeBound: return cast(this)->printPretty(OS, Policy); case attr::Likely: return cast(this)->printPretty(OS, Policy); case attr::LoaderUninitialized: return cast(this)->printPretty(OS, Policy); case attr::LockReturned: return cast(this)->printPretty(OS, Policy); case attr::LocksExcluded: return cast(this)->printPretty(OS, Policy); case attr::LoopHint: return cast(this)->printPretty(OS, Policy); case attr::M68kInterrupt: return cast(this)->printPretty(OS, Policy); case attr::M68kRTD: return cast(this)->printPretty(OS, Policy); case attr::MIGServerRoutine: return cast(this)->printPretty(OS, Policy); case attr::MSABI: return cast(this)->printPretty(OS, Policy); case attr::MSAllocator: return cast(this)->printPretty(OS, Policy); case attr::MSConstexpr: return cast(this)->printPretty(OS, Policy); case attr::MSInheritance: return cast(this)->printPretty(OS, Policy); case attr::MSNoVTable: return cast(this)->printPretty(OS, Policy); case attr::MSP430Interrupt: return cast(this)->printPretty(OS, Policy); case attr::MSStruct: return cast(this)->printPretty(OS, Policy); case attr::MSVtorDisp: return cast(this)->printPretty(OS, Policy); case attr::MaxFieldAlignment: return cast(this)->printPretty(OS, Policy); case attr::MayAlias: return cast(this)->printPretty(OS, Policy); case attr::MaybeUndef: return cast(this)->printPretty(OS, Policy); case attr::MicroMips: return cast(this)->printPretty(OS, Policy); case attr::MinSize: return cast(this)->printPretty(OS, Policy); case attr::MinVectorWidth: return cast(this)->printPretty(OS, Policy); case attr::Mips16: return cast(this)->printPretty(OS, Policy); case attr::MipsInterrupt: return cast(this)->printPretty(OS, Policy); case attr::MipsLongCall: return cast(this)->printPretty(OS, Policy); case attr::MipsShortCall: return cast(this)->printPretty(OS, Policy); case attr::Mode: return cast(this)->printPretty(OS, Policy); case attr::MustTail: return cast(this)->printPretty(OS, Policy); case attr::NSConsumed: return cast(this)->printPretty(OS, Policy); case attr::NSConsumesSelf: return cast(this)->printPretty(OS, Policy); case attr::NSErrorDomain: return cast(this)->printPretty(OS, Policy); case attr::NSReturnsAutoreleased: return cast(this)->printPretty(OS, Policy); case attr::NSReturnsNotRetained: return cast(this)->printPretty(OS, Policy); case attr::NSReturnsRetained: return cast(this)->printPretty(OS, Policy); case attr::NVPTXKernel: return cast(this)->printPretty(OS, Policy); case attr::Naked: return cast(this)->printPretty(OS, Policy); case attr::NoAlias: return cast(this)->printPretty(OS, Policy); case attr::NoBuiltin: return cast(this)->printPretty(OS, Policy); case attr::NoCommon: return cast(this)->printPretty(OS, Policy); case attr::NoConvergent: return cast(this)->printPretty(OS, Policy); case attr::NoDebug: return cast(this)->printPretty(OS, Policy); case attr::NoDeref: return cast(this)->printPretty(OS, Policy); case attr::NoDestroy: return cast(this)->printPretty(OS, Policy); case attr::NoDuplicate: return cast(this)->printPretty(OS, Policy); case attr::NoEscape: return cast(this)->printPretty(OS, Policy); case attr::NoInline: return cast(this)->printPretty(OS, Policy); case attr::NoInstrumentFunction: return cast(this)->printPretty(OS, Policy); case attr::NoMerge: return cast(this)->printPretty(OS, Policy); case attr::NoMicroMips: return cast(this)->printPretty(OS, Policy); case attr::NoMips16: return cast(this)->printPretty(OS, Policy); case attr::NoProfileFunction: return cast(this)->printPretty(OS, Policy); case attr::NoRandomizeLayout: return cast(this)->printPretty(OS, Policy); case attr::NoReturn: return cast(this)->printPretty(OS, Policy); case attr::NoSanitize: return cast(this)->printPretty(OS, Policy); case attr::NoSpeculativeLoadHardening: return cast(this)->printPretty(OS, Policy); case attr::NoSplitStack: return cast(this)->printPretty(OS, Policy); case attr::NoStackProtector: return cast(this)->printPretty(OS, Policy); case attr::NoThreadSafetyAnalysis: return cast(this)->printPretty(OS, Policy); case attr::NoThrow: return cast(this)->printPretty(OS, Policy); case attr::NoUniqueAddress: return cast(this)->printPretty(OS, Policy); case attr::NoUwtable: return cast(this)->printPretty(OS, Policy); case attr::NonAllocating: return cast(this)->printPretty(OS, Policy); case attr::NonBlocking: return cast(this)->printPretty(OS, Policy); case attr::NonNull: return cast(this)->printPretty(OS, Policy); case attr::NotTailCalled: return cast(this)->printPretty(OS, Policy); case attr::OMPAllocateDecl: return cast(this)->printPretty(OS, Policy); case attr::OMPAssume: return cast(this)->printPretty(OS, Policy); case attr::OMPCaptureKind: return cast(this)->printPretty(OS, Policy); case attr::OMPCaptureNoInit: return cast(this)->printPretty(OS, Policy); case attr::OMPDeclareSimdDecl: return cast(this)->printPretty(OS, Policy); case attr::OMPDeclareTargetDecl: return cast(this)->printPretty(OS, Policy); case attr::OMPDeclareVariant: return cast(this)->printPretty(OS, Policy); case attr::OMPReferencedVar: return cast(this)->printPretty(OS, Policy); case attr::OMPThreadPrivateDecl: return cast(this)->printPretty(OS, Policy); case attr::OSConsumed: return cast(this)->printPretty(OS, Policy); case attr::OSConsumesThis: return cast(this)->printPretty(OS, Policy); case attr::OSReturnsNotRetained: return cast(this)->printPretty(OS, Policy); case attr::OSReturnsRetained: return cast(this)->printPretty(OS, Policy); case attr::OSReturnsRetainedOnNonZero: return cast(this)->printPretty(OS, Policy); case attr::OSReturnsRetainedOnZero: return cast(this)->printPretty(OS, Policy); case attr::ObjCBoxable: return cast(this)->printPretty(OS, Policy); case attr::ObjCBridge: return cast(this)->printPretty(OS, Policy); case attr::ObjCBridgeMutable: return cast(this)->printPretty(OS, Policy); case attr::ObjCBridgeRelated: return cast(this)->printPretty(OS, Policy); case attr::ObjCClassStub: return cast(this)->printPretty(OS, Policy); case attr::ObjCDesignatedInitializer: return cast(this)->printPretty(OS, Policy); case attr::ObjCDirect: return cast(this)->printPretty(OS, Policy); case attr::ObjCDirectMembers: return cast(this)->printPretty(OS, Policy); case attr::ObjCException: return cast(this)->printPretty(OS, Policy); case attr::ObjCExplicitProtocolImpl: return cast(this)->printPretty(OS, Policy); case attr::ObjCExternallyRetained: return cast(this)->printPretty(OS, Policy); case attr::ObjCGC: return cast(this)->printPretty(OS, Policy); case attr::ObjCIndependentClass: return cast(this)->printPretty(OS, Policy); case attr::ObjCInertUnsafeUnretained: return cast(this)->printPretty(OS, Policy); case attr::ObjCKindOf: return cast(this)->printPretty(OS, Policy); case attr::ObjCMethodFamily: return cast(this)->printPretty(OS, Policy); case attr::ObjCNSObject: return cast(this)->printPretty(OS, Policy); case attr::ObjCNonLazyClass: return cast(this)->printPretty(OS, Policy); case attr::ObjCNonRuntimeProtocol: return cast(this)->printPretty(OS, Policy); case attr::ObjCOwnership: return cast(this)->printPretty(OS, Policy); case attr::ObjCPreciseLifetime: return cast(this)->printPretty(OS, Policy); case attr::ObjCRequiresPropertyDefs: return cast(this)->printPretty(OS, Policy); case attr::ObjCRequiresSuper: return cast(this)->printPretty(OS, Policy); case attr::ObjCReturnsInnerPointer: return cast(this)->printPretty(OS, Policy); case attr::ObjCRootClass: return cast(this)->printPretty(OS, Policy); case attr::ObjCRuntimeName: return cast(this)->printPretty(OS, Policy); case attr::ObjCRuntimeVisible: return cast(this)->printPretty(OS, Policy); case attr::ObjCSubclassingRestricted: return cast(this)->printPretty(OS, Policy); case attr::OpenCLAccess: return cast(this)->printPretty(OS, Policy); case attr::OpenCLConstantAddressSpace: return cast(this)->printPretty(OS, Policy); case attr::OpenCLGenericAddressSpace: return cast(this)->printPretty(OS, Policy); case attr::OpenCLGlobalAddressSpace: return cast(this)->printPretty(OS, Policy); case attr::OpenCLGlobalDeviceAddressSpace: return cast(this)->printPretty(OS, Policy); case attr::OpenCLGlobalHostAddressSpace: return cast(this)->printPretty(OS, Policy); case attr::OpenCLIntelReqdSubGroupSize: return cast(this)->printPretty(OS, Policy); case attr::OpenCLKernel: return cast(this)->printPretty(OS, Policy); case attr::OpenCLLocalAddressSpace: return cast(this)->printPretty(OS, Policy); case attr::OpenCLPrivateAddressSpace: return cast(this)->printPretty(OS, Policy); case attr::OpenCLUnrollHint: return cast(this)->printPretty(OS, Policy); case attr::OptimizeNone: return cast(this)->printPretty(OS, Policy); case attr::Overloadable: return cast(this)->printPretty(OS, Policy); case attr::Override: return cast(this)->printPretty(OS, Policy); case attr::Owner: return cast(this)->printPretty(OS, Policy); case attr::Ownership: return cast(this)->printPretty(OS, Policy); case attr::Packed: return cast(this)->printPretty(OS, Policy); case attr::ParamTypestate: return cast(this)->printPretty(OS, Policy); case attr::Pascal: return cast(this)->printPretty(OS, Policy); case attr::PassObjectSize: return cast(this)->printPretty(OS, Policy); case attr::PatchableFunctionEntry: return cast(this)->printPretty(OS, Policy); case attr::Pcs: return cast(this)->printPretty(OS, Policy); case attr::Pointer: return cast(this)->printPretty(OS, Policy); case attr::PragmaClangBSSSection: return cast(this)->printPretty(OS, Policy); case attr::PragmaClangDataSection: return cast(this)->printPretty(OS, Policy); case attr::PragmaClangRelroSection: return cast(this)->printPretty(OS, Policy); case attr::PragmaClangRodataSection: return cast(this)->printPretty(OS, Policy); case attr::PragmaClangTextSection: return cast(this)->printPretty(OS, Policy); case attr::PreferredName: return cast(this)->printPretty(OS, Policy); case attr::PreferredType: return cast(this)->printPretty(OS, Policy); case attr::PreserveAll: return cast(this)->printPretty(OS, Policy); case attr::PreserveMost: return cast(this)->printPretty(OS, Policy); case attr::PreserveNone: return cast(this)->printPretty(OS, Policy); case attr::PtGuardedBy: return cast(this)->printPretty(OS, Policy); case attr::PtGuardedVar: return cast(this)->printPretty(OS, Policy); case attr::Ptr32: return cast(this)->printPretty(OS, Policy); case attr::Ptr64: return cast(this)->printPretty(OS, Policy); case attr::Pure: return cast(this)->printPretty(OS, Policy); case attr::RISCVInterrupt: return cast(this)->printPretty(OS, Policy); case attr::RISCVVectorCC: return cast(this)->printPretty(OS, Policy); case attr::RandomizeLayout: return cast(this)->printPretty(OS, Policy); case attr::ReadOnlyPlacement: return cast(this)->printPretty(OS, Policy); case attr::RegCall: return cast(this)->printPretty(OS, Policy); case attr::Reinitializes: return cast(this)->printPretty(OS, Policy); case attr::ReleaseCapability: return cast(this)->printPretty(OS, Policy); case attr::ReleaseHandle: return cast(this)->printPretty(OS, Policy); case attr::RenderScriptKernel: return cast(this)->printPretty(OS, Policy); case attr::ReqdWorkGroupSize: return cast(this)->printPretty(OS, Policy); case attr::RequiresCapability: return cast(this)->printPretty(OS, Policy); case attr::Restrict: return cast(this)->printPretty(OS, Policy); case attr::Retain: return cast(this)->printPretty(OS, Policy); case attr::ReturnTypestate: return cast(this)->printPretty(OS, Policy); case attr::ReturnsNonNull: return cast(this)->printPretty(OS, Policy); case attr::ReturnsTwice: return cast(this)->printPretty(OS, Policy); case attr::SPtr: return cast(this)->printPretty(OS, Policy); case attr::SYCLKernel: return cast(this)->printPretty(OS, Policy); case attr::SYCLSpecialClass: return cast(this)->printPretty(OS, Policy); case attr::ScopedLockable: return cast(this)->printPretty(OS, Policy); case attr::Section: return cast(this)->printPretty(OS, Policy); case attr::SelectAny: return cast(this)->printPretty(OS, Policy); case attr::Sentinel: return cast(this)->printPretty(OS, Policy); case attr::SetTypestate: return cast(this)->printPretty(OS, Policy); case attr::SharedTrylockFunction: return cast(this)->printPretty(OS, Policy); case attr::SizedBy: return cast(this)->printPretty(OS, Policy); case attr::SizedByOrNull: return cast(this)->printPretty(OS, Policy); case attr::SpeculativeLoadHardening: return cast(this)->printPretty(OS, Policy); case attr::StandaloneDebug: return cast(this)->printPretty(OS, Policy); case attr::StdCall: return cast(this)->printPretty(OS, Policy); case attr::StrictFP: return cast(this)->printPretty(OS, Policy); case attr::StrictGuardStackCheck: return cast(this)->printPretty(OS, Policy); case attr::Suppress: return cast(this)->printPretty(OS, Policy); case attr::SwiftAsync: return cast(this)->printPretty(OS, Policy); case attr::SwiftAsyncCall: return cast(this)->printPretty(OS, Policy); case attr::SwiftAsyncContext: return cast(this)->printPretty(OS, Policy); case attr::SwiftAsyncError: return cast(this)->printPretty(OS, Policy); case attr::SwiftAsyncName: return cast(this)->printPretty(OS, Policy); case attr::SwiftAttr: return cast(this)->printPretty(OS, Policy); case attr::SwiftBridge: return cast(this)->printPretty(OS, Policy); case attr::SwiftBridgedTypedef: return cast(this)->printPretty(OS, Policy); case attr::SwiftCall: return cast(this)->printPretty(OS, Policy); case attr::SwiftContext: return cast(this)->printPretty(OS, Policy); case attr::SwiftError: return cast(this)->printPretty(OS, Policy); case attr::SwiftErrorResult: return cast(this)->printPretty(OS, Policy); case attr::SwiftImportAsNonGeneric: return cast(this)->printPretty(OS, Policy); case attr::SwiftImportPropertyAsAccessors: return cast(this)->printPretty(OS, Policy); case attr::SwiftIndirectResult: return cast(this)->printPretty(OS, Policy); case attr::SwiftName: return cast(this)->printPretty(OS, Policy); case attr::SwiftNewType: return cast(this)->printPretty(OS, Policy); case attr::SwiftObjCMembers: return cast(this)->printPretty(OS, Policy); case attr::SwiftPrivate: return cast(this)->printPretty(OS, Policy); case attr::SwiftVersionedAddition: return cast(this)->printPretty(OS, Policy); case attr::SwiftVersionedRemoval: return cast(this)->printPretty(OS, Policy); case attr::SysVABI: return cast(this)->printPretty(OS, Policy); case attr::TLSModel: return cast(this)->printPretty(OS, Policy); case attr::Target: return cast(this)->printPretty(OS, Policy); case attr::TargetClones: return cast(this)->printPretty(OS, Policy); case attr::TargetVersion: return cast(this)->printPretty(OS, Policy); case attr::TestTypestate: return cast(this)->printPretty(OS, Policy); case attr::ThisCall: return cast(this)->printPretty(OS, Policy); case attr::Thread: return cast(this)->printPretty(OS, Policy); case attr::TransparentUnion: return cast(this)->printPretty(OS, Policy); case attr::TrivialABI: return cast(this)->printPretty(OS, Policy); case attr::TryAcquireCapability: return cast(this)->printPretty(OS, Policy); case attr::TypeNonNull: return cast(this)->printPretty(OS, Policy); case attr::TypeNullUnspecified: return cast(this)->printPretty(OS, Policy); case attr::TypeNullable: return cast(this)->printPretty(OS, Policy); case attr::TypeNullableResult: return cast(this)->printPretty(OS, Policy); case attr::TypeTagForDatatype: return cast(this)->printPretty(OS, Policy); case attr::TypeVisibility: return cast(this)->printPretty(OS, Policy); case attr::UPtr: return cast(this)->printPretty(OS, Policy); case attr::Unavailable: return cast(this)->printPretty(OS, Policy); case attr::Uninitialized: return cast(this)->printPretty(OS, Policy); case attr::Unlikely: return cast(this)->printPretty(OS, Policy); case attr::UnsafeBufferUsage: return cast(this)->printPretty(OS, Policy); case attr::Unused: return cast(this)->printPretty(OS, Policy); case attr::UseHandle: return cast(this)->printPretty(OS, Policy); case attr::Used: return cast(this)->printPretty(OS, Policy); case attr::UsingIfExists: return cast(this)->printPretty(OS, Policy); case attr::Uuid: return cast(this)->printPretty(OS, Policy); case attr::VTablePointerAuthentication: return cast(this)->printPretty(OS, Policy); case attr::VecReturn: return cast(this)->printPretty(OS, Policy); case attr::VecTypeHint: return cast(this)->printPretty(OS, Policy); case attr::VectorCall: return cast(this)->printPretty(OS, Policy); case attr::Visibility: return cast(this)->printPretty(OS, Policy); case attr::WarnUnused: return cast(this)->printPretty(OS, Policy); case attr::WarnUnusedResult: return cast(this)->printPretty(OS, Policy); case attr::Weak: return cast(this)->printPretty(OS, Policy); case attr::WeakImport: return cast(this)->printPretty(OS, Policy); case attr::WeakRef: return cast(this)->printPretty(OS, Policy); case attr::WebAssemblyExportName: return cast(this)->printPretty(OS, Policy); case attr::WebAssemblyFuncref: return cast(this)->printPretty(OS, Policy); case attr::WebAssemblyImportModule: return cast(this)->printPretty(OS, Policy); case attr::WebAssemblyImportName: return cast(this)->printPretty(OS, Policy); case attr::WorkGroupSizeHint: return cast(this)->printPretty(OS, Policy); case attr::X86ForceAlignArgPointer: return cast(this)->printPretty(OS, Policy); case attr::XRayInstrument: return cast(this)->printPretty(OS, Policy); case attr::XRayLogArgs: return cast(this)->printPretty(OS, Policy); case attr::ZeroCallUsedRegs: return cast(this)->printPretty(OS, Policy); } llvm_unreachable("Unexpected attribute kind!"); }