diff options
author | Faisal Vali <faisalv@yahoo.com> | 2017-12-30 04:15:27 +0000 |
---|---|---|
committer | Faisal Vali <faisalv@yahoo.com> | 2017-12-30 04:15:27 +0000 |
commit | 0682d12e455d31b91fa41bc562ae3fa53388a820 (patch) | |
tree | fa122f469286c7dcebf9386af74ee6fd3b8875f3 /lib/Sema | |
parent | ca674819d0450d7eb350c2205393a69dc206f3a9 (diff) |
[NFC] Modernize enum 'UnqualifiedId::IdKind' into a scoped enum UnqualifiedIdKind.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321574 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/DeclSpec.cpp | 12 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 42 | ||||
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 45 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 13 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 16 | ||||
-rw-r--r-- | lib/Sema/SemaExprMember.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 24 | ||||
-rw-r--r-- | lib/Sema/SemaType.cpp | 31 |
8 files changed, 94 insertions, 91 deletions
diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index b537b95baf..2fad5a18ba 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -30,7 +30,7 @@ using namespace clang; void UnqualifiedId::setTemplateId(TemplateIdAnnotation *TemplateId) { assert(TemplateId && "NULL template-id annotation?"); - Kind = IK_TemplateId; + Kind = UnqualifiedIdKind::IK_TemplateId; this->TemplateId = TemplateId; StartLocation = TemplateId->TemplateNameLoc; EndLocation = TemplateId->RAngleLoc; @@ -38,7 +38,7 @@ void UnqualifiedId::setTemplateId(TemplateIdAnnotation *TemplateId) { void UnqualifiedId::setConstructorTemplateId(TemplateIdAnnotation *TemplateId) { assert(TemplateId && "NULL template-id annotation?"); - Kind = IK_ConstructorTemplateId; + Kind = UnqualifiedIdKind::IK_ConstructorTemplateId; this->TemplateId = TemplateId; StartLocation = TemplateId->TemplateNameLoc; EndLocation = TemplateId->RAngleLoc; @@ -389,14 +389,14 @@ bool Declarator::isDeclarationOfFunction() const { bool Declarator::isStaticMember() { assert(getContext() == DeclaratorContext::MemberContext); return getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_static || - (getName().Kind == UnqualifiedId::IK_OperatorFunctionId && + (getName().Kind == UnqualifiedIdKind::IK_OperatorFunctionId && CXXMethodDecl::isStaticOverloadedOperator( getName().OperatorFunctionId.Operator)); } bool Declarator::isCtorOrDtor() { - return (getName().getKind() == UnqualifiedId::IK_ConstructorName) || - (getName().getKind() == UnqualifiedId::IK_DestructorName); + return (getName().getKind() == UnqualifiedIdKind::IK_ConstructorName) || + (getName().getKind() == UnqualifiedIdKind::IK_DestructorName); } bool DeclSpec::hasTagDefinition() const { @@ -1281,7 +1281,7 @@ bool DeclSpec::isMissingDeclaratorOk() { void UnqualifiedId::setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3]) { - Kind = IK_OperatorFunctionId; + Kind = UnqualifiedIdKind::IK_OperatorFunctionId; StartLocation = OperatorLoc; EndLocation = OperatorLoc; OperatorFunctionId.Operator = Op; diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 8655590743..743f4bb5e8 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -4897,13 +4897,13 @@ Sema::GetNameFromUnqualifiedId(const UnqualifiedId &Name) { switch (Name.getKind()) { - case UnqualifiedId::IK_ImplicitSelfParam: - case UnqualifiedId::IK_Identifier: + case UnqualifiedIdKind::IK_ImplicitSelfParam: + case UnqualifiedIdKind::IK_Identifier: NameInfo.setName(Name.Identifier); NameInfo.setLoc(Name.StartLocation); return NameInfo; - case UnqualifiedId::IK_DeductionGuideName: { + case UnqualifiedIdKind::IK_DeductionGuideName: { // C++ [temp.deduct.guide]p3: // The simple-template-id shall name a class template specialization. // The template-name shall be the same identifier as the template-name @@ -4931,7 +4931,7 @@ Sema::GetNameFromUnqualifiedId(const UnqualifiedId &Name) { return NameInfo; } - case UnqualifiedId::IK_OperatorFunctionId: + case UnqualifiedIdKind::IK_OperatorFunctionId: NameInfo.setName(Context.DeclarationNames.getCXXOperatorName( Name.OperatorFunctionId.Operator)); NameInfo.setLoc(Name.StartLocation); @@ -4941,14 +4941,14 @@ Sema::GetNameFromUnqualifiedId(const UnqualifiedId &Name) { = Name.EndLocation.getRawEncoding(); return NameInfo; - case UnqualifiedId::IK_LiteralOperatorId: + case UnqualifiedIdKind::IK_LiteralOperatorId: NameInfo.setName(Context.DeclarationNames.getCXXLiteralOperatorName( Name.Identifier)); NameInfo.setLoc(Name.StartLocation); NameInfo.setCXXLiteralOperatorNameLoc(Name.EndLocation); return NameInfo; - case UnqualifiedId::IK_ConversionFunctionId: { + case UnqualifiedIdKind::IK_ConversionFunctionId: { TypeSourceInfo *TInfo; QualType Ty = GetTypeFromParser(Name.ConversionFunctionId, &TInfo); if (Ty.isNull()) @@ -4960,7 +4960,7 @@ Sema::GetNameFromUnqualifiedId(const UnqualifiedId &Name) { return NameInfo; } - case UnqualifiedId::IK_ConstructorName: { + case UnqualifiedIdKind::IK_ConstructorName: { TypeSourceInfo *TInfo; QualType Ty = GetTypeFromParser(Name.ConstructorName, &TInfo); if (Ty.isNull()) @@ -4972,7 +4972,7 @@ Sema::GetNameFromUnqualifiedId(const UnqualifiedId &Name) { return NameInfo; } - case UnqualifiedId::IK_ConstructorTemplateId: { + case UnqualifiedIdKind::IK_ConstructorTemplateId: { // In well-formed code, we can only have a constructor // template-id that refers to the current context, so go there // to find the actual type being constructed. @@ -4995,7 +4995,7 @@ Sema::GetNameFromUnqualifiedId(const UnqualifiedId &Name) { return NameInfo; } - case UnqualifiedId::IK_DestructorName: { + case UnqualifiedIdKind::IK_DestructorName: { TypeSourceInfo *TInfo; QualType Ty = GetTypeFromParser(Name.DestructorName, &TInfo); if (Ty.isNull()) @@ -5007,7 +5007,7 @@ Sema::GetNameFromUnqualifiedId(const UnqualifiedId &Name) { return NameInfo; } - case UnqualifiedId::IK_TemplateId: { + case UnqualifiedIdKind::IK_TemplateId: { TemplateName TName = Name.TemplateId->Template.get(); SourceLocation TNameLoc = Name.TemplateId->TemplateNameLoc; return Context.getNameForTemplate(TName, TNameLoc); @@ -5670,8 +5670,8 @@ Sema::ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC, Diag(D.getDeclSpec().getConstexprSpecLoc(), diag::err_invalid_constexpr) << 1; - if (D.getName().Kind != UnqualifiedId::IK_Identifier) { - if (D.getName().Kind == UnqualifiedId::IK_DeductionGuideName) + if (D.getName().Kind != UnqualifiedIdKind::IK_Identifier) { + if (D.getName().Kind == UnqualifiedIdKind::IK_DeductionGuideName) Diag(D.getName().StartLocation, diag::err_deduction_guide_invalid_specifier) << "typedef"; @@ -6425,7 +6425,7 @@ NamedDecl *Sema::ActOnVariableDeclarator( TemplateParams = MatchTemplateParametersToScopeSpecifier( D.getDeclSpec().getLocStart(), D.getIdentifierLoc(), D.getCXXScopeSpec(), - D.getName().getKind() == UnqualifiedId::IK_TemplateId + D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId ? D.getName().TemplateId : nullptr, TemplateParamLists, @@ -6433,7 +6433,7 @@ NamedDecl *Sema::ActOnVariableDeclarator( if (TemplateParams) { if (!TemplateParams->size() && - D.getName().getKind() != UnqualifiedId::IK_TemplateId) { + D.getName().getKind() != UnqualifiedIdKind::IK_TemplateId) { // There is an extraneous 'template<>' for this variable. Complain // about it, but allow the declaration of the variable. Diag(TemplateParams->getTemplateLoc(), @@ -6443,7 +6443,7 @@ NamedDecl *Sema::ActOnVariableDeclarator( TemplateParams->getRAngleLoc()); TemplateParams = nullptr; } else { - if (D.getName().getKind() == UnqualifiedId::IK_TemplateId) { + if (D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId) { // This is an explicit specialization or a partial specialization. // FIXME: Check that we can declare a specialization here. IsVariableTemplateSpecialization = true; @@ -6464,9 +6464,9 @@ NamedDecl *Sema::ActOnVariableDeclarator( } } } else { - assert( - (Invalid || D.getName().getKind() != UnqualifiedId::IK_TemplateId) && - "should have a 'template<>' for this decl"); + assert((Invalid || + D.getName().getKind() != UnqualifiedIdKind::IK_TemplateId) && + "should have a 'template<>' for this decl"); } if (IsVariableTemplateSpecialization) { @@ -8261,7 +8261,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, MatchTemplateParametersToScopeSpecifier( D.getDeclSpec().getLocStart(), D.getIdentifierLoc(), D.getCXXScopeSpec(), - D.getName().getKind() == UnqualifiedId::IK_TemplateId + D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId ? D.getName().TemplateId : nullptr, TemplateParamLists, isFriend, isMemberSpecialization, @@ -8318,7 +8318,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // and clearly the user wants a template specialization. So // we need to insert '<>' after the name. SourceLocation InsertLoc; - if (D.getName().getKind() != UnqualifiedId::IK_TemplateId) { + if (D.getName().getKind() != UnqualifiedIdKind::IK_TemplateId) { InsertLoc = D.getName().getSourceRange().getEnd(); InsertLoc = getLocForEndOfToken(InsertLoc); } @@ -8719,7 +8719,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // If the declarator is a template-id, translate the parser's template // argument list into our AST format. - if (D.getName().getKind() == UnqualifiedId::IK_TemplateId) { + if (D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId) { TemplateIdAnnotation *TemplateId = D.getName().TemplateId; TemplateArgs.setLAngleLoc(TemplateId->LAngleLoc); TemplateArgs.setRAngleLoc(TemplateId->RAngleLoc); diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 1be1878030..ceded02e39 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -8986,15 +8986,15 @@ Decl *Sema::ActOnUsingDeclaration(Scope *S, } switch (Name.getKind()) { - case UnqualifiedId::IK_ImplicitSelfParam: - case UnqualifiedId::IK_Identifier: - case UnqualifiedId::IK_OperatorFunctionId: - case UnqualifiedId::IK_LiteralOperatorId: - case UnqualifiedId::IK_ConversionFunctionId: + case UnqualifiedIdKind::IK_ImplicitSelfParam: + case UnqualifiedIdKind::IK_Identifier: + case UnqualifiedIdKind::IK_OperatorFunctionId: + case UnqualifiedIdKind::IK_LiteralOperatorId: + case UnqualifiedIdKind::IK_ConversionFunctionId: break; - case UnqualifiedId::IK_ConstructorName: - case UnqualifiedId::IK_ConstructorTemplateId: + case UnqualifiedIdKind::IK_ConstructorName: + case UnqualifiedIdKind::IK_ConstructorTemplateId: // C++11 inheriting constructors. Diag(Name.getLocStart(), getLangOpts().CPlusPlus11 ? @@ -9006,17 +9006,17 @@ Decl *Sema::ActOnUsingDeclaration(Scope *S, return nullptr; - case UnqualifiedId::IK_DestructorName: + case UnqualifiedIdKind::IK_DestructorName: Diag(Name.getLocStart(), diag::err_using_decl_destructor) << SS.getRange(); return nullptr; - case UnqualifiedId::IK_TemplateId: + case UnqualifiedIdKind::IK_TemplateId: Diag(Name.getLocStart(), diag::err_using_decl_template_id) << SourceRange(Name.TemplateId->LAngleLoc, Name.TemplateId->RAngleLoc); return nullptr; - case UnqualifiedId::IK_DeductionGuideName: + case UnqualifiedIdKind::IK_DeductionGuideName: llvm_unreachable("cannot parse qualified deduction guide name"); } @@ -10040,7 +10040,7 @@ Decl *Sema::ActOnAliasDeclaration(Scope *S, Previous.clear(); } - assert(Name.Kind == UnqualifiedId::IK_Identifier && + assert(Name.Kind == UnqualifiedIdKind::IK_Identifier && "name in alias declaration must be an identifier"); TypeAliasDecl *NewTD = TypeAliasDecl::Create(Context, CurContext, UsingLoc, Name.StartLocation, @@ -13799,7 +13799,8 @@ NamedDecl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, // elaborated-type-specifier, the lookup to determine whether // the entity has been previously declared shall not consider // any scopes outside the innermost enclosing namespace. - bool isTemplateId = D.getName().getKind() == UnqualifiedId::IK_TemplateId; + bool isTemplateId = + D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId; // Find the appropriate context according to the above. DC = CurContext; @@ -13910,24 +13911,24 @@ NamedDecl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, if (!DC->isRecord()) { int DiagArg = -1; switch (D.getName().getKind()) { - case UnqualifiedId::IK_ConstructorTemplateId: - case UnqualifiedId::IK_ConstructorName: + case UnqualifiedIdKind::IK_ConstructorTemplateId: + case UnqualifiedIdKind::IK_ConstructorName: DiagArg = 0; break; - case UnqualifiedId::IK_DestructorName: + case UnqualifiedIdKind::IK_DestructorName: DiagArg = 1; break; - case UnqualifiedId::IK_ConversionFunctionId: + case UnqualifiedIdKind::IK_ConversionFunctionId: DiagArg = 2; break; - case UnqualifiedId::IK_DeductionGuideName: + case UnqualifiedIdKind::IK_DeductionGuideName: DiagArg = 3; break; - case UnqualifiedId::IK_Identifier: - case UnqualifiedId::IK_ImplicitSelfParam: - case UnqualifiedId::IK_LiteralOperatorId: - case UnqualifiedId::IK_OperatorFunctionId: - case UnqualifiedId::IK_TemplateId: + case UnqualifiedIdKind::IK_Identifier: + case UnqualifiedIdKind::IK_ImplicitSelfParam: + case UnqualifiedIdKind::IK_LiteralOperatorId: + case UnqualifiedIdKind::IK_OperatorFunctionId: + case UnqualifiedIdKind::IK_TemplateId: break; } // This implies that it has to be an operator or function. diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 3812bc6744..7e01b058ab 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1711,7 +1711,7 @@ Sema::DecomposeUnqualifiedId(const UnqualifiedId &Id, TemplateArgumentListInfo &Buffer, DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *&TemplateArgs) { - if (Id.getKind() == UnqualifiedId::IK_TemplateId) { + if (Id.getKind() == UnqualifiedIdKind::IK_TemplateId) { Buffer.setLAngleLoc(Id.TemplateId->LAngleLoc); Buffer.setRAngleLoc(Id.TemplateId->RAngleLoc); @@ -2070,9 +2070,10 @@ Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS, IsAddressOfOperand, TemplateArgs); // Perform the required lookup. - LookupResult R(*this, NameInfo, - (Id.getKind() == UnqualifiedId::IK_ImplicitSelfParam) - ? LookupObjCImplicitSelfParam : LookupOrdinaryName); + LookupResult R(*this, NameInfo, + (Id.getKind() == UnqualifiedIdKind::IK_ImplicitSelfParam) + ? LookupObjCImplicitSelfParam + : LookupOrdinaryName); if (TemplateArgs) { // Lookup the template name again to correctly establish the context in // which it was found. This is really unfortunate as we already did the @@ -2243,7 +2244,7 @@ Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS, // In C++1y, if this is a variable template id, then check it // in BuildTemplateIdExpr(). // The single lookup result must be a variable template declaration. - if (Id.getKind() == UnqualifiedId::IK_TemplateId && Id.TemplateId && + if (Id.getKind() == UnqualifiedIdKind::IK_TemplateId && Id.TemplateId && Id.TemplateId->Kind == TNK_Var_template) { assert(R.getAsSingle<VarTemplateDecl>() && "There should only be one declaration found."); @@ -2401,7 +2402,7 @@ Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S, IdentifierInfo &II = Context.Idents.get("self"); UnqualifiedId SelfName; SelfName.setIdentifier(&II, SourceLocation()); - SelfName.setKind(UnqualifiedId::IK_ImplicitSelfParam); + SelfName.setKind(UnqualifiedIdKind::IK_ImplicitSelfParam); CXXScopeSpec SelfScopeSpec; SourceLocation TemplateKWLoc; ExprResult SelfExpr = ActOnIdExpression(S, SelfScopeSpec, TemplateKWLoc, diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index cff9fbbf49..89055aecd4 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -356,7 +356,7 @@ ParsedType Sema::getDestructorTypeForDecltype(const DeclSpec &DS, bool Sema::checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Name) { - assert(Name.getKind() == UnqualifiedId::IK_LiteralOperatorId); + assert(Name.getKind() == UnqualifiedIdKind::IK_LiteralOperatorId); if (!SS.isValid()) return false; @@ -6716,11 +6716,11 @@ ExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, Expr *Base, SourceLocation CCLoc, SourceLocation TildeLoc, UnqualifiedId &SecondTypeName) { - assert((FirstTypeName.getKind() == UnqualifiedId::IK_TemplateId || - FirstTypeName.getKind() == UnqualifiedId::IK_Identifier) && + assert((FirstTypeName.getKind() == UnqualifiedIdKind::IK_TemplateId || + FirstTypeName.getKind() == UnqualifiedIdKind::IK_Identifier) && "Invalid first type name in pseudo-destructor"); - assert((SecondTypeName.getKind() == UnqualifiedId::IK_TemplateId || - SecondTypeName.getKind() == UnqualifiedId::IK_Identifier) && + assert((SecondTypeName.getKind() == UnqualifiedIdKind::IK_TemplateId || + SecondTypeName.getKind() == UnqualifiedIdKind::IK_Identifier) && "Invalid second type name in pseudo-destructor"); QualType ObjectType; @@ -6742,7 +6742,7 @@ ExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, Expr *Base, QualType DestructedType; TypeSourceInfo *DestructedTypeInfo = nullptr; PseudoDestructorTypeStorage Destructed; - if (SecondTypeName.getKind() == UnqualifiedId::IK_Identifier) { + if (SecondTypeName.getKind() == UnqualifiedIdKind::IK_Identifier) { ParsedType T = getTypeName(*SecondTypeName.Identifier, SecondTypeName.StartLocation, S, &SS, true, false, ObjectTypePtrForLookup, @@ -6800,9 +6800,9 @@ ExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, Expr *Base, // Convert the name of the scope type (the type prior to '::') into a type. TypeSourceInfo *ScopeTypeInfo = nullptr; QualType ScopeType; - if (FirstTypeName.getKind() == UnqualifiedId::IK_TemplateId || + if (FirstTypeName.getKind() == UnqualifiedIdKind::IK_TemplateId || FirstTypeName.Identifier) { - if (FirstTypeName.getKind() == UnqualifiedId::IK_Identifier) { + if (FirstTypeName.getKind() == UnqualifiedIdKind::IK_Identifier) { ParsedType T = getTypeName(*FirstTypeName.Identifier, FirstTypeName.StartLocation, S, &SS, true, false, ObjectTypePtrForLookup, diff --git a/lib/Sema/SemaExprMember.cpp b/lib/Sema/SemaExprMember.cpp index dd516ea3b4..f57f79e62e 100644 --- a/lib/Sema/SemaExprMember.cpp +++ b/lib/Sema/SemaExprMember.cpp @@ -1707,7 +1707,7 @@ ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base, // Warn about the explicit constructor calls Microsoft extension. if (getLangOpts().MicrosoftExt && - Id.getKind() == UnqualifiedId::IK_ConstructorName) + Id.getKind() == UnqualifiedIdKind::IK_ConstructorName) Diag(Id.getSourceRange().getBegin(), diag::ext_ms_explicit_constructor_call); diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index d94cb0d0f4..7c6af5793f 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -169,16 +169,16 @@ TemplateNameKind Sema::isTemplateName(Scope *S, MemberOfUnknownSpecialization = false; switch (Name.getKind()) { - case UnqualifiedId::IK_Identifier: + case UnqualifiedIdKind::IK_Identifier: TName = DeclarationName(Name.Identifier); break; - case UnqualifiedId::IK_OperatorFunctionId: + case UnqualifiedIdKind::IK_OperatorFunctionId: TName = Context.DeclarationNames.getCXXOperatorName( Name.OperatorFunctionId.Operator); break; - case UnqualifiedId::IK_LiteralOperatorId: + case UnqualifiedIdKind::IK_LiteralOperatorId: TName = Context.DeclarationNames.getCXXLiteralOperatorName(Name.Identifier); break; @@ -3557,7 +3557,7 @@ DeclResult Sema::ActOnVarTemplateSpecialization( TemplateParameterList *TemplateParams, StorageClass SC, bool IsPartialSpecialization) { // D must be variable template id. - assert(D.getName().getKind() == UnqualifiedId::IK_TemplateId && + assert(D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId && "Variable template specialization is declared with a template it."); TemplateIdAnnotation *TemplateId = D.getName().TemplateId; @@ -4084,8 +4084,8 @@ TemplateNameKind Sema::ActOnDependentTemplateName(Scope *S, // We found something; return it. auto *LookupRD = dyn_cast<CXXRecordDecl>(LookupCtx); if (!AllowInjectedClassName && SS.isSet() && LookupRD && - Name.getKind() == UnqualifiedId::IK_Identifier && Name.Identifier && - LookupRD->getIdentifier() == Name.Identifier) { + Name.getKind() == UnqualifiedIdKind::IK_Identifier && + Name.Identifier && LookupRD->getIdentifier() == Name.Identifier) { // C++14 [class.qual]p2: // In a lookup in which function names are not ignored and the // nested-name-specifier nominates a class C, if the name specified @@ -4107,17 +4107,17 @@ TemplateNameKind Sema::ActOnDependentTemplateName(Scope *S, NestedNameSpecifier *Qualifier = SS.getScopeRep(); switch (Name.getKind()) { - case UnqualifiedId::IK_Identifier: + case UnqualifiedIdKind::IK_Identifier: Result = TemplateTy::make(Context.getDependentTemplateName(Qualifier, Name.Identifier)); return TNK_Dependent_template_name; - case UnqualifiedId::IK_OperatorFunctionId: + case UnqualifiedIdKind::IK_OperatorFunctionId: Result = TemplateTy::make(Context.getDependentTemplateName(Qualifier, Name.OperatorFunctionId.Operator)); return TNK_Function_template; - case UnqualifiedId::IK_LiteralOperatorId: + case UnqualifiedIdKind::IK_LiteralOperatorId: llvm_unreachable("literal operator id cannot have a dependent scope"); default: @@ -9044,7 +9044,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S, return true; } - if (D.getName().getKind() != UnqualifiedId::IK_TemplateId) { + if (D.getName().getKind() != UnqualifiedIdKind::IK_TemplateId) { // C++1y [temp.explicit]p3: // If the explicit instantiation is for a variable, the unqualified-id // in the declaration shall be a template-id. @@ -9126,7 +9126,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S, // argument list into our AST format. bool HasExplicitTemplateArgs = false; TemplateArgumentListInfo TemplateArgs; - if (D.getName().getKind() == UnqualifiedId::IK_TemplateId) { + if (D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId) { TemplateArgs = makeTemplateArgumentListInfo(*this, *D.getName().TemplateId); HasExplicitTemplateArgs = true; } @@ -9292,7 +9292,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S, // // C++98 has the same restriction, just worded differently. FunctionTemplateDecl *FunTmpl = Specialization->getPrimaryTemplate(); - if (D.getName().getKind() != UnqualifiedId::IK_TemplateId && !FunTmpl && + if (D.getName().getKind() != UnqualifiedIdKind::IK_TemplateId && !FunTmpl && D.getCXXScopeSpec().isSet() && !ScopeSpecifierHasTemplateId(D.getCXXScopeSpec())) Diag(D.getIdentifierLoc(), diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 65c37c4a06..4dab52a9f5 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -2703,7 +2703,7 @@ static void diagnoseRedundantReturnTypeQualifiers(Sema &S, QualType RetTy, // If the qualifiers come from a conversion function type, don't diagnose // them -- they're not necessarily redundant, since such a conversion // operator can be explicitly called as "x.operator const int()". - if (D.getName().getKind() == UnqualifiedId::IK_ConversionFunctionId) + if (D.getName().getKind() == UnqualifiedIdKind::IK_ConversionFunctionId) return; // Just parens all the way out to the decl specifiers. Diagnose any qualifiers @@ -2729,11 +2729,11 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, TagDecl *OwnedTagDecl = nullptr; switch (D.getName().getKind()) { - case UnqualifiedId::IK_ImplicitSelfParam: - case UnqualifiedId::IK_OperatorFunctionId: - case UnqualifiedId::IK_Identifier: - case UnqualifiedId::IK_LiteralOperatorId: - case UnqualifiedId::IK_TemplateId: + case UnqualifiedIdKind::IK_ImplicitSelfParam: + case UnqualifiedIdKind::IK_OperatorFunctionId: + case UnqualifiedIdKind::IK_Identifier: + case UnqualifiedIdKind::IK_LiteralOperatorId: + case UnqualifiedIdKind::IK_TemplateId: T = ConvertDeclSpecToType(state); if (!D.isInvalidType() && D.getDeclSpec().isTypeSpecOwned()) { @@ -2743,9 +2743,9 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, } break; - case UnqualifiedId::IK_ConstructorName: - case UnqualifiedId::IK_ConstructorTemplateId: - case UnqualifiedId::IK_DestructorName: + case UnqualifiedIdKind::IK_ConstructorName: + case UnqualifiedIdKind::IK_ConstructorTemplateId: + case UnqualifiedIdKind::IK_DestructorName: // Constructors and destructors don't have return types. Use // "void" instead. T = SemaRef.Context.VoidTy; @@ -2753,13 +2753,13 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, D.getDeclSpec().getAttributes().getList()); break; - case UnqualifiedId::IK_DeductionGuideName: + case UnqualifiedIdKind::IK_DeductionGuideName: // Deduction guides have a trailing return type and no type in their // decl-specifier sequence. Use a placeholder return type for now. T = SemaRef.Context.DependentTy; break; - case UnqualifiedId::IK_ConversionFunctionId: + case UnqualifiedIdKind::IK_ConversionFunctionId: // The result type of a conversion function is the type that it // converts to. T = SemaRef.GetTypeFromParser(D.getName().ConversionFunctionId, @@ -2917,7 +2917,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, } SourceRange AutoRange = D.getDeclSpec().getTypeSpecTypeLoc(); - if (D.getName().getKind() == UnqualifiedId::IK_ConversionFunctionId) + if (D.getName().getKind() == UnqualifiedIdKind::IK_ConversionFunctionId) AutoRange = D.getName().getSourceRange(); if (Error != -1) { @@ -4322,7 +4322,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, << T << D.getSourceRange(); D.setInvalidType(true); } else if (D.getName().getKind() == - UnqualifiedId::IK_DeductionGuideName) { + UnqualifiedIdKind::IK_DeductionGuideName) { if (T != Context.DependentTy) { S.Diag(D.getDeclSpec().getLocStart(), diag::err_deduction_guide_with_complex_decl) @@ -4350,7 +4350,8 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, // C99 6.7.5.3p1: The return type may not be a function or array type. // For conversion functions, we'll diagnose this particular error later. if (!D.isInvalidType() && (T->isArrayType() || T->isFunctionType()) && - (D.getName().getKind() != UnqualifiedId::IK_ConversionFunctionId)) { + (D.getName().getKind() != + UnqualifiedIdKind::IK_ConversionFunctionId)) { unsigned diagID = diag::err_func_returning_array_function; // Last processing chunk in block context means this function chunk // represents the block. @@ -4794,7 +4795,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, // Core issue 547 also allows cv-qualifiers on function types that are // top-level template type arguments. enum { NonMember, Member, DeductionGuide } Kind = NonMember; - if (D.getName().getKind() == UnqualifiedId::IK_DeductionGuideName) + if (D.getName().getKind() == UnqualifiedIdKind::IK_DeductionGuideName) Kind = DeductionGuide; else if (!D.getCXXScopeSpec().isSet()) { if ((D.getContext() == DeclaratorContext::MemberContext || |