@@ -3719,8 +3719,27 @@ void EmitClangAttrParsedAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
37193719 // ParsedAttr.cpp.
37203720 const std::string &AttrName = I->first ;
37213721 const Record &Attr = *I->second ;
3722- OS << " struct ParsedAttrInfo" << I->first << " : public ParsedAttrInfo {\n " ;
3723- OS << " ParsedAttrInfo" << I->first << " () {\n " ;
3722+ auto Spellings = GetFlattenedSpellings (Attr);
3723+ if (!Spellings.empty ()) {
3724+ OS << " static constexpr ParsedAttrInfo::Spelling " << I->first
3725+ << " Spellings[] = {\n " ;
3726+ for (const auto &S : Spellings) {
3727+ const std::string &RawSpelling = S.name ();
3728+ std::string Spelling;
3729+ if (!S.nameSpace ().empty ())
3730+ Spelling += S.nameSpace () + " ::" ;
3731+ if (S.variety () == " GNU" )
3732+ Spelling += NormalizeGNUAttrSpelling (RawSpelling);
3733+ else
3734+ Spelling += RawSpelling;
3735+ OS << " {AttributeCommonInfo::AS_" << S.variety ();
3736+ OS << " , \" " << Spelling << " \" },\n " ;
3737+ }
3738+ OS << " };\n " ;
3739+ }
3740+ OS << " struct ParsedAttrInfo" << I->first
3741+ << " final : public ParsedAttrInfo {\n " ;
3742+ OS << " constexpr ParsedAttrInfo" << I->first << " () {\n " ;
37243743 OS << " AttrKind = ParsedAttr::AT_" << AttrName << " ;\n " ;
37253744 emitArgInfo (Attr, OS);
37263745 OS << " HasCustomParsing = " ;
@@ -3736,18 +3755,8 @@ void EmitClangAttrParsedAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
37363755 OS << IsKnownToGCC (Attr) << " ;\n " ;
37373756 OS << " IsSupportedByPragmaAttribute = " ;
37383757 OS << PragmaAttributeSupport.isAttributedSupported (*I->second ) << " ;\n " ;
3739- for (const auto &S : GetFlattenedSpellings (Attr)) {
3740- const std::string &RawSpelling = S.name ();
3741- std::string Spelling;
3742- if (!S.nameSpace ().empty ())
3743- Spelling += S.nameSpace () + " ::" ;
3744- if (S.variety () == " GNU" )
3745- Spelling += NormalizeGNUAttrSpelling (RawSpelling);
3746- else
3747- Spelling += RawSpelling;
3748- OS << " Spellings.push_back({AttributeCommonInfo::AS_" << S.variety ();
3749- OS << " ,\" " << Spelling << " \" });\n " ;
3750- }
3758+ if (!Spellings.empty ())
3759+ OS << " Spellings = " << I->first << " Spellings;\n " ;
37513760 OS << " }\n " ;
37523761 GenerateAppertainsTo (Attr, OS);
37533762 GenerateLangOptRequirements (Attr, OS);
0 commit comments