diff options
author | Faisal Vali <faisalv@yahoo.com> | 2018-01-01 02:49:17 +0000 |
---|---|---|
committer | Faisal Vali <faisalv@yahoo.com> | 2018-01-01 02:49:17 +0000 |
commit | 20f9e21530dc55f3d9e5910787cdc49f17c060ff (patch) | |
tree | 7d42b4e238627fc67e8dee298b276ce0fdf26169 /lib | |
parent | 7e33c74d98d421c7a7db2c02f168a0bc8bbc59dc (diff) |
Revert r321614 and r321615
- the enum changes to TypeSpecifierType are breaking some tests - and will require a more careful integration.
Sorry about rushing these changes - thought I could sneak them in prior to heading out for new years ;)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321616 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/Type.cpp | 46 | ||||
-rw-r--r-- | lib/AST/TypeLoc.cpp | 14 | ||||
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 10 | ||||
-rw-r--r-- | lib/Parse/ParseDeclCXX.cpp | 26 | ||||
-rw-r--r-- | lib/Parse/ParseExpr.cpp | 9 | ||||
-rw-r--r-- | lib/Parse/ParseExprCXX.cpp | 2 | ||||
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 5 | ||||
-rw-r--r-- | lib/Parse/Parser.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/DeclSpec.cpp | 72 | ||||
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 12 | ||||
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 11 | ||||
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 10 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateVariadic.cpp | 69 | ||||
-rw-r--r-- | lib/Sema/SemaType.cpp | 21 | ||||
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 6 |
16 files changed, 147 insertions, 170 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index dc370e3d59..38f2a16fa1 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -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 diff --git a/lib/AST/TypeLoc.cpp b/lib/AST/TypeLoc.cpp index 84f607b824..0ac50b31ac 100644 --- a/lib/AST/TypeLoc.cpp +++ b/lib/AST/TypeLoc.cpp @@ -311,19 +311,19 @@ TypeSpecifierType BuiltinTypeLoc::getWrittenTypeSpec() const { 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::getWrittenTypeSpec() const { case BuiltinType::OCLReserveID: case BuiltinType::BuiltinFn: case BuiltinType::OMPArraySection: - return TypeSpecifierType::TST_unspecified; + return TST_unspecified; } llvm_unreachable("Invalid BuiltinType Kind!"); diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 37cb8e29ea..127e18439b 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -3139,7 +3139,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // 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(DeclSpec &DS, 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(Declarator &D) { 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(Declarator &D, 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; diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 8953eef1d7..68b73ca1d2 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -1011,12 +1011,10 @@ void Parser::AnnotateExistingDecltypeSpecifier(const DeclSpec& DS, 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::ParseBaseTypeSpecifier(SourceLocation &BaseLoc, 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::ParseCXXMemberInitializer(Decl *D, bool IsFunction, 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::ParseCXXClassMemberDeclarationWithPragmas( 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"); diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index 057b4e6cd5..1b8865edb7 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -997,10 +997,9 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, 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(bool isUnaryExpression, 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); diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index 3e2f4fd589..554ab24b02 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -1551,7 +1551,7 @@ Parser::ParseCXXPseudoDestructor(Expr *Base, SourceLocation OpLoc, 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); diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 4a29ee1b9a..688376ca28 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -1699,9 +1699,8 @@ void Parser::parseObjCTypeArgsOrProtocolQualifiers( 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); diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 9e33b3470d..a6f966eda1 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -174,7 +174,7 @@ bool Parser::ExpectAndConsumeSemi(unsigned DiagID) { 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; diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index 69266933d6..2fad5a18ba 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -324,52 +324,51 @@ bool Declarator::isDeclarationOfFunction() const { } 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(DeclSpec::TST T, 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"; diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 2433cf2d97..2acc896d53 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -4088,7 +4088,7 @@ void Sema::CodeCompleteObjCClassPropertyRefExpr(Scope *S, Results.data(), Results.size()); } -void Sema::CodeCompleteTag(Scope *S, TypeSpecifierType TagSpec) { +void Sema::CodeCompleteTag(Scope *S, unsigned TagSpec) { if (!CodeCompleter) return; diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index b5c990939c..743f4bb5e8 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -12786,11 +12786,11 @@ TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D, QualType T, // 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(Sema &S, DeclContext *OldDC, /// /// \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, diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index ca10849194..ceded02e39 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -3775,9 +3775,9 @@ Sema::BuildMemInitializer(Decl *ConstructorD, 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(SourceLocation LocStart, /// 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); diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 9cc19672ef..7c6af5793f 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -1152,7 +1152,7 @@ static void SetNestedNameSpecifier(TagDecl *T, const CXXScopeSpec &SS) { } 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::CheckTemplatePartialSpecializationArgs( } 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::ActOnExplicitInstantiation(Scope *S, } 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. diff --git a/lib/Sema/SemaTemplateVariadic.cpp b/lib/Sema/SemaTemplateVariadic.cpp index 7acdad5572..d81837dad5 100644 --- a/lib/Sema/SemaTemplateVariadic.cpp +++ b/lib/Sema/SemaTemplateVariadic.cpp @@ -791,53 +791,52 @@ Optional<unsigned> Sema::getNumArgumentsInExpansion(QualType T, 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; } diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 160bd146e5..4dab52a9f5 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -1433,10 +1433,8 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { // 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(TypeProcessingState &state) { 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()) { @@ -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); diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 038470efeb..1e72ced2ee 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -590,9 +590,9 @@ void TypeLocWriter::VisitQualifiedTypeLoc(QualifiedTypeLoc TL) { void TypeLocWriter::VisitBuiltinTypeLoc(BuiltinTypeLoc TL) { Record.AddSourceLocation(TL.getBuiltinLoc()); if (TL.needsExtraLocalData()) { - Record.push_back(static_cast<int>(TL.getWrittenTypeSpec())); - Record.push_back(static_cast<int>(TL.getWrittenSignSpec())); - Record.push_back(static_cast<int>(TL.getWrittenWidthSpec())); + Record.push_back(TL.getWrittenTypeSpec()); + Record.push_back(TL.getWrittenSignSpec()); + Record.push_back(TL.getWrittenWidthSpec()); Record.push_back(TL.hasModeAttr()); } } |