Author: faisalv Date: Mon Jan 1 10:23:28 2018 New Revision: 321628 URL: http://llvm.org/viewvc/llvm-project?rev=321628&view=rev Log: Again reverting an attempt to convert the DeclSpec enums into scoped enums. - reverts r321622, r321625, and r321626. - the use of bit-fields is still resulting in warnings - even though we can use static-asserts to harden the code and ensure the bit-fields are wide enough. The bots still complain of warnings being seen. - to silence the warnings requires specifying the bit-fields with the underlying enum type (as opposed to the enum type itself), which then requires lots of unnecessary static casts of each enumerator within DeclSpec to the underlying-type, which even though could be seen as implementation details, it does hamper readability - and given the additional litterings, makes me question the value of the change.
So in short - I give up (for now at least). Sorry about the noise. Modified: cfe/trunk/include/clang/AST/Type.h cfe/trunk/include/clang/AST/TypeLoc.h cfe/trunk/include/clang/Basic/Specifiers.h cfe/trunk/include/clang/Parse/Parser.h cfe/trunk/include/clang/Sema/DeclSpec.h cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/AST/Type.cpp cfe/trunk/lib/AST/TypeLoc.cpp cfe/trunk/lib/Parse/ParseDecl.cpp cfe/trunk/lib/Parse/ParseDeclCXX.cpp cfe/trunk/lib/Parse/ParseExpr.cpp cfe/trunk/lib/Parse/ParseExprCXX.cpp cfe/trunk/lib/Parse/ParseObjc.cpp cfe/trunk/lib/Parse/Parser.cpp cfe/trunk/lib/Sema/DeclSpec.cpp cfe/trunk/lib/Sema/SemaCodeComplete.cpp cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/lib/Sema/SemaDeclCXX.cpp cfe/trunk/lib/Sema/SemaTemplate.cpp cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp cfe/trunk/lib/Sema/SemaType.cpp cfe/trunk/lib/Serialization/ASTWriter.cpp Modified: cfe/trunk/include/clang/AST/Type.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/include/clang/AST/Type.h (original) +++ cfe/trunk/include/clang/AST/Type.h Mon Jan 1 10:23:28 2018 @@ -4747,11 +4747,11 @@ public: } /// Converts a type specifier (DeclSpec::TST) into an elaborated type keyword. - static ElaboratedTypeKeyword getKeywordForTypeSpec(TypeSpecifierType TypeSpec); + static ElaboratedTypeKeyword getKeywordForTypeSpec(unsigned TypeSpec); /// Converts a type specifier (DeclSpec::TST) into a tag type kind. /// It is an error to provide a type specifier which *isn't* a tag kind here. - static TagTypeKind getTagTypeKindForTypeSpec(TypeSpecifierType TypeSpec); + static TagTypeKind getTagTypeKindForTypeSpec(unsigned TypeSpec); /// Converts a TagTypeKind into an elaborated type keyword. static ElaboratedTypeKeyword getKeywordForTagTypeKind(TagTypeKind Tag); Modified: cfe/trunk/include/clang/AST/TypeLoc.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TypeLoc.h?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/include/clang/AST/TypeLoc.h (original) +++ cfe/trunk/include/clang/AST/TypeLoc.h Mon Jan 1 10:23:28 2018 @@ -598,43 +598,43 @@ public: if (needsExtraLocalData()) return static_cast<TypeSpecifierSign>(getWrittenBuiltinSpecs().Sign); else - return TypeSpecifierSign::TSS_unspecified; + return TSS_unspecified; } bool hasWrittenSignSpec() const { - return getWrittenSignSpec() != TypeSpecifierSign::TSS_unspecified; + return getWrittenSignSpec() != TSS_unspecified; } void setWrittenSignSpec(TypeSpecifierSign written) { if (needsExtraLocalData()) - getWrittenBuiltinSpecs().Sign = static_cast<unsigned char>(written); + getWrittenBuiltinSpecs().Sign = written; } TypeSpecifierWidth getWrittenWidthSpec() const { if (needsExtraLocalData()) return static_cast<TypeSpecifierWidth>(getWrittenBuiltinSpecs().Width); else - return TypeSpecifierWidth::TSW_unspecified; + return TSW_unspecified; } bool hasWrittenWidthSpec() const { - return getWrittenWidthSpec() != TypeSpecifierWidth::TSW_unspecified; + return getWrittenWidthSpec() != TSW_unspecified; } void setWrittenWidthSpec(TypeSpecifierWidth written) { if (needsExtraLocalData()) - getWrittenBuiltinSpecs().Width = static_cast<unsigned char>(written); + getWrittenBuiltinSpecs().Width = written; } TypeSpecifierType getWrittenTypeSpec() const; bool hasWrittenTypeSpec() const { - return getWrittenTypeSpec() != TypeSpecifierType::TST_unspecified; + return getWrittenTypeSpec() != TST_unspecified; } void setWrittenTypeSpec(TypeSpecifierType written) { if (needsExtraLocalData()) - getWrittenBuiltinSpecs().Type = static_cast<unsigned char>(written); + getWrittenBuiltinSpecs().Type = written; } bool hasModeAttr() const { @@ -653,10 +653,9 @@ public: setBuiltinLoc(Loc); if (needsExtraLocalData()) { WrittenBuiltinSpecs &wbs = getWrittenBuiltinSpecs(); - wbs.Sign = static_cast<unsigned char>(TypeSpecifierSign::TSS_unspecified); - wbs.Width = - static_cast<unsigned char>(TypeSpecifierWidth::TSW_unspecified); - wbs.Type = static_cast<unsigned char>(TypeSpecifierType::TST_unspecified); + wbs.Sign = TSS_unspecified; + wbs.Width = TSW_unspecified; + wbs.Type = TST_unspecified; wbs.ModeAttr = false; } } Modified: cfe/trunk/include/clang/Basic/Specifiers.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Specifiers.h?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/include/clang/Basic/Specifiers.h (original) +++ cfe/trunk/include/clang/Basic/Specifiers.h Mon Jan 1 10:23:28 2018 @@ -22,87 +22,71 @@ namespace clang { /// \brief Specifies the width of a type, e.g., short, long, or long long. - enum class TypeSpecifierWidth : unsigned char { + enum TypeSpecifierWidth { TSW_unspecified, TSW_short, TSW_long, - TSW_longlong // This must be the last enumerator (see struct - // WrittenBuiltinSpecs below prior to reordering). + TSW_longlong }; /// \brief Specifies the signedness of a type, e.g., signed or unsigned. - enum class TypeSpecifierSign : unsigned char { + enum TypeSpecifierSign { TSS_unspecified, TSS_signed, - TSS_unsigned // This must be the last enumerator (see struct - // WrittenBuiltinSpecs below prior to reordering). + TSS_unsigned }; - + enum TypeSpecifiersPipe { TSP_unspecified, TSP_pipe }; /// \brief Specifies the kind of type. - enum class TypeSpecifierType : unsigned char { + enum TypeSpecifierType { TST_unspecified, TST_void, TST_char, - TST_wchar, // C++ wchar_t - TST_char16, // C++11 char16_t - TST_char32, // C++11 char32_t + TST_wchar, // C++ wchar_t + TST_char16, // C++11 char16_t + TST_char32, // C++11 char32_t TST_int, TST_int128, - TST_half, // OpenCL half, ARM NEON __fp16 - TST_Float16, // C11 extension ISO/IEC TS 18661-3 + TST_half, // OpenCL half, ARM NEON __fp16 + TST_Float16, // C11 extension ISO/IEC TS 18661-3 TST_float, TST_double, TST_float128, - TST_bool, // _Bool - TST_decimal32, // _Decimal32 - TST_decimal64, // _Decimal64 - TST_decimal128, // _Decimal128 + TST_bool, // _Bool + TST_decimal32, // _Decimal32 + TST_decimal64, // _Decimal64 + TST_decimal128, // _Decimal128 TST_enum, TST_union, TST_struct, - TST_class, // C++ class type - TST_interface, // C++ (Microsoft-specific) __interface type - TST_typename, // Typedef, C++ class-name or enum name, etc. + TST_class, // C++ class type + TST_interface, // C++ (Microsoft-specific) __interface type + TST_typename, // Typedef, C++ class-name or enum name, etc. TST_typeofType, TST_typeofExpr, - TST_decltype, // C++11 decltype - TST_underlyingType, // __underlying_type for C++11 - TST_auto, // C++11 auto - TST_decltype_auto, // C++1y decltype(auto) - TST_auto_type, // __auto_type extension - TST_unknown_anytype, // __unknown_anytype extension - TST_atomic, // C11 _Atomic + TST_decltype, // C++11 decltype + TST_underlyingType, // __underlying_type for C++11 + TST_auto, // C++11 auto + TST_decltype_auto, // C++1y decltype(auto) + TST_auto_type, // __auto_type extension + TST_unknown_anytype, // __unknown_anytype extension + TST_atomic, // C11 _Atomic #define GENERIC_IMAGE_TYPE(ImgType, Id) TST_##ImgType##_t, // OpenCL image types #include "clang/Basic/OpenCLImageTypes.def" - TST_error // erroneous type -- Additionally, this must be the last - // enumerator (see struct WrittenBuiltinSpecs below prior to - // reordering). + TST_error // erroneous type }; /// \brief Structure that packs information about the type specifiers that /// were written in a particular type specifier sequence. struct WrittenBuiltinSpecs { - - static_assert(static_cast<unsigned int>(TypeSpecifierType::TST_error) < - (1 << 6), - "Type bitfield not wide enough for TST"); - /*DeclSpec::TST*/ unsigned Type : 6; - - static_assert(static_cast<unsigned int>(TypeSpecifierSign::TSS_unsigned) < - (1 << 2), - "Type bitfield not wide enough for TSS"); - /*DeclSpec::TSS*/ unsigned Sign : 2; - - static_assert(static_cast<unsigned int>(TypeSpecifierWidth::TSW_longlong) < - (1 << 2), - "Type bitfield not wide enough for TSW"); + static_assert(TST_error < 1 << 6, "Type bitfield not wide enough for TST"); + /*DeclSpec::TST*/ unsigned Type : 6; + /*DeclSpec::TSS*/ unsigned Sign : 2; /*DeclSpec::TSW*/ unsigned Width : 2; - unsigned ModeAttr : 1; }; Modified: cfe/trunk/include/clang/Parse/Parser.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/include/clang/Parse/Parser.h (original) +++ cfe/trunk/include/clang/Parse/Parser.h Mon Jan 1 10:23:28 2018 @@ -828,8 +828,7 @@ private: }; /// \brief Consume any extra semi-colons until the end of the line. - void ConsumeExtraSemi(ExtraSemiKind Kind, - TypeSpecifierType TST = TypeSpecifierType::TST_unspecified); + void ConsumeExtraSemi(ExtraSemiKind Kind, unsigned TST = TST_unspecified); /// Return false if the next token is an identifier. An 'expected identifier' /// error is emitted otherwise. @@ -1976,7 +1975,7 @@ private: const ParsedTemplateInfo &TemplateInfo, AccessSpecifier AS, DeclSpecContext DSC); void ParseEnumBody(SourceLocation StartLoc, Decl *TagDecl); - void ParseStructUnionBody(SourceLocation StartLoc, TypeSpecifierType TagType, + void ParseStructUnionBody(SourceLocation StartLoc, unsigned TagType, Decl *TagDecl); void ParseStructDeclaration( @@ -2576,12 +2575,12 @@ private: ParsedAttributesWithRange &Attributes); void SkipCXXMemberSpecification(SourceLocation StartLoc, SourceLocation AttrFixitLoc, - TypeSpecifierType TagType, + unsigned TagType, Decl *TagDecl); void ParseCXXMemberSpecification(SourceLocation StartLoc, SourceLocation AttrFixitLoc, ParsedAttributesWithRange &Attrs, - TypeSpecifierType TagType, + unsigned TagType, Decl *TagDecl); ExprResult ParseCXXMemberInitializer(Decl *D, bool IsFunction, SourceLocation &EqualLoc); Modified: cfe/trunk/include/clang/Sema/DeclSpec.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/include/clang/Sema/DeclSpec.h (original) +++ cfe/trunk/include/clang/Sema/DeclSpec.h Mon Jan 1 10:23:28 2018 @@ -250,10 +250,10 @@ public: // Import type specifier width enumeration and constants. typedef TypeSpecifierWidth TSW; - static const TSW TSW_unspecified = TypeSpecifierWidth::TSW_unspecified; - static const TSW TSW_short = TypeSpecifierWidth::TSW_short; - static const TSW TSW_long = TypeSpecifierWidth::TSW_long; - static const TSW TSW_longlong = TypeSpecifierWidth::TSW_longlong; + static const TSW TSW_unspecified = clang::TSW_unspecified; + static const TSW TSW_short = clang::TSW_short; + static const TSW TSW_long = clang::TSW_long; + static const TSW TSW_longlong = clang::TSW_longlong; enum TSC { TSC_unspecified, @@ -263,48 +263,48 @@ public: // Import type specifier sign enumeration and constants. typedef TypeSpecifierSign TSS; - static const TSS TSS_unspecified = TypeSpecifierSign::TSS_unspecified; - static const TSS TSS_signed = TypeSpecifierSign::TSS_signed; - static const TSS TSS_unsigned = TypeSpecifierSign::TSS_unsigned; + static const TSS TSS_unspecified = clang::TSS_unspecified; + static const TSS TSS_signed = clang::TSS_signed; + static const TSS TSS_unsigned = clang::TSS_unsigned; // Import type specifier type enumeration and constants. typedef TypeSpecifierType TST; - static const TST TST_unspecified = TypeSpecifierType::TST_unspecified; - static const TST TST_void = TypeSpecifierType::TST_void; - static const TST TST_char = TypeSpecifierType::TST_char; - static const TST TST_wchar = TypeSpecifierType::TST_wchar; - static const TST TST_char16 = TypeSpecifierType::TST_char16; - static const TST TST_char32 = TypeSpecifierType::TST_char32; - static const TST TST_int = TypeSpecifierType::TST_int; - static const TST TST_int128 = TypeSpecifierType::TST_int128; - static const TST TST_half = TypeSpecifierType::TST_half; - static const TST TST_float = TypeSpecifierType::TST_float; - static const TST TST_double = TypeSpecifierType::TST_double; - static const TST TST_float16 = TypeSpecifierType::TST_Float16; - static const TST TST_float128 = TypeSpecifierType::TST_float128; - static const TST TST_bool = TypeSpecifierType::TST_bool; - static const TST TST_decimal32 = TypeSpecifierType::TST_decimal32; - static const TST TST_decimal64 = TypeSpecifierType::TST_decimal64; - static const TST TST_decimal128 = TypeSpecifierType::TST_decimal128; - static const TST TST_enum = TypeSpecifierType::TST_enum; - static const TST TST_union = TypeSpecifierType::TST_union; - static const TST TST_struct = TypeSpecifierType::TST_struct; - static const TST TST_interface = TypeSpecifierType::TST_interface; - static const TST TST_class = TypeSpecifierType::TST_class; - static const TST TST_typename = TypeSpecifierType::TST_typename; - static const TST TST_typeofType = TypeSpecifierType::TST_typeofType; - static const TST TST_typeofExpr = TypeSpecifierType::TST_typeofExpr; - static const TST TST_decltype = TypeSpecifierType::TST_decltype; - static const TST TST_decltype_auto = TypeSpecifierType::TST_decltype_auto; - static const TST TST_underlyingType = TypeSpecifierType::TST_underlyingType; - static const TST TST_auto = TypeSpecifierType::TST_auto; - static const TST TST_auto_type = TypeSpecifierType::TST_auto_type; - static const TST TST_unknown_anytype = TypeSpecifierType::TST_unknown_anytype; - static const TST TST_atomic = TypeSpecifierType::TST_atomic; + static const TST TST_unspecified = clang::TST_unspecified; + static const TST TST_void = clang::TST_void; + static const TST TST_char = clang::TST_char; + static const TST TST_wchar = clang::TST_wchar; + static const TST TST_char16 = clang::TST_char16; + static const TST TST_char32 = clang::TST_char32; + static const TST TST_int = clang::TST_int; + static const TST TST_int128 = clang::TST_int128; + static const TST TST_half = clang::TST_half; + static const TST TST_float = clang::TST_float; + static const TST TST_double = clang::TST_double; + static const TST TST_float16 = clang::TST_Float16; + static const TST TST_float128 = clang::TST_float128; + static const TST TST_bool = clang::TST_bool; + static const TST TST_decimal32 = clang::TST_decimal32; + static const TST TST_decimal64 = clang::TST_decimal64; + static const TST TST_decimal128 = clang::TST_decimal128; + static const TST TST_enum = clang::TST_enum; + static const TST TST_union = clang::TST_union; + static const TST TST_struct = clang::TST_struct; + static const TST TST_interface = clang::TST_interface; + static const TST TST_class = clang::TST_class; + static const TST TST_typename = clang::TST_typename; + static const TST TST_typeofType = clang::TST_typeofType; + static const TST TST_typeofExpr = clang::TST_typeofExpr; + static const TST TST_decltype = clang::TST_decltype; + static const TST TST_decltype_auto = clang::TST_decltype_auto; + static const TST TST_underlyingType = clang::TST_underlyingType; + static const TST TST_auto = clang::TST_auto; + static const TST TST_auto_type = clang::TST_auto_type; + static const TST TST_unknown_anytype = clang::TST_unknown_anytype; + static const TST TST_atomic = clang::TST_atomic; #define GENERIC_IMAGE_TYPE(ImgType, Id) \ - static const TST TST_##ImgType##_t = TypeSpecifierType::TST_##ImgType##_t; + static const TST TST_##ImgType##_t = clang::TST_##ImgType##_t; #include "clang/Basic/OpenCLImageTypes.def" - static const TST TST_error = TypeSpecifierType::TST_error; + static const TST TST_error = clang::TST_error; // type-qualifiers enum TQ { // NOTE: These flags must be kept in sync with Qualifiers::TQ. @@ -335,10 +335,10 @@ private: unsigned SCS_extern_in_linkage_spec : 1; // type-specifier - /*TSW*/TypeSpecifierWidth TypeSpecWidth : 2; + /*TSW*/unsigned TypeSpecWidth : 2; /*TSC*/unsigned TypeSpecComplex : 2; - /*TSS*/TypeSpecifierSign TypeSpecSign : 2; - /*TST*/TypeSpecifierType TypeSpecType : 6; + /*TSS*/unsigned TypeSpecSign : 2; + /*TST*/unsigned TypeSpecType : 6; unsigned TypeAltiVecVector : 1; unsigned TypeAltiVecPixel : 1; unsigned TypeAltiVecBool : 1; Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Mon Jan 1 10:23:28 2018 @@ -2182,7 +2182,7 @@ public: TUK_Friend // Friend declaration: 'friend struct foo;' }; - Decl *ActOnTag(Scope *S, TypeSpecifierType TagSpec, TagUseKind TUK, + Decl *ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, AccessSpecifier AS, SourceLocation ModulePrivateLoc, @@ -2193,14 +2193,14 @@ public: SkipBodyInfo *SkipBody = nullptr); Decl *ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc, - TypeSpecifierType TagSpec, SourceLocation TagLoc, + unsigned TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, MultiTemplateParamsArg TempParamLists); TypeResult ActOnDependentTag(Scope *S, - TypeSpecifierType TagSpec, + unsigned TagSpec, TagUseKind TUK, const CXXScopeSpec &SS, IdentifierInfo *Name, @@ -6123,14 +6123,17 @@ public: ArrayRef<TemplateParameterList *> ParamLists, bool IsFriend, bool &IsMemberSpecialization, bool &Invalid); - DeclResult CheckClassTemplate( - Scope *S, TypeSpecifierType TagSpec, TagUseKind TUK, SourceLocation KWLoc, - CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, - AttributeList *Attr, TemplateParameterList *TemplateParams, - AccessSpecifier AS, SourceLocation ModulePrivateLoc, - SourceLocation FriendLoc, unsigned NumOuterTemplateParamLists, - TemplateParameterList **OuterTemplateParamLists, - SkipBodyInfo *SkipBody = nullptr); + DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, + SourceLocation KWLoc, CXXScopeSpec &SS, + IdentifierInfo *Name, SourceLocation NameLoc, + AttributeList *Attr, + TemplateParameterList *TemplateParams, + AccessSpecifier AS, + SourceLocation ModulePrivateLoc, + SourceLocation FriendLoc, + unsigned NumOuterTemplateParamLists, + TemplateParameterList **OuterTemplateParamLists, + SkipBodyInfo *SkipBody = nullptr); TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg, QualType NTTPType, @@ -6201,7 +6204,7 @@ public: TemplateTy &Template, bool AllowInjectedClassName = false); DeclResult - ActOnClassTemplateSpecialization(Scope *S, TypeSpecifierType TagSpec, TagUseKind TUK, + ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, SourceLocation ModulePrivateLoc, TemplateIdAnnotation &TemplateId, @@ -6244,7 +6247,7 @@ public: ActOnExplicitInstantiation(Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc, - TypeSpecifierType TagSpec, + unsigned TagSpec, SourceLocation KWLoc, const CXXScopeSpec &SS, TemplateTy Template, @@ -6258,7 +6261,7 @@ public: ActOnExplicitInstantiation(Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc, - TypeSpecifierType TagSpec, + unsigned TagSpec, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, @@ -10152,7 +10155,7 @@ public: SourceLocation OpLoc, bool IsArrow, bool IsBaseExprStatement); void CodeCompletePostfixExpression(Scope *S, ExprResult LHS); - void CodeCompleteTag(Scope *S, TypeSpecifierType TagSpec); + void CodeCompleteTag(Scope *S, unsigned TagSpec); void CodeCompleteTypeQualifiers(DeclSpec &DS); void CodeCompleteFunctionQualifiers(DeclSpec &DS, Declarator &D, const VirtSpecifiers *VS = nullptr); Modified: cfe/trunk/lib/AST/Type.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/AST/Type.cpp (original) +++ cfe/trunk/lib/AST/Type.cpp Mon Jan 1 10:23:28 2018 @@ -2436,41 +2436,29 @@ bool Type::isSpecifierType() const { } ElaboratedTypeKeyword -TypeWithKeyword::getKeywordForTypeSpec(TypeSpecifierType TypeSpec) { +TypeWithKeyword::getKeywordForTypeSpec(unsigned TypeSpec) { switch (TypeSpec) { - default: - return ETK_None; - case TypeSpecifierType::TST_typename: - return ETK_Typename; - case TypeSpecifierType::TST_class: - return ETK_Class; - case TypeSpecifierType::TST_struct: - return ETK_Struct; - case TypeSpecifierType::TST_interface: - return ETK_Interface; - case TypeSpecifierType::TST_union: - return ETK_Union; - case TypeSpecifierType::TST_enum: - return ETK_Enum; + default: return ETK_None; + case TST_typename: return ETK_Typename; + case TST_class: return ETK_Class; + case TST_struct: return ETK_Struct; + case TST_interface: return ETK_Interface; + case TST_union: return ETK_Union; + case TST_enum: return ETK_Enum; } } TagTypeKind -TypeWithKeyword::getTagTypeKindForTypeSpec(TypeSpecifierType TypeSpec) { - switch (TypeSpec) { - default: - llvm_unreachable("Type specifier is not a tag type kind."); - case TypeSpecifierType::TST_class: - return TTK_Class; - case TypeSpecifierType::TST_struct: - return TTK_Struct; - case TypeSpecifierType::TST_interface: - return TTK_Interface; - case TypeSpecifierType::TST_union: - return TTK_Union; - case TypeSpecifierType::TST_enum: - return TTK_Enum; +TypeWithKeyword::getTagTypeKindForTypeSpec(unsigned TypeSpec) { + switch(TypeSpec) { + case TST_class: return TTK_Class; + case TST_struct: return TTK_Struct; + case TST_interface: return TTK_Interface; + case TST_union: return TTK_Union; + case TST_enum: return TTK_Enum; } + + llvm_unreachable("Type specifier is not a tag type kind."); } ElaboratedTypeKeyword Modified: cfe/trunk/lib/AST/TypeLoc.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypeLoc.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/AST/TypeLoc.cpp (original) +++ cfe/trunk/lib/AST/TypeLoc.cpp Mon Jan 1 10:23:28 2018 @@ -311,19 +311,19 @@ TypeSpecifierType BuiltinTypeLoc::getWri return static_cast<TypeSpecifierType>(getWrittenBuiltinSpecs().Type); switch (getTypePtr()->getKind()) { case BuiltinType::Void: - return TypeSpecifierType::TST_void; + return TST_void; case BuiltinType::Bool: - return TypeSpecifierType::TST_bool; + return TST_bool; case BuiltinType::Char_U: case BuiltinType::Char_S: - return TypeSpecifierType::TST_char; + return TST_char; case BuiltinType::Char16: - return TypeSpecifierType::TST_char16; + return TST_char16; case BuiltinType::Char32: - return TypeSpecifierType::TST_char32; + return TST_char32; case BuiltinType::WChar_S: case BuiltinType::WChar_U: - return TypeSpecifierType::TST_wchar; + return TST_wchar; case BuiltinType::UChar: case BuiltinType::UShort: case BuiltinType::UInt: @@ -365,7 +365,7 @@ TypeSpecifierType BuiltinTypeLoc::getWri case BuiltinType::OCLReserveID: case BuiltinType::BuiltinFn: case BuiltinType::OMPArraySection: - return TypeSpecifierType::TST_unspecified; + return TST_unspecified; } llvm_unreachable("Invalid BuiltinType Kind!"); Modified: cfe/trunk/lib/Parse/ParseDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseDecl.cpp (original) +++ cfe/trunk/lib/Parse/ParseDecl.cpp Mon Jan 1 10:23:28 2018 @@ -3139,7 +3139,7 @@ void Parser::ParseDeclarationSpecifiers( // static const bool __is_signed; // // then treat __is_signed as an identifier rather than as a keyword. - if (DS.getTypeSpecType() == TypeSpecifierType::TST_bool && + if (DS.getTypeSpecType() == TST_bool && DS.getTypeQualifiers() == DeclSpec::TQ_const && DS.getStorageClassSpec() == DeclSpec::SCS_static) TryKeywordIdentFallback(true); @@ -3614,7 +3614,7 @@ void Parser::ParseDeclarationSpecifiers( break; #include "clang/Basic/OpenCLImageTypes.def" case tok::kw___unknown_anytype: - isInvalid = DS.SetTypeSpecType(TypeSpecifierType::TST_unknown_anytype, Loc, + isInvalid = DS.SetTypeSpecType(TST_unknown_anytype, Loc, PrevSpec, DiagID, Policy); break; @@ -3888,7 +3888,7 @@ void Parser::ParseStructDeclaration( /// [OBC] '@' 'defs' '(' class-name ')' /// void Parser::ParseStructUnionBody(SourceLocation RecordLoc, - TypeSpecifierType TagType, Decl *TagDecl) { + unsigned TagType, Decl *TagDecl) { PrettyDeclStackTraceEntry CrashInfo(Actions, TagDecl, RecordLoc, "parsing struct/union body"); assert(!getLangOpts().CPlusPlus && "C++ declarations not supported"); @@ -5527,7 +5527,7 @@ void Parser::ParseDirectDeclarator(Decla NextToken().is(tok::r_paren) && !D.hasGroupingParens() && !Actions.containsUnexpandedParameterPacks(D) && - D.getDeclSpec().getTypeSpecType() != TypeSpecifierType::TST_auto)) { + D.getDeclSpec().getTypeSpecType() != TST_auto)) { SourceLocation EllipsisLoc = ConsumeToken(); if (isPtrOperatorToken(Tok.getKind(), getLangOpts(), D.getContext())) { // The ellipsis was put in the wrong place. Recover, and explain to @@ -6107,7 +6107,7 @@ void Parser::ParseFunctionDeclarator(Dec LocalEndLoc = EndLoc; if (getLangOpts().CPlusPlus11 && Tok.is(tok::arrow)) { Diag(Tok, diag::warn_cxx98_compat_trailing_return_type); - if (D.getDeclSpec().getTypeSpecType() == TypeSpecifierType::TST_auto) + if (D.getDeclSpec().getTypeSpecType() == TST_auto) StartLoc = D.getDeclSpec().getTypeSpecTypeLoc(); LocalEndLoc = Tok.getLocation(); SourceRange Range; Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original) +++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Mon Jan 1 10:23:28 2018 @@ -1011,12 +1011,10 @@ void Parser::AnnotateExistingDecltypeSpe PP.EnterToken(Tok); Tok.setKind(tok::annot_decltype); - setExprAnnotation(Tok, DS.getTypeSpecType() == TypeSpecifierType::TST_decltype - ? DS.getRepAsExpr() - : DS.getTypeSpecType() == - TypeSpecifierType::TST_decltype_auto - ? ExprResult() - : ExprError()); + setExprAnnotation(Tok, + DS.getTypeSpecType() == TST_decltype ? DS.getRepAsExpr() : + DS.getTypeSpecType() == TST_decltype_auto ? ExprResult() : + ExprError()); Tok.setAnnotationEndLoc(EndLoc); Tok.setLocation(StartLoc); PP.AnnotateCachedTokens(Tok); @@ -1196,8 +1194,8 @@ TypeResult Parser::ParseBaseTypeSpecifie const char *PrevSpec = nullptr; unsigned DiagID; - DS.SetTypeSpecType(TypeSpecifierType::TST_typename, IdLoc, PrevSpec, DiagID, - Type, Actions.getASTContext().getPrintingPolicy()); + DS.SetTypeSpecType(TST_typename, IdLoc, PrevSpec, DiagID, Type, + Actions.getASTContext().getPrintingPolicy()); Declarator DeclaratorInfo(DS, DeclaratorContext::TypeNameContext); return Actions.ActOnTypeName(getCurScope(), DeclaratorInfo); @@ -2954,8 +2952,7 @@ ExprResult Parser::ParseCXXMemberInitial void Parser::SkipCXXMemberSpecification(SourceLocation RecordLoc, SourceLocation AttrFixitLoc, - TypeSpecifierType TagType, - Decl *TagDecl) { + unsigned TagType, Decl *TagDecl) { // Skip the optional 'final' keyword. if (getLangOpts().CPlusPlus && Tok.is(tok::identifier)) { assert(isCXX11FinalKeyword() && "not a class definition"); @@ -3107,12 +3104,11 @@ Parser::DeclGroupPtrTy Parser::ParseCXXC void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc, SourceLocation AttrFixitLoc, ParsedAttributesWithRange &Attrs, - TypeSpecifierType TagType, - Decl *TagDecl) { + unsigned TagType, Decl *TagDecl) { assert((TagType == DeclSpec::TST_struct || - TagType == DeclSpec::TST_interface || - TagType == DeclSpec::TST_union || TagType == DeclSpec::TST_class) && - "Invalid TagType!"); + TagType == DeclSpec::TST_interface || + TagType == DeclSpec::TST_union || + TagType == DeclSpec::TST_class) && "Invalid TagType!"); PrettyDeclStackTraceEntry CrashInfo(Actions, TagDecl, RecordLoc, "parsing struct/union/class body"); Modified: cfe/trunk/lib/Parse/ParseExpr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseExpr.cpp (original) +++ cfe/trunk/lib/Parse/ParseExpr.cpp Mon Jan 1 10:23:28 2018 @@ -997,10 +997,9 @@ ExprResult Parser::ParseCastExpression(b DS.SetRangeEnd(ILoc); const char *PrevSpec = nullptr; unsigned DiagID; - DS.SetTypeSpecType(TypeSpecifierType::TST_typename, ILoc, PrevSpec, - DiagID, Typ, + DS.SetTypeSpecType(TST_typename, ILoc, PrevSpec, DiagID, Typ, Actions.getASTContext().getPrintingPolicy()); - + Declarator DeclaratorInfo(DS, DeclaratorContext::TypeNameContext); TypeResult Ty = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo); @@ -1206,8 +1205,8 @@ ExprResult Parser::ParseCastExpression(b const char *PrevSpec = nullptr; unsigned DiagID; - DS.SetTypeSpecType(TypeSpecifierType::TST_typename, - Tok.getAnnotationEndLoc(), PrevSpec, DiagID, Type, + DS.SetTypeSpecType(TST_typename, Tok.getAnnotationEndLoc(), + PrevSpec, DiagID, Type, Actions.getASTContext().getPrintingPolicy()); Declarator DeclaratorInfo(DS, DeclaratorContext::TypeNameContext); Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original) +++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Mon Jan 1 10:23:28 2018 @@ -1551,7 +1551,7 @@ Parser::ParseCXXPseudoDestructor(Expr *B if (Tok.is(tok::kw_decltype) && !FirstTypeName.isValid() && SS.isEmpty()) { DeclSpec DS(AttrFactory); ParseDecltypeSpecifier(DS); - if (DS.getTypeSpecType() == TypeSpecifierType::TST_error) + if (DS.getTypeSpecType() == TST_error) return ExprError(); return Actions.ActOnPseudoDestructorExpr(getCurScope(), Base, OpLoc, OpKind, TildeLoc, DS); Modified: cfe/trunk/lib/Parse/ParseObjc.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/Parse/ParseObjc.cpp (original) +++ cfe/trunk/lib/Parse/ParseObjc.cpp Mon Jan 1 10:23:28 2018 @@ -1699,9 +1699,8 @@ void Parser::parseObjCTypeArgsOrProtocol DeclSpec DS(AttrFactory); const char *prevSpec = nullptr; unsigned diagID; - DS.SetTypeSpecType(TypeSpecifierType::TST_typename, identifierLocs[i], - prevSpec, diagID, typeArg, - Actions.getASTContext().getPrintingPolicy()); + DS.SetTypeSpecType(TST_typename, identifierLocs[i], prevSpec, diagID, + typeArg, Actions.getASTContext().getPrintingPolicy()); // Form a declarator to turn this into a type. Declarator D(DS, DeclaratorContext::TypeNameContext); Modified: cfe/trunk/lib/Parse/Parser.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/Parse/Parser.cpp (original) +++ cfe/trunk/lib/Parse/Parser.cpp Mon Jan 1 10:23:28 2018 @@ -174,7 +174,7 @@ bool Parser::ExpectAndConsumeSemi(unsign return ExpectAndConsume(tok::semi, DiagID); } -void Parser::ConsumeExtraSemi(ExtraSemiKind Kind, TypeSpecifierType TST) { +void Parser::ConsumeExtraSemi(ExtraSemiKind Kind, unsigned TST) { if (!Tok.is(tok::semi)) return; bool HadMultipleSemis = false; Modified: cfe/trunk/lib/Sema/DeclSpec.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/Sema/DeclSpec.cpp (original) +++ cfe/trunk/lib/Sema/DeclSpec.cpp Mon Jan 1 10:23:28 2018 @@ -324,52 +324,51 @@ bool Declarator::isDeclarationOfFunction } switch (DS.getTypeSpecType()) { - case TypeSpecifierType::TST_atomic: - case TypeSpecifierType::TST_auto: - case TypeSpecifierType::TST_auto_type: - case TypeSpecifierType::TST_bool: - case TypeSpecifierType::TST_char: - case TypeSpecifierType::TST_char16: - case TypeSpecifierType::TST_char32: - case TypeSpecifierType::TST_class: - case TypeSpecifierType::TST_decimal128: - case TypeSpecifierType::TST_decimal32: - case TypeSpecifierType::TST_decimal64: - case TypeSpecifierType::TST_double: - case TypeSpecifierType::TST_Float16: - case TypeSpecifierType::TST_float128: - case TypeSpecifierType::TST_enum: - case TypeSpecifierType::TST_error: - case TypeSpecifierType::TST_float: - case TypeSpecifierType::TST_half: - case TypeSpecifierType::TST_int: - case TypeSpecifierType::TST_int128: - case TypeSpecifierType::TST_struct: - case TypeSpecifierType::TST_interface: - case TypeSpecifierType::TST_union: - case TypeSpecifierType::TST_unknown_anytype: - case TypeSpecifierType::TST_unspecified: - case TypeSpecifierType::TST_void: - case TypeSpecifierType::TST_wchar: -#define GENERIC_IMAGE_TYPE(ImgType, Id) \ - case TypeSpecifierType::TST_##ImgType##_t: + case TST_atomic: + case TST_auto: + case TST_auto_type: + case TST_bool: + case TST_char: + case TST_char16: + case TST_char32: + case TST_class: + case TST_decimal128: + case TST_decimal32: + case TST_decimal64: + case TST_double: + case TST_Float16: + case TST_float128: + case TST_enum: + case TST_error: + case TST_float: + case TST_half: + case TST_int: + case TST_int128: + case TST_struct: + case TST_interface: + case TST_union: + case TST_unknown_anytype: + case TST_unspecified: + case TST_void: + case TST_wchar: +#define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t: #include "clang/Basic/OpenCLImageTypes.def" return false; - case TypeSpecifierType::TST_decltype_auto: + case TST_decltype_auto: // This must have an initializer, so can't be a function declaration, // even if the initializer has function type. return false; - case TypeSpecifierType::TST_decltype: - case TypeSpecifierType::TST_typeofExpr: + case TST_decltype: + case TST_typeofExpr: if (Expr *E = DS.getRepAsExpr()) return E->getType()->isFunctionType(); return false; - case TypeSpecifierType::TST_underlyingType: - case TypeSpecifierType::TST_typename: - case TypeSpecifierType::TST_typeofType: { + case TST_underlyingType: + case TST_typename: + case TST_typeofType: { QualType QT = DS.getRepAsType().get(); if (QT.isNull()) return false; @@ -499,8 +498,7 @@ const char *DeclSpec::getSpecifierName(D case DeclSpec::TST_unspecified: return "unspecified"; case DeclSpec::TST_void: return "void"; case DeclSpec::TST_char: return "char"; - case DeclSpec::TST_wchar: - return Policy.MSWChar ? "__wchar_t" : "wchar_t"; + case DeclSpec::TST_wchar: return Policy.MSWChar ? "__wchar_t" : "wchar_t"; case DeclSpec::TST_char16: return "char16_t"; case DeclSpec::TST_char32: return "char32_t"; case DeclSpec::TST_int: return "int"; @@ -972,9 +970,9 @@ bool DeclSpec::SetConstexprSpec(SourceLo } void DeclSpec::SaveWrittenBuiltinSpecs() { - writtenBS.Sign = static_cast<unsigned char>(getTypeSpecSign()); - writtenBS.Width = static_cast<unsigned char>(getTypeSpecWidth()); - writtenBS.Type = static_cast<unsigned char>(getTypeSpecType()); + writtenBS.Sign = getTypeSpecSign(); + writtenBS.Width = getTypeSpecWidth(); + writtenBS.Type = getTypeSpecType(); // Search the list of attributes for the presence of a mode attribute. writtenBS.ModeAttr = false; AttributeList* attrs = getAttributes().getList(); @@ -1112,7 +1110,7 @@ void DeclSpec::Finish(Sema &S, const Pri } // Validate the width of the type. - switch (static_cast<TypeSpecifierWidth>(TypeSpecWidth)) { + switch (TypeSpecWidth) { case TSW_unspecified: break; case TSW_short: // short int case TSW_longlong: // long long int Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original) +++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Mon Jan 1 10:23:28 2018 @@ -4088,7 +4088,7 @@ void Sema::CodeCompleteObjCClassProperty Results.data(), Results.size()); } -void Sema::CodeCompleteTag(Scope *S, TypeSpecifierType TagSpec) { +void Sema::CodeCompleteTag(Scope *S, unsigned TagSpec) { if (!CodeCompleter) return; Modified: cfe/trunk/lib/Sema/SemaDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaDecl.cpp (original) +++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Jan 1 10:23:28 2018 @@ -12786,11 +12786,11 @@ TypedefDecl *Sema::ParseTypedefDecl(Scop // class type (or enum type) for linkage purposes only. // We need to check whether the type was declared in the declaration. switch (D.getDeclSpec().getTypeSpecType()) { - case TypeSpecifierType::TST_enum: - case TypeSpecifierType::TST_struct: - case TypeSpecifierType::TST_interface: - case TypeSpecifierType::TST_union: - case TypeSpecifierType::TST_class: { + case TST_enum: + case TST_struct: + case TST_interface: + case TST_union: + case TST_class: { TagDecl *tagFromDeclSpec = cast<TagDecl>(D.getDeclSpec().getRepAsDecl()); setTagNameForLinkagePurposes(tagFromDeclSpec, NewTD); break; @@ -13074,7 +13074,7 @@ static bool isAcceptableTagRedeclContext /// /// \param SkipBody If non-null, will be set to indicate if the caller should /// skip the definition of this tag and treat it as if it were a declaration. -Decl *Sema::ActOnTag(Scope *S, TypeSpecifierType TagSpec, TagUseKind TUK, +Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, AccessSpecifier AS, Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Jan 1 10:23:28 2018 @@ -3775,9 +3775,9 @@ Sema::BuildMemInitializer(Decl *Construc if (TemplateTypeTy) { BaseType = GetTypeFromParser(TemplateTypeTy, &TInfo); - } else if (DS.getTypeSpecType() == TypeSpecifierType::TST_decltype) { + } else if (DS.getTypeSpecType() == TST_decltype) { BaseType = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc()); - } else if (DS.getTypeSpecType() == TypeSpecifierType::TST_decltype_auto) { + } else if (DS.getTypeSpecType() == TST_decltype_auto) { Diag(DS.getTypeSpecTypeLoc(), diag::err_decltype_auto_invalid); return true; } else { @@ -13480,10 +13480,11 @@ FriendDecl *Sema::CheckFriendTypeDecl(So /// Handle a friend tag declaration where the scope specifier was /// templated. Decl *Sema::ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc, - TypeSpecifierType TagSpec, - SourceLocation TagLoc, CXXScopeSpec &SS, + unsigned TagSpec, SourceLocation TagLoc, + CXXScopeSpec &SS, IdentifierInfo *Name, - SourceLocation NameLoc, AttributeList *Attr, + SourceLocation NameLoc, + AttributeList *Attr, MultiTemplateParamsArg TempParamLists) { TagTypeKind Kind = TypeWithKeyword::getTagTypeKindForTypeSpec(TagSpec); Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaTemplate.cpp (original) +++ cfe/trunk/lib/Sema/SemaTemplate.cpp Mon Jan 1 10:23:28 2018 @@ -1152,7 +1152,7 @@ static void SetNestedNameSpecifier(TagDe } DeclResult -Sema::CheckClassTemplate(Scope *S, TypeSpecifierType TagSpec, TagUseKind TUK, +Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, AttributeList *Attr, @@ -7336,7 +7336,7 @@ bool Sema::CheckTemplatePartialSpecializ } DeclResult -Sema::ActOnClassTemplateSpecialization(Scope *S, TypeSpecifierType TagSpec, +Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, SourceLocation ModulePrivateLoc, @@ -8506,7 +8506,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc, - TypeSpecifierType TagSpec, + unsigned TagSpec, SourceLocation KWLoc, const CXXScopeSpec &SS, TemplateTy TemplateD, @@ -8794,7 +8794,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc, - TypeSpecifierType TagSpec, + unsigned TagSpec, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, @@ -9310,7 +9310,7 @@ DeclResult Sema::ActOnExplicitInstantiat } TypeResult -Sema::ActOnDependentTag(Scope *S, TypeSpecifierType TagSpec, TagUseKind TUK, +Sema::ActOnDependentTag(Scope *S, unsigned TagSpec, TagUseKind TUK, const CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation TagLoc, SourceLocation NameLoc) { // This has to hold, because SS is expected to be defined. Modified: cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp (original) +++ cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp Mon Jan 1 10:23:28 2018 @@ -791,53 +791,52 @@ Optional<unsigned> Sema::getNumArguments bool Sema::containsUnexpandedParameterPacks(Declarator &D) { const DeclSpec &DS = D.getDeclSpec(); switch (DS.getTypeSpecType()) { - case TypeSpecifierType::TST_typename: - case TypeSpecifierType::TST_typeofType: - case TypeSpecifierType::TST_underlyingType: - case TypeSpecifierType::TST_atomic: { + case TST_typename: + case TST_typeofType: + case TST_underlyingType: + case TST_atomic: { QualType T = DS.getRepAsType().get(); if (!T.isNull() && T->containsUnexpandedParameterPack()) return true; break; } - case TypeSpecifierType::TST_typeofExpr: - case TypeSpecifierType::TST_decltype: + case TST_typeofExpr: + case TST_decltype: if (DS.getRepAsExpr() && DS.getRepAsExpr()->containsUnexpandedParameterPack()) return true; break; - case TypeSpecifierType::TST_unspecified: - case TypeSpecifierType::TST_void: - case TypeSpecifierType::TST_char: - case TypeSpecifierType::TST_wchar: - case TypeSpecifierType::TST_char16: - case TypeSpecifierType::TST_char32: - case TypeSpecifierType::TST_int: - case TypeSpecifierType::TST_int128: - case TypeSpecifierType::TST_half: - case TypeSpecifierType::TST_float: - case TypeSpecifierType::TST_double: - case TypeSpecifierType::TST_Float16: - case TypeSpecifierType::TST_float128: - case TypeSpecifierType::TST_bool: - case TypeSpecifierType::TST_decimal32: - case TypeSpecifierType::TST_decimal64: - case TypeSpecifierType::TST_decimal128: - case TypeSpecifierType::TST_enum: - case TypeSpecifierType::TST_union: - case TypeSpecifierType::TST_struct: - case TypeSpecifierType::TST_interface: - case TypeSpecifierType::TST_class: - case TypeSpecifierType::TST_auto: - case TypeSpecifierType::TST_auto_type: - case TypeSpecifierType::TST_decltype_auto: -#define GENERIC_IMAGE_TYPE(ImgType, Id) \ - case TypeSpecifierType::TST_##ImgType##_t: + case TST_unspecified: + case TST_void: + case TST_char: + case TST_wchar: + case TST_char16: + case TST_char32: + case TST_int: + case TST_int128: + case TST_half: + case TST_float: + case TST_double: + case TST_Float16: + case TST_float128: + case TST_bool: + case TST_decimal32: + case TST_decimal64: + case TST_decimal128: + case TST_enum: + case TST_union: + case TST_struct: + case TST_interface: + case TST_class: + case TST_auto: + case TST_auto_type: + case TST_decltype_auto: +#define GENERIC_IMAGE_TYPE(ImgType, Id) case TST_##ImgType##_t: #include "clang/Basic/OpenCLImageTypes.def" - case TypeSpecifierType::TST_unknown_anytype: - case TypeSpecifierType::TST_error: + case TST_unknown_anytype: + case TST_error: break; } Modified: cfe/trunk/lib/Sema/SemaType.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaType.cpp (original) +++ cfe/trunk/lib/Sema/SemaType.cpp Mon Jan 1 10:23:28 2018 @@ -1433,10 +1433,8 @@ static QualType ConvertDeclSpecToType(Ty // If the type is deprecated or unavailable, diagnose it. S.DiagnoseUseOfDecl(D, DS.getTypeSpecTypeNameLoc()); - assert(DS.getTypeSpecWidth() == TypeSpecifierWidth::TSW_unspecified && - DS.getTypeSpecComplex() == 0 && - DS.getTypeSpecSign() == TypeSpecifierSign::TSS_unspecified && - "No qualifiers on tag names!"); + assert(DS.getTypeSpecWidth() == 0 && DS.getTypeSpecComplex() == 0 && + DS.getTypeSpecSign() == 0 && "No qualifiers on tag names!"); // TypeQuals handled by caller. Result = Context.getTypeDeclType(D); @@ -1448,9 +1446,8 @@ static QualType ConvertDeclSpecToType(Ty break; } case DeclSpec::TST_typename: { - assert(DS.getTypeSpecWidth() == TypeSpecifierWidth::TSW_unspecified && - DS.getTypeSpecComplex() == 0 && - DS.getTypeSpecSign() == TypeSpecifierSign::TSS_unspecified && + assert(DS.getTypeSpecWidth() == 0 && DS.getTypeSpecComplex() == 0 && + DS.getTypeSpecSign() == 0 && "Can't handle qualifiers on typedef names yet!"); Result = S.GetTypeFromParser(DS.getRepAsType()); if (Result.isNull()) { @@ -4986,7 +4983,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarat TypeProcessingState state(*this, D); TypeSourceInfo *ReturnTypeInfo = nullptr; - QualType T = GetDeclSpecTypeForDeclarator(state, ReturnTypeInfo); + QualType T = GetDeclSpecTypeForDeclarator(state, ReturnTypeInfo); if (D.isPrototypeContext() && getLangOpts().ObjCAutoRefCount) inferARCWriteback(state, T); @@ -5311,16 +5308,16 @@ namespace { // Set info for the written builtin specifiers. TL.getWrittenBuiltinSpecs() = DS.getWrittenBuiltinSpecs(); // Try to have a meaningful source location. - if (TL.getWrittenSignSpec() != TypeSpecifierSign::TSS_unspecified) + if (TL.getWrittenSignSpec() != TSS_unspecified) TL.expandBuiltinRange(DS.getTypeSpecSignLoc()); - if (TL.getWrittenWidthSpec() != TypeSpecifierWidth::TSW_unspecified) + if (TL.getWrittenWidthSpec() != TSW_unspecified) TL.expandBuiltinRange(DS.getTypeSpecWidthRange()); } } void VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) { ElaboratedTypeKeyword Keyword = TypeWithKeyword::getKeywordForTypeSpec(DS.getTypeSpecType()); - if (DS.getTypeSpecType() == TypeSpecifierType::TST_typename) { + if (DS.getTypeSpecType() == TST_typename) { TypeSourceInfo *TInfo = nullptr; Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo); if (TInfo) { @@ -5336,7 +5333,7 @@ namespace { Visit(TL.getNextTypeLoc().getUnqualifiedLoc()); } void VisitDependentNameTypeLoc(DependentNameTypeLoc TL) { - assert(DS.getTypeSpecType() == TypeSpecifierType::TST_typename); + assert(DS.getTypeSpecType() == TST_typename); TypeSourceInfo *TInfo = nullptr; Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo); assert(TInfo); @@ -5344,7 +5341,7 @@ namespace { } void VisitDependentTemplateSpecializationTypeLoc( DependentTemplateSpecializationTypeLoc TL) { - assert(DS.getTypeSpecType() == TypeSpecifierType::TST_typename); + assert(DS.getTypeSpecType() == TST_typename); TypeSourceInfo *TInfo = nullptr; Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo); assert(TInfo); Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=321628&r1=321627&r2=321628&view=diff ============================================================================== --- cfe/trunk/lib/Serialization/ASTWriter.cpp (original) +++ cfe/trunk/lib/Serialization/ASTWriter.cpp Mon Jan 1 10:23:28 2018 @@ -590,9 +590,9 @@ void TypeLocWriter::VisitQualifiedTypeLo void TypeLocWriter::VisitBuiltinTypeLoc(BuiltinTypeLoc TL) { Record.AddSourceLocation(TL.getBuiltinLoc()); if (TL.needsExtraLocalData()) { - Record.push_back(static_cast<unsigned>(TL.getWrittenTypeSpec())); - Record.push_back(static_cast<unsigned>(TL.getWrittenSignSpec())); - Record.push_back(static_cast<unsigned>(TL.getWrittenWidthSpec())); + Record.push_back(TL.getWrittenTypeSpec()); + Record.push_back(TL.getWrittenSignSpec()); + Record.push_back(TL.getWrittenWidthSpec()); Record.push_back(TL.hasModeAttr()); } } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits