@@ -410,14 +410,8 @@ class ASTContext : public RefCountedBase<ASTContext> {
410410 // / The identifier 'NSCopying'.
411411 IdentifierInfo *NSCopyingName = nullptr ;
412412
413- // / The identifier '__make_integer_seq'.
414- mutable IdentifierInfo *MakeIntegerSeqName = nullptr ;
415-
416- // / The identifier '__type_pack_element'.
417- mutable IdentifierInfo *TypePackElementName = nullptr ;
418-
419- // / The identifier '__builtin_common_type'.
420- mutable IdentifierInfo *BuiltinCommonTypeName = nullptr ;
413+ #define BuiltinTemplate (BTName ) mutable IdentifierInfo *Name##BTName = nullptr ;
414+ #include " clang/Basic/BuiltinTemplates.inc"
421415
422416 QualType ObjCConstantStringType;
423417 mutable RecordDecl *CFConstantStringTagDecl = nullptr ;
@@ -629,9 +623,10 @@ class ASTContext : public RefCountedBase<ASTContext> {
629623
630624 TranslationUnitDecl *TUDecl = nullptr ;
631625 mutable ExternCContextDecl *ExternCContext = nullptr ;
632- mutable BuiltinTemplateDecl *MakeIntegerSeqDecl = nullptr ;
633- mutable BuiltinTemplateDecl *TypePackElementDecl = nullptr ;
634- mutable BuiltinTemplateDecl *BuiltinCommonTypeDecl = nullptr ;
626+
627+ #define BuiltinTemplate (BTName ) \
628+ mutable BuiltinTemplateDecl *Decl##BTName = nullptr ;
629+ #include " clang/Basic/BuiltinTemplates.inc"
635630
636631 // / The associated SourceManager object.
637632 SourceManager &SourceMgr;
@@ -1157,9 +1152,9 @@ class ASTContext : public RefCountedBase<ASTContext> {
11571152 }
11581153
11591154 ExternCContextDecl *getExternCContextDecl () const ;
1160- BuiltinTemplateDecl * getMakeIntegerSeqDecl () const ;
1161- BuiltinTemplateDecl *getTypePackElementDecl () const ;
1162- BuiltinTemplateDecl * getBuiltinCommonTypeDecl () const ;
1155+
1156+ # define BuiltinTemplate ( BTName ) BuiltinTemplateDecl *get##BTName##Decl () const ;
1157+ # include " clang/Basic/BuiltinTemplates.inc "
11631158
11641159 // Builtin Types.
11651160 CanQualType VoidTy;
@@ -2107,23 +2102,13 @@ class ASTContext : public RefCountedBase<ASTContext> {
21072102 return BoolName;
21082103 }
21092104
2110- IdentifierInfo *getMakeIntegerSeqName () const {
2111- if (!MakeIntegerSeqName)
2112- MakeIntegerSeqName = &Idents.get (" __make_integer_seq" );
2113- return MakeIntegerSeqName;
2114- }
2115-
2116- IdentifierInfo *getTypePackElementName () const {
2117- if (!TypePackElementName)
2118- TypePackElementName = &Idents.get (" __type_pack_element" );
2119- return TypePackElementName;
2120- }
2121-
2122- IdentifierInfo *getBuiltinCommonTypeName () const {
2123- if (!BuiltinCommonTypeName)
2124- BuiltinCommonTypeName = &Idents.get (" __builtin_common_type" );
2125- return BuiltinCommonTypeName;
2105+ #define BuiltinTemplate (BTName ) \
2106+ IdentifierInfo *get##BTName##Name() const { \
2107+ if (!Name##BTName) \
2108+ Name##BTName = &Idents.get (#BTName); \
2109+ return Name##BTName; \
21262110 }
2111+ #include " clang/Basic/BuiltinTemplates.inc"
21272112
21282113 // / Retrieve the Objective-C "instancetype" type, if already known;
21292114 // / otherwise, returns a NULL type;
0 commit comments