diff options
author | Thorsten Schütt <schuett@gmail.com> | 2020-12-23 16:56:00 +0100 |
---|---|---|
committer | Thorsten Schütt <schuett@gmail.com> | 2021-01-04 22:58:26 +0100 |
commit | efc82c4ad2bcb256a4f4c20238d08cd3afba4d2d (patch) | |
tree | 9967045d388f16ffead61a0cfd57c5043d0efab1 /clang/lib/Sema | |
parent | abbef2fd46d48a0d92d86f0c00fa2973f8ae2c85 (diff) | |
download | llvm-efc82c4ad2bcb256a4f4c20238d08cd3afba4d2d.zip llvm-efc82c4ad2bcb256a4f4c20238d08cd3afba4d2d.tar.gz llvm-efc82c4ad2bcb256a4f4c20238d08cd3afba4d2d.tar.bz2 |
[NFC, Refactor] Modernize StorageClass from Specifiers.h to a scoped enum (II)
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D93765
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 7 | ||||
-rw-r--r-- | clang/lib/Sema/SemaCoroutine.cpp | 7 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 176 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 81 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 27 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 98 | ||||
-rw-r--r-- | clang/lib/Sema/SemaLambda.cpp | 16 | ||||
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaObjCProperty.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 26 | ||||
-rw-r--r-- | clang/lib/Sema/SemaPseudoObject.cpp | 41 | ||||
-rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaStmtAsm.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 14 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 2 |
19 files changed, 253 insertions, 288 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 83df76b..690358d 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -1219,10 +1219,10 @@ void Sema::ActOnEndOfTranslationUnit() { Diag(DiagD->getLocation(), diag::warn_unneeded_member_function) << DiagD; else { - if (FD->getStorageClass() == SC_Static && + if (FD->getStorageClass() == StorageClass::Static && !FD->isInlineSpecified() && !SourceMgr.isInMainFile( - SourceMgr.getExpansionLoc(FD->getLocation()))) + SourceMgr.getExpansionLoc(FD->getLocation()))) Diag(DiagD->getLocation(), diag::warn_unneeded_static_internal_decl) << DiagD; diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 7e83a39..0a02b4b 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -5803,8 +5803,8 @@ bool Sema::SemaBuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall) { Type = PV->getType(); ParamLoc = PV->getLocation(); - IsCRegister = - PV->getStorageClass() == SC_Register && !getLangOpts().CPlusPlus; + IsCRegister = PV->getStorageClass() == StorageClass::Register && + !getLangOpts().CPlusPlus; } } @@ -10249,8 +10249,7 @@ void CheckFreeArgumentsOnLvalue(Sema &S, const std::string &CalleeName, const UnaryOperator *UnaryExpr, const VarDecl *Var) { StorageClass Class = Var->getStorageClass(); - if (Class == StorageClass::SC_Extern || - Class == StorageClass::SC_PrivateExtern || + if (Class == StorageClass::Extern || Class == StorageClass::PrivateExtern || Var->getType()->isReferenceType()) return; diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp index 7a48bfa..7dba53a 100644 --- a/clang/lib/Sema/SemaCoroutine.cpp +++ b/clang/lib/Sema/SemaCoroutine.cpp @@ -543,7 +543,8 @@ VarDecl *Sema::buildCoroutinePromise(SourceLocation Loc) { auto *VD = VarDecl::Create(Context, FD, FD->getLocation(), FD->getLocation(), &PP.getIdentifierTable().get("__promise"), T, - Context.getTrivialTypeSourceInfo(T, Loc), SC_None); + Context.getTrivialTypeSourceInfo(T, Loc), + StorageClass::None); VD->setImplicit(); CheckVariableDeclarationType(VD); if (VD->isInvalidDecl()) @@ -1577,7 +1578,7 @@ bool CoroutineStmtBuilder::makeGroDeclAndReturnStmt() { auto *GroDecl = VarDecl::Create( S.Context, &FD, FD.getLocation(), FD.getLocation(), &S.PP.getIdentifierTable().get("__coro_gro"), GroType, - S.Context.getTrivialTypeSourceInfo(GroType, Loc), SC_None); + S.Context.getTrivialTypeSourceInfo(GroType, Loc), StorageClass::None); GroDecl->setImplicit(); S.CheckVariableDeclarationType(GroDecl); @@ -1645,7 +1646,7 @@ static VarDecl *buildVarDecl(Sema &S, SourceLocation Loc, QualType Type, IdentifierInfo *II) { TypeSourceInfo *TInfo = S.Context.getTrivialTypeSourceInfo(Type, Loc); VarDecl *Decl = VarDecl::Create(S.Context, S.CurContext, Loc, Loc, II, Type, - TInfo, SC_None); + TInfo, StorageClass::None); Decl->setImplicit(); return Decl; } diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 949df53..204a035 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -2061,9 +2061,10 @@ FunctionDecl *Sema::CreateBuiltin(IdentifierInfo *II, QualType Type, Parent = CLinkageDecl; } - FunctionDecl *New = FunctionDecl::Create(Context, Parent, Loc, Loc, II, Type, - /*TInfo=*/nullptr, SC_Extern, false, - Type->isFunctionProtoType()); + FunctionDecl *New = + FunctionDecl::Create(Context, Parent, Loc, Loc, II, Type, + /*TInfo=*/nullptr, StorageClass::Extern, false, + Type->isFunctionProtoType()); New->setImplicit(); New->addAttr(BuiltinAttr::CreateImplicit(Context, ID)); @@ -2074,7 +2075,7 @@ FunctionDecl *Sema::CreateBuiltin(IdentifierInfo *II, QualType Type, for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) { ParmVarDecl *parm = ParmVarDecl::Create( Context, New, SourceLocation(), SourceLocation(), nullptr, - FT->getParamType(i), /*TInfo=*/nullptr, SC_None, nullptr); + FT->getParamType(i), /*TInfo=*/nullptr, StorageClass::None, nullptr); parm->setScopeInfo(0, i); Params.push_back(parm); } @@ -3072,9 +3073,8 @@ getNoteDiagForInvalidRedeclaration(const T *Old, const T *New) { static bool canRedefineFunction(const FunctionDecl *FD, const LangOptions& LangOpts) { return ((FD->hasAttr<GNUInlineAttr>() || LangOpts.GNUInline) && - !LangOpts.CPlusPlus && - FD->isInlineSpecified() && - FD->getStorageClass() == SC_Extern); + !LangOpts.CPlusPlus && FD->isInlineSpecified() && + FD->getStorageClass() == StorageClass::Extern); } const AttributedType *Sema::getCallingConvAttributedType(QualType T) const { @@ -3258,7 +3258,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, // Don't complain about specializations. They are not supposed to have // storage classes. if (!isa<CXXMethodDecl>(New) && !isa<CXXMethodDecl>(Old) && - New->getStorageClass() == SC_Static && + New->getStorageClass() == StorageClass::Static && Old->hasExternalFormalLinkage() && !New->getTemplateSpecializationInfo() && !canRedefineFunction(Old, getLangOpts())) { @@ -3689,10 +3689,9 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, // Synthesize parameters with the same types. SmallVector<ParmVarDecl*, 16> Params; for (const auto &ParamType : OldProto->param_types()) { - ParmVarDecl *Param = ParmVarDecl::Create(Context, New, SourceLocation(), - SourceLocation(), nullptr, - ParamType, /*TInfo=*/nullptr, - SC_None, nullptr); + ParmVarDecl *Param = ParmVarDecl::Create( + Context, New, SourceLocation(), SourceLocation(), nullptr, + ParamType, /*TInfo=*/nullptr, StorageClass::None, nullptr); Param->setScopeInfo(0, Params.size()); Param->setImplicit(); Params.push_back(Param); @@ -4072,7 +4071,7 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) { // Warn if an already-declared variable is made a weak_import in a subsequent // declaration if (New->hasAttr<WeakImportAttr>() && - Old->getStorageClass() == SC_None && + Old->getStorageClass() == StorageClass::None && !Old->hasAttr<WeakImportAttr>()) { Diag(New->getLocation(), diag::warn_weak_import) << New->getDeclName(); notePreviousDefinition(Old, New->getLocation()); @@ -4107,9 +4106,8 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) { getNoteDiagForInvalidRedeclaration(Old, New); // [dcl.stc]p8: Check if we have a non-static decl followed by a static. - if (New->getStorageClass() == SC_Static && - !New->isStaticDataMember() && - Old->hasExternalFormalLinkage()) { + if (New->getStorageClass() == StorageClass::Static && + !New->isStaticDataMember() && Old->hasExternalFormalLinkage()) { if (getLangOpts().MicrosoftExt) { Diag(New->getLocation(), diag::ext_static_non_static) << New->getDeclName(); @@ -4132,9 +4130,9 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) { // identifier has external linkage. if (New->hasExternalStorage() && Old->hasLinkage()) /* Okay */; - else if (New->getCanonicalDecl()->getStorageClass() != SC_Static && + else if (New->getCanonicalDecl()->getStorageClass() != StorageClass::Static && !New->isStaticDataMember() && - Old->getCanonicalDecl()->getStorageClass() == SC_Static) { + Old->getCanonicalDecl()->getStorageClass() == StorageClass::Static) { Diag(New->getLocation(), diag::err_non_static_static) << New->getDeclName(); Diag(OldLocation, PrevDiag); return New->setInvalidDecl(); @@ -4916,18 +4914,24 @@ StorageClassSpecToVarDeclStorageClass(const DeclSpec &DS) { assert(StorageClassSpec != DeclSpec::SCS_typedef && "Parser allowed 'typedef' as storage class VarDecl."); switch (StorageClassSpec) { - case DeclSpec::SCS_unspecified: return SC_None; + case DeclSpec::SCS_unspecified: + return StorageClass::None; case DeclSpec::SCS_extern: if (DS.isExternInLinkageSpec()) - return SC_None; - return SC_Extern; - case DeclSpec::SCS_static: return SC_Static; - case DeclSpec::SCS_auto: return SC_Auto; - case DeclSpec::SCS_register: return SC_Register; - case DeclSpec::SCS_private_extern: return SC_PrivateExtern; + return StorageClass::None; + return StorageClass::Extern; + case DeclSpec::SCS_static: + return StorageClass::Static; + case DeclSpec::SCS_auto: + return StorageClass::Auto; + case DeclSpec::SCS_register: + return StorageClass::Register; + case DeclSpec::SCS_private_extern: + return StorageClass::PrivateExtern; // Illegal SCSs map to None: error reporting is up to the caller. case DeclSpec::SCS_mutable: // Fall through. - case DeclSpec::SCS_typedef: return SC_None; + case DeclSpec::SCS_typedef: + return StorageClass::None; } llvm_unreachable("unknown storage class specifier"); } @@ -5185,7 +5189,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, // an error here Diag(Record->getLocation(), diag::err_mutable_nonmember); Invalid = true; - SC = SC_None; + SC = StorageClass::None; } assert(DS.getAttributes().empty() && "No attribute expected"); @@ -6846,21 +6850,21 @@ NamedDecl *Sema::ActOnVariableDeclarator( // dllimport globals without explicit storage class are treated as extern. We // have to change the storage class this early to get the right DeclContext. - if (SC == SC_None && !DC->isRecord() && + if (SC == StorageClass::None && !DC->isRecord() && hasParsedAttr(S, D, ParsedAttr::AT_DLLImport) && !hasParsedAttr(S, D, ParsedAttr::AT_DLLExport)) - SC = SC_Extern; + SC = StorageClass::Extern; DeclContext *OriginalDC = DC; - bool IsLocalExternDecl = SC == SC_Extern && - adjustContextForLocalExternDecl(DC); + bool IsLocalExternDecl = + SC == StorageClass::Extern && adjustContextForLocalExternDecl(DC); if (SCSpec == DeclSpec::SCS_mutable) { // mutable can only appear on non-static class members, so it's always // an error here Diag(D.getIdentifierLoc(), diag::err_mutable_nonmember); D.setInvalidType(); - SC = SC_None; + SC = StorageClass::None; } if (getLangOpts().CPlusPlus11 && SCSpec == DeclSpec::SCS_register && @@ -6881,7 +6885,8 @@ NamedDecl *Sema::ActOnVariableDeclarator( // C99 6.9p2: The storage-class specifiers auto and register shall not // appear in the declaration specifiers in an external declaration. // Global Register+Asm is a GNU extension we support. - if (SC == SC_Auto || (SC == SC_Register && !D.getAsmLabel())) { + if (SC == StorageClass::Auto || + (SC == StorageClass::Register && !D.getAsmLabel())) { Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_fscope); D.setInvalidType(); } @@ -6920,16 +6925,16 @@ NamedDecl *Sema::ActOnVariableDeclarator( if (DC->isRecord() && !CurContext->isRecord()) { // This is an out-of-line definition of a static data member. switch (SC) { - case SC_None: + case StorageClass::None: break; - case SC_Static: + case StorageClass::Static: Diag(D.getDeclSpec().getStorageClassSpecLoc(), diag::err_static_out_of_line) << FixItHint::CreateRemoval(D.getDeclSpec().getStorageClassSpecLoc()); break; - case SC_Auto: - case SC_Register: - case SC_Extern: + case StorageClass::Auto: + case StorageClass::Register: + case StorageClass::Extern: // [dcl.stc] p2: The auto or register specifiers shall be applied only // to names of variables declared in a block or to function parameters. // [dcl.stc] p6: The extern specifier cannot be used in the declaration @@ -6939,12 +6944,12 @@ NamedDecl *Sema::ActOnVariableDeclarator( diag::err_storage_class_for_static_member) << FixItHint::CreateRemoval(D.getDeclSpec().getStorageClassSpecLoc()); break; - case SC_PrivateExtern: + case StorageClass::PrivateExtern: llvm_unreachable("C storage class in c++!"); } } - if (SC == SC_Static && CurContext->isRecord()) { + if (SC == StorageClass::Static && CurContext->isRecord()) { if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(DC)) { // Walk up the enclosing DeclContexts to check for any that are // incompatible with static data members. @@ -7195,7 +7200,7 @@ NamedDecl *Sema::ActOnVariableDeclarator( // that a local variable with thread storage duration still has to // be marked 'static'. Also note that it's possible to get these // semantics in C++ using __attribute__((gnu_inline)). - if (SC == SC_Static && S->getFnParent() != nullptr && + if (SC == StorageClass::Static && S->getFnParent() != nullptr && !NewVD->getType().isConstQualified()) { FunctionDecl *CurFD = getCurFunctionDecl(); if (CurFD && isFunctionDefinitionDiscarded(*this, CurFD)) { @@ -7254,10 +7259,10 @@ NamedDecl *Sema::ActOnVariableDeclarator( targetDiag(D.getIdentifierLoc(), diag::err_thread_unsupported); // CUDA B.2.5: "__shared__ and __constant__ variables have implied static // storage [duration]." - if (SC == SC_None && S->getFnParent() != nullptr && + if (SC == StorageClass::None && S->getFnParent() != nullptr && (NewVD->hasAttr<CUDASharedAttr>() || NewVD->hasAttr<CUDAConstantAttr>())) { - NewVD->setStorageClass(SC_Static); + NewVD->setStorageClass(StorageClass::Static); } } @@ -7266,7 +7271,8 @@ NamedDecl *Sema::ActOnVariableDeclarator( // check the VarDecl itself. assert(!NewVD->hasAttr<DLLImportAttr>() || NewVD->getAttr<DLLImportAttr>()->isInherited() || - NewVD->isStaticDataMember() || NewVD->getStorageClass() != SC_None); + NewVD->isStaticDataMember() || + NewVD->getStorageClass() != StorageClass::None); // In auto-retain/release, infer strong retension for variables of // retainable type. @@ -7280,22 +7286,22 @@ NamedDecl *Sema::ActOnVariableDeclarator( StringRef Label = SE->getString(); if (S->getFnParent() != nullptr) { switch (SC) { - case SC_None: - case SC_Auto: + case StorageClass::None: + case StorageClass::Auto: Diag(E->getExprLoc(), diag::warn_asm_label_on_auto_decl) << Label; break; - case SC_Register: + case StorageClass::Register: // Local Named register if (!Context.getTargetInfo().isValidGCCRegisterName(Label) && DeclAttrsMatchCUDAMode(getLangOpts(), getCurFunctionDecl())) Diag(E->getExprLoc(), diag::err_asm_unknown_register_name) << Label; break; - case SC_Static: - case SC_Extern: - case SC_PrivateExtern: + case StorageClass::Static: + case StorageClass::Extern: + case StorageClass::PrivateExtern: break; } - } else if (SC == SC_Register) { + } else if (SC == StorageClass::Register) { // Global Named register if (DeclAttrsMatchCUDAMode(getLangOpts(), NewVD)) { const auto &TI = Context.getTargetInfo(); @@ -8389,8 +8395,8 @@ static StorageClass getFunctionStorageClass(Sema &SemaRef, Declarator &D) { case DeclSpec::SCS_unspecified: break; case DeclSpec::SCS_extern: if (D.getDeclSpec().isExternInLinkageSpec()) - return SC_None; - return SC_Extern; + return StorageClass::None; + return StorageClass::Extern; case DeclSpec::SCS_static: { if (SemaRef.CurContext->getRedeclContext()->isFunctionOrMethod()) { // C99 6.7.1p5: @@ -8402,13 +8408,14 @@ static StorageClass getFunctionStorageClass(Sema &SemaRef, Declarator &D) { diag::err_static_block_func); break; } else - return SC_Static; + return StorageClass::Static; } - case DeclSpec::SCS_private_extern: return SC_PrivateExtern; + case DeclSpec::SCS_private_extern: + return StorageClass::PrivateExtern; } // No explicit storage class has already been returned - return SC_None; + return StorageClass::None; } static FunctionDecl *CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, @@ -9210,7 +9217,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, NewFD->setImplicitlyInline(); } - if (SC == SC_Static && isa<CXXMethodDecl>(NewFD) && + if (SC == StorageClass::Static && isa<CXXMethodDecl>(NewFD) && !CurContext->isRecord()) { // C++ [class.static]p1: // A data or function member of a class may be declared static @@ -9540,13 +9547,13 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // specialization (14.7.3) FunctionTemplateSpecializationInfo *Info = NewFD->getTemplateSpecializationInfo(); - if (Info && SC != SC_None) { + if (Info && SC != StorageClass::None) { if (SC != Info->getTemplate()->getTemplatedDecl()->getStorageClass()) Diag(NewFD->getLocation(), diag::err_explicit_specialization_inconsistent_storage_class) - << SC - << FixItHint::CreateRemoval( - D.getDeclSpec().getStorageClassSpecLoc()); + << static_cast<int>(SC) + << FixItHint::CreateRemoval( + D.getDeclSpec().getStorageClassSpecLoc()); else Diag(NewFD->getLocation(), @@ -9803,8 +9810,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, if (getLangOpts().OpenCL && NewFD->hasAttr<OpenCLKernelAttr>()) { // OpenCL v1.2 s6.8 static is invalid for kernel functions. - if ((getLangOpts().OpenCLVersion >= 120) - && (SC == SC_Static)) { + if ((getLangOpts().OpenCLVersion >= 120) && (SC == StorageClass::Static)) { Diag(D.getIdentifierLoc(), diag::err_static_kernel); D.setInvalidType(); } @@ -11000,7 +11006,7 @@ void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) { // appear in a declaration of main. // static main is not an error under C99, but we should warn about it. // We accept _Noreturn main as an extension. - if (FD->getStorageClass() == SC_Static) + if (FD->getStorageClass() == StorageClass::Static) Diag(DS.getStorageClassSpecLoc(), getLangOpts().CPlusPlus ? diag::err_static_main : diag::warn_static_main) << FixItHint::CreateRemoval(DS.getStorageClassSpecLoc()); @@ -12255,7 +12261,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { // C99 6.7.8p4: All the expressions in an initializer for an object that has // static storage duration shall be constant expressions or string literals. - } else if (VDecl->getStorageClass() == SC_Static) { + } else if (VDecl->getStorageClass() == StorageClass::Static) { CheckForConstantInitializer(Init, DclT); // C89 is stricter than C99 for aggregate initializers. @@ -12383,7 +12389,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { // external linkage, so don't warn in that case. If selectany is present, // this might be header code intended for C and C++ inclusion, so apply the // C++ rules. - if (VDecl->getStorageClass() == SC_Extern && + if (VDecl->getStorageClass() == StorageClass::Extern && ((!getLangOpts().CPlusPlus && !VDecl->hasAttr<SelectAnyAttr>()) || !Context.getBaseElementType(VDecl->getType()).isConstQualified()) && !(getLangOpts().CPlusPlus && VDecl->isExternC()) && @@ -12396,7 +12402,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { if (Context.getTargetInfo().getCXXABI().isMicrosoft() && getLangOpts().CPlusPlus && VDecl->getType().isConstQualified() && VDecl->hasAttr<DLLExportAttr>() && VDecl->getDefinition()) - VDecl->setStorageClass(SC_Extern); + VDecl->setStorageClass(StorageClass::Extern); // C99 6.7.8p4. All file scoped initializers need to be constant. if (!getLangOpts().CPlusPlus && !VDecl->isInvalidDecl()) @@ -12530,14 +12536,14 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) { // be initialized. if (!Var->isInvalidDecl() && Var->getType().getAddressSpace() == LangAS::opencl_constant && - Var->getStorageClass() != SC_Extern && !Var->getInit()) { + Var->getStorageClass() != StorageClass::Extern && !Var->getInit()) { Diag(Var->getLocation(), diag::err_opencl_constant_no_init); Var->setInvalidDecl(); return; } if (!Var->isInvalidDecl() && RealDecl->hasAttr<LoaderUninitializedAttr>()) { - if (Var->getStorageClass() == SC_Extern) { + if (Var->getStorageClass() == StorageClass::Extern) { Diag(Var->getLocation(), diag::err_loader_uninitialized_extern_decl) << Var; Var->setInvalidDecl(); @@ -12594,7 +12600,7 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) { AbstractVariableType)) Var->setInvalidDecl(); if (!Type->isDependentType() && !Var->isInvalidDecl() && - Var->getStorageClass() == SC_PrivateExtern) { + Var->getStorageClass() == StorageClass::PrivateExtern) { Diag(Var->getLocation(), diag::warn_private_extern); Diag(Var->getLocation(), diag::note_private_extern); } @@ -12618,7 +12624,7 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) { Var->getLocation(), ArrayT->getElementType(), diag::err_array_incomplete_or_sizeless_type)) Var->setInvalidDecl(); - } else if (Var->getStorageClass() == SC_Static) { + } else if (Var->getStorageClass() == StorageClass::Static) { // C99 6.9.2p3: If the declaration of an identifier for an object is // a tentative definition and has internal linkage (C99 6.2.2p3), the // declared type shall not be an incomplete type. @@ -12766,21 +12772,21 @@ void Sema::ActOnCXXForRangeDecl(Decl *D) { // for-range-declaration cannot be given a storage class specifier. int Error = -1; switch (VD->getStorageClass()) { - case SC_None: + case StorageClass::None: break; - case SC_Extern: + case StorageClass::Extern: Error = 0; break; - case SC_Static: + case StorageClass::Static: Error = 1; break; - case SC_PrivateExtern: + case StorageClass::PrivateExtern: Error = 2; break; - case SC_Auto: + case StorageClass::Auto: Error = 3; break; - case SC_Register: + case StorageClass::Register: Error = 4; break; } @@ -13528,9 +13534,9 @@ Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { // Verify C99 6.7.5.3p2: The only SCS allowed is 'register'. // C++03 [dcl.stc]p2 also permits 'auto'. - StorageClass SC = SC_None; + StorageClass SC = StorageClass::None; if (DS.getStorageClassSpec() == DeclSpec::SCS_register) { - SC = SC_Register; + SC = StorageClass::Register; // In C++11, the 'register' storage class specifier is deprecated. // In C++17, it is not allowed, but we tolerate it as an extension. if (getLangOpts().CPlusPlus11) { @@ -13541,7 +13547,7 @@ Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { } } else if (getLangOpts().CPlusPlus && DS.getStorageClassSpec() == DeclSpec::SCS_auto) { - SC = SC_Auto; + SC = StorageClass::Auto; } else if (DS.getStorageClassSpec() != DeclSpec::SCS_unspecified) { Diag(DS.getStorageClassSpecLoc(), diag::err_invalid_storage_class_in_func_decl); @@ -13635,9 +13641,9 @@ ParmVarDecl *Sema::BuildParmVarDeclForTypedef(DeclContext *DC, /* FIXME: setting StartLoc == Loc. Would it be worth to modify callers so as to provide proper source location for the unnamed parameters, embedding the parameter's type? */ - ParmVarDecl *Param = ParmVarDecl::Create(Context, DC, Loc, Loc, nullptr, - T, Context.getTrivialTypeSourceInfo(T, Loc), - SC_None, nullptr); + ParmVarDecl *Param = ParmVarDecl::Create( + Context, DC, Loc, Loc, nullptr, T, + Context.getTrivialTypeSourceInfo(T, Loc), StorageClass::None, nullptr); Param->setImplicit(); return Param; } @@ -13943,7 +13949,7 @@ Sema::CheckForFunctionRedefinition(FunctionDecl *FD, } if (getLangOpts().GNUMode && Definition->isInlineSpecified() && - Definition->getStorageClass() == SC_Extern) + Definition->getStorageClass() == StorageClass::Extern) Diag(FD->getLocation(), diag::err_redefinition_extern_inline) << FD << getLangOpts().CPlusPlus; else @@ -14441,7 +14447,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, }; Diag(FD->getTypeSpecStartLoc(), diag::note_static_for_internal_linkage) << /* function */ 1 - << (FD->getStorageClass() == SC_None + << (FD->getStorageClass() == StorageClass::None ? FixItHint::CreateInsertion(findBeginLoc(), "static ") : FixItHint{}); } diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 7750d71..30164ce 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -3919,7 +3919,7 @@ void Sema::AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, if (isa<ParmVarDecl>(D)) { DiagKind = 0; } else if (const auto *VD = dyn_cast<VarDecl>(D)) { - if (VD->getStorageClass() == SC_Register) + if (VD->getStorageClass() == StorageClass::Register) DiagKind = 1; if (VD->isExceptionVariable()) DiagKind = 2; @@ -4559,7 +4559,7 @@ static void handleGNUInlineAttr(Sema &S, Decl *D, const ParsedAttr &AL) { return; } - if (S.LangOpts.CPlusPlus && Fn->getStorageClass() != SC_Extern) + if (S.LangOpts.CPlusPlus && Fn->getStorageClass() != StorageClass::Extern) S.Diag(AL.getLoc(), diag::warn_gnu_inline_cplusplus_without_extern); D->addAttr(::new (S.Context) GNUInlineAttr(S.Context, AL)); @@ -8350,8 +8350,8 @@ NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II, // FIXME: Is the DeclContext correct? NewFD = FunctionDecl::Create( FD->getASTContext(), FD->getDeclContext(), Loc, Loc, - DeclarationName(II), FD->getType(), FD->getTypeSourceInfo(), SC_None, - false /*isInlineSpecified*/, FD->hasPrototype(), + DeclarationName(II), FD->getType(), FD->getTypeSourceInfo(), + StorageClass::None, false /*isInlineSpecified*/, FD->hasPrototype(), ConstexprSpecKind::Unspecified, FD->getTrailingRequiresClause()); NewD = NewFD; diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 0df022f..3e6b536 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -5889,7 +5889,7 @@ static void ReferenceDllExportedMembers(Sema &S, CXXRecordDecl *Class) { // class must be marked export too. auto *VD = dyn_cast<VarDecl>(Member); if (VD && Member->getAttr<DLLExportAttr>() && - VD->getStorageClass() == SC_Static && + VD->getStorageClass() == StorageClass::Static && TSK == TSK_ImplicitInstantiation) S.MarkVariableReferenced(VD->getLocation(), VD); @@ -6669,7 +6669,7 @@ void Sema::CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record) { // ...). auto CheckCompletedMemberFunction = [&](CXXMethodDecl *MD) { // A static function cannot override anything. - if (MD->getStorageClass() == SC_Static) { + if (MD->getStorageClass() == StorageClass::Static) { if (ReportOverrides(*this, diag::err_static_overrides_virtual, MD, [](const CXXMethodDecl *) { return true; })) return; @@ -8092,7 +8092,7 @@ private: } VarDecl *IterationVar = VarDecl::Create( S.Context, S.CurContext, Loc, Loc, IterationVarName, SizeType, - S.Context.getTrivialTypeSourceInfo(SizeType, Loc), SC_None); + S.Context.getTrivialTypeSourceInfo(SizeType, Loc), StorageClass::None); llvm::APInt Zero(S.Context.getTypeSize(SizeType), 0); IterationVar->setInit( IntegerLiteral::Create(S.Context, Zero, SizeType, Loc)); @@ -8191,9 +8191,9 @@ private: // R cmp = ...; IdentifierInfo *Name = &S.Context.Idents.get("cmp"); - VarDecl *VD = - VarDecl::Create(S.Context, S.CurContext, Loc, Loc, Name, R, - S.Context.getTrivialTypeSourceInfo(R, Loc), SC_None); + VarDecl *VD = VarDecl::Create(S.Context, S.CurContext, Loc, Loc, Name, R, + S.Context.getTrivialTypeSourceInfo(R, Loc), + StorageClass::None); S.AddInitializerToDecl(VD, Op.get(), /*DirectInit=*/false); Stmt *InitStmt = new (S.Context) DeclStmt(DeclGroupRef(VD), Loc, Loc); @@ -10186,13 +10186,13 @@ QualType Sema::CheckConstructorDeclarator(Declarator &D, QualType R, << SourceRange(D.getIdentifierLoc()); D.setInvalidType(); } - if (SC == SC_Static) { + if (SC == StorageClass::Static) { if (!D.isInvalidType()) Diag(D.getIdentifierLoc(), diag::err_constructor_cannot_be) << "static" << SourceRange(D.getDeclSpec().getStorageClassSpecLoc()) << SourceRange(D.getIdentifierLoc()); D.setInvalidType(); - SC = SC_None; + SC = StorageClass::None; } if (unsigned TypeQuals = D.getDeclSpec().getTypeQualifiers()) { @@ -10348,14 +10348,14 @@ QualType Sema::CheckDestructorDeclarator(Declarator &D, QualType R, // destructor can be invoked for a const, volatile or const // volatile object. A destructor shall not be declared const, // volatile or const volatile (9.3.2). - if (SC == SC_Static) { + if (SC == StorageClass::Static) { if (!D.isInvalidType()) Diag(D.getIdentifierLoc(), diag::err_destructor_cannot_be) << "static" << SourceRange(D.getDeclSpec().getStorageClassSpecLoc()) << SourceRange(D.getIdentifierLoc()) << FixItHint::CreateRemoval(D.getDeclSpec().getStorageClassSpecLoc()); - SC = SC_None; + SC = StorageClass::None; } if (!D.isInvalidType()) { // Destructors don't have return types, but the parser will @@ -10451,13 +10451,13 @@ void Sema::CheckConversionDeclarator(Declarator &D, QualType &R, // Neither parameter types nor return type can be specified. The // type of a conversion function (8.3.5) is "function taking no // parameter returning conversion-type-id." - if (SC == SC_Static) { + if (SC == StorageClass::Static) { if (!D.isInvalidType()) Diag(D.getIdentifierLoc(), diag::err_conv_function_not_member) << SourceRange(D.getDeclSpec().getStorageClassSpecLoc()) << D.getName().getSourceRange(); D.setInvalidType(); - SC = SC_None; + SC = StorageClass::None; } TypeSourceInfo *ConvTSI = nullptr; @@ -10714,7 +10714,7 @@ void Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R, Diagnoser.check(DS.getStorageClassSpecLoc(), DS.getStorageClassSpec()); DS.ClearStorageClassSpecs(); - SC = SC_None; + SC = StorageClass::None; // 'explicit' is permitted. Diagnoser.check(DS.getInlineSpecLoc(), "inline"); @@ -13129,7 +13129,7 @@ Sema::findInheritingConstructor(SourceLocation Loc, Context.getTrivialTypeSourceInfo(FPT->getParamType(I), UsingLoc); ParmVarDecl *PD = ParmVarDecl::Create( Context, DerivedCtor, UsingLoc, UsingLoc, /*IdentifierInfo=*/nullptr, - FPT->getParamType(I), TInfo, SC_None, /*DefArg=*/nullptr); + FPT->getParamType(I), TInfo, StorageClass::None, /*DefArg=*/nullptr); PD->setScopeInfo(0, I); PD->setImplicit(); // Ensure attributes are propagated onto parameters (this matters for @@ -13788,10 +13788,9 @@ buildSingleCopyAssignRecursively(Sema &S, SourceLocation Loc, QualType T, OS << "__i" << Depth; IterationVarName = &S.Context.Idents.get(OS.str()); } - VarDecl *IterationVar = VarDecl::Create(S.Context, S.CurContext, Loc, Loc, - IterationVarName, SizeType, - S.Context.getTrivialTypeSourceInfo(SizeType, Loc), - SC_None); + VarDecl *IterationVar = VarDecl::Create( + S.Context, S.CurContext, Loc, Loc, IterationVarName, SizeType, + S.Context.getTrivialTypeSourceInfo(SizeType, Loc), StorageClass::None); // Initialize the iteration variable to zero. llvm::APInt Zero(S.Context.getTypeSize(SizeType), 0); @@ -13900,7 +13899,7 @@ CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) { DeclarationNameInfo NameInfo(Name, ClassLoc); CXXMethodDecl *CopyAssignment = CXXMethodDecl::Create( Context, ClassDecl, ClassLoc, NameInfo, QualType(), - /*TInfo=*/nullptr, /*StorageClass=*/SC_None, + /*TInfo=*/nullptr, /*StorageClass=*/StorageClass::None, /*isInline=*/true, Constexpr ? ConstexprSpecKind::Constexpr : ConstexprSpecKind::Unspecified, SourceLocation()); @@ -13918,11 +13917,10 @@ CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) { setupImplicitSpecialMemberType(CopyAssignment, RetType, ArgType); // Add the parameter to the operator. - ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyAssignment, - ClassLoc, ClassLoc, - /*Id=*/nullptr, ArgType, - /*TInfo=*/nullptr, SC_None, - nullptr); + ParmVarDecl *FromParam = + ParmVarDecl::Create(Context, CopyAssignment, ClassLoc, ClassLoc, + /*Id=*/nullptr, ArgType, + /*TInfo=*/nullptr, StorageClass::None, nullptr); CopyAssignment->setParams(FromParam); CopyAssignment->setTrivial( @@ -14226,7 +14224,7 @@ CXXMethodDecl *Sema::DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl) { DeclarationNameInfo NameInfo(Name, ClassLoc); CXXMethodDecl *MoveAssignment = CXXMethodDecl::Create( Context, ClassDecl, ClassLoc, NameInfo, QualType(), - /*TInfo=*/nullptr, /*StorageClass=*/SC_None, + /*TInfo=*/nullptr, /*StorageClass=*/StorageClass::None, /*isInline=*/true, Constexpr ? ConstexprSpecKind::Constexpr : ConstexprSpecKind::Unspecified, SourceLocation()); @@ -14247,11 +14245,10 @@ CXXMethodDecl *Sema::DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl) { MoveAssignment->setType(Context.getFunctionType(RetType, ArgType, EPI)); // Add the parameter to the operator. - ParmVarDecl *FromParam = ParmVarDecl::Create(Context, MoveAssignment, - ClassLoc, ClassLoc, - /*Id=*/nullptr, ArgType, - /*TInfo=*/nullptr, SC_None, - nullptr); + ParmVarDecl *FromParam = + ParmVarDecl::Create(Context, MoveAssignment, ClassLoc, ClassLoc, + /*Id=*/nullptr, ArgType, + /*TInfo=*/nullptr, StorageClass::None, nullptr); MoveAssignment->setParams(FromParam); MoveAssignment->setTrivial( @@ -14627,11 +14624,10 @@ CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor( setupImplicitSpecialMemberType(CopyConstructor, Context.VoidTy, ArgType); // Add the parameter to the constructor. - ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyConstructor, - ClassLoc, ClassLoc, - /*IdentifierInfo=*/nullptr, - ArgType, /*TInfo=*/nullptr, - SC_None, nullptr); + ParmVarDecl *FromParam = + ParmVarDecl::Create(Context, CopyConstructor, ClassLoc, ClassLoc, + /*IdentifierInfo=*/nullptr, ArgType, + /*TInfo=*/nullptr, StorageClass::None, nullptr); CopyConstructor->setParams(FromParam); CopyConstructor->setTrivial( @@ -14761,11 +14757,10 @@ CXXConstructorDecl *Sema::DeclareImplicitMoveConstructor( setupImplicitSpecialMemberType(MoveConstructor, Context.VoidTy, ArgType); // Add the parameter to the constructor. - ParmVarDecl *FromParam = ParmVarDecl::Create(Context, MoveConstructor, - ClassLoc, ClassLoc, - /*IdentifierInfo=*/nullptr, - ArgType, /*TInfo=*/nullptr, - SC_None, nullptr); + ParmVarDecl *FromParam = + ParmVarDecl::Create(Context, MoveConstructor, ClassLoc, ClassLoc, + /*IdentifierInfo=*/nullptr, ArgType, + /*TInfo=*/nullptr, StorageClass::None, nullptr); MoveConstructor->setParams(FromParam); MoveConstructor->setTrivial( @@ -15249,7 +15244,7 @@ CheckOperatorNewDeleteDeclarationScope(Sema &SemaRef, } if (isa<TranslationUnitDecl>(DC) && - FnDecl->getStorageClass() == SC_Static) { + FnDecl->getStorageClass() == StorageClass::Static) { return SemaRef.Diag(FnDecl->getLocation(), diag::err_operator_new_delete_declared_static) << FnDecl->getDeclName(); @@ -15906,7 +15901,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, } VarDecl *ExDecl = VarDecl::Create(Context, CurContext, StartLoc, Loc, Name, - ExDeclType, TInfo, SC_None); + ExDeclType, TInfo, StorageClass::None); ExDecl->setExceptionVariable(true); // In ARC, infer 'retaining' for variables of retainable type. @@ -16919,7 +16914,7 @@ bool Sema::CheckOverridingFunctionAttributes(const CXXMethodDecl *New, // suppress the calling convention mismatch error; the error about static // function override (err_static_overrides_virtual from // Sema::CheckFunctionDeclaration) is more clear. - if (New->getStorageClass() == SC_Static) + if (New->getStorageClass() == StorageClass::Static) return false; Diag(New->getLocation(), diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 60253a8..da7c0ee 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -4773,9 +4773,9 @@ Decl *Sema::ActOnMethodDeclaration( ? DI->getTypeLoc().getBeginLoc() : ArgInfo[i].NameLoc; - ParmVarDecl* Param = CheckParameter(ObjCMethod, StartLoc, - ArgInfo[i].NameLoc, ArgInfo[i].Name, - ArgType, DI, SC_None); + ParmVarDecl *Param = + CheckParameter(ObjCMethod, StartLoc, ArgInfo[i].NameLoc, + ArgInfo[i].Name, ArgType, DI, StorageClass::None); Param->setObjCMethodScopeInfo(i); @@ -5145,8 +5145,8 @@ VarDecl *Sema::BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType T, Diag(IdLoc, diag::err_catch_param_not_objc_type); } - VarDecl *New = VarDecl::Create(Context, CurContext, StartLoc, IdLoc, Id, - T, TInfo, SC_None); + VarDecl *New = VarDecl::Create(Context, CurContext, StartLoc, IdLoc, Id, T, + TInfo, StorageClass::None); New->setExceptionVariable(true); // In ARC, infer 'retaining' for variables of retainable type. diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 3992a37..b6e8ee0 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -126,7 +126,7 @@ void Sema::NoteDeletedFunction(FunctionDecl *Decl) { /// explicit storage class. static bool hasAnyExplicitStorageClass(const FunctionDecl *D) { for (auto I : D->redecls()) { - if (I->getStorageClass() != SC_None) + if (I->getStorageClass() != StorageClass::None) return true; } return false; @@ -5161,7 +5161,7 @@ ExprResult Sema::ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, // Always try to create iterator declarator to avoid extra error messages // about unknown declarations use. auto *VD = VarDecl::Create(Context, CurContext, StartLoc, D.DeclIdentLoc, - D.DeclIdent, DeclTy, TInfo, SC_None); + D.DeclIdent, DeclTy, TInfo, StorageClass::None); VD->setImplicit(); if (S) { // Check for conflicting previous declaration. @@ -5326,7 +5326,7 @@ ExprResult Sema::ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, auto *CounterVD = VarDecl::Create(Context, CurContext, D.IteratorDecl->getBeginLoc(), D.IteratorDecl->getBeginLoc(), nullptr, - Res.get()->getType(), nullptr, SC_None); + Res.get()->getType(), nullptr, StorageClass::None); CounterVD->setImplicit(); ExprResult RefRes = BuildDeclRefExpr(CounterVD, CounterVD->getType(), VK_LValue, @@ -6177,22 +6177,19 @@ static FunctionDecl *rewriteBuiltinFunctionDecl(Sema *Sema, ASTContext &Context, QualType OverloadTy = Context.getFunctionType(FT->getReturnType(), OverloadParams, EPI); DeclContext *Parent = FDecl->getParent(); - FunctionDecl *OverloadDecl = FunctionDecl::Create(Context, Parent, - FDecl->getLocation(), - FDecl->getLocation(), - FDecl->getIdentifier(), - OverloadTy, - /*TInfo=*/nullptr, - SC_Extern, false, - /*hasPrototype=*/true); + FunctionDecl *OverloadDecl = FunctionDecl::Create( + Context, Parent, FDecl->getLocation(), FDecl->getLocation(), + FDecl->getIdentifier(), OverloadTy, + /*TInfo=*/nullptr, StorageClass::Extern, false, + /*hasPrototype=*/true); SmallVector<ParmVarDecl*, 16> Params; FT = cast<FunctionProtoType>(OverloadTy); for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i) { QualType ParamType = FT->getParamType(i); ParmVarDecl *Parm = ParmVarDecl::Create(Context, OverloadDecl, SourceLocation(), - SourceLocation(), nullptr, ParamType, - /*TInfo=*/nullptr, SC_None, nullptr); + SourceLocation(), nullptr, ParamType, + /*TInfo=*/nullptr, StorageClass::None, nullptr); Parm->setScopeInfo(0, i); Params.push_back(Parm); } @@ -13461,7 +13458,7 @@ QualType Sema::CheckAddressOfOperand(ExprResult &OrigOp, SourceLocation OpLoc) { if (const VarDecl *vd = dyn_cast<VarDecl>(dcl)) { // in C++ it is not error to take address of a register // variable (c++03 7.1.1P3) - if (vd->getStorageClass() == SC_Register && + if (vd->getStorageClass() == StorageClass::Register && !getLangOpts().CPlusPlus) { AddressOfError = AO_Register_Variable; } @@ -19089,7 +19086,7 @@ ExprResult RebuildUnknownAnyExpr::resolveDecl(Expr *E, ValueDecl *VD) { FunctionDecl *NewFD = FunctionDecl::Create( S.Context, FD->getDeclContext(), Loc, Loc, FD->getNameInfo().getName(), DestType, FD->getTypeSourceInfo(), - SC_None, false /*isInlineSpecified*/, FD->hasPrototype(), + StorageClass::None, false /*isInlineSpecified*/, FD->hasPrototype(), /*ConstexprKind*/ ConstexprSpecKind::Unspecified); if (FD->getQualifier()) diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 05b28c1..8e48abc 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -2970,8 +2970,8 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, auto CreateAllocationFunctionDecl = [&](Attr *ExtraAttr) { QualType FnType = Context.getFunctionType(Return, Params, EPI); FunctionDecl *Alloc = FunctionDecl::Create( - Context, GlobalCtx, SourceLocation(), SourceLocation(), Name, - FnType, /*TInfo=*/nullptr, SC_None, false, true); + Context, GlobalCtx, SourceLocation(), SourceLocation(), Name, FnType, + /*TInfo=*/nullptr, StorageClass::None, false, true); Alloc->setImplicit(); // Global allocation functions should always be visible. Alloc->setVisibleDespiteOwningModule(); @@ -2985,7 +2985,7 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, for (QualType T : Params) { ParamDecls.push_back(ParmVarDecl::Create( Context, Alloc, SourceLocation(), SourceLocation(), nullptr, T, - /*TInfo=*/nullptr, SC_None, nullptr)); + /*TInfo=*/nullptr, StorageClass::None, nullptr)); ParamDecls.back()->setImplicit(); } Alloc->setParams(ParamDecls); diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index f5456ee..d455426 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -293,11 +293,10 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc, /*isImplicitlyDeclared=*/true, /*isDefined=*/false, ObjCMethodDecl::Required, /*HasRelatedResultType=*/false); - ParmVarDecl *value = ParmVarDecl::Create(S.Context, Method, - SourceLocation(), SourceLocation(), - &CX.Idents.get("value"), - NumberType, /*TInfo=*/nullptr, - SC_None, nullptr); + ParmVarDecl *value = ParmVarDecl::Create( + S.Context, Method, SourceLocation(), SourceLocation(), + &CX.Idents.get("value"), NumberType, /*TInfo=*/nullptr, + StorageClass::None, nullptr); Method->setMethodParams(S.Context, value, None); } @@ -570,13 +569,11 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) { /*isDefined=*/false, ObjCMethodDecl::Required, /*HasRelatedResultType=*/false); QualType ConstCharType = Context.CharTy.withConst(); - ParmVarDecl *value = - ParmVarDecl::Create(Context, M, - SourceLocation(), SourceLocation(), - &Context.Idents.get("value"), - Context.getPointerType(ConstCharType), - /*TInfo=*/nullptr, - SC_None, nullptr); + ParmVarDecl *value = ParmVarDecl::Create( + Context, M, SourceLocation(), SourceLocation(), + &Context.Idents.get("value"), + Context.getPointerType(ConstCharType), + /*TInfo=*/nullptr, StorageClass::None, nullptr); M->setMethodParams(Context, value, None); BoxingMethod = M; } @@ -686,23 +683,17 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) { SmallVector<ParmVarDecl *, 2> Params; - ParmVarDecl *bytes = - ParmVarDecl::Create(Context, M, - SourceLocation(), SourceLocation(), - &Context.Idents.get("bytes"), - Context.VoidPtrTy.withConst(), - /*TInfo=*/nullptr, - SC_None, nullptr); + ParmVarDecl *bytes = ParmVarDecl::Create( + Context, M, SourceLocation(), SourceLocation(), + &Context.Idents.get("bytes"), Context.VoidPtrTy.withConst(), + /*TInfo=*/nullptr, StorageClass::None, nullptr); Params.push_back(bytes); QualType ConstCharType = Context.CharTy.withConst(); - ParmVarDecl *type = - ParmVarDecl::Create(Context, M, - SourceLocation(), SourceLocation(), - &Context.Idents.get("type"), - Context.getPointerType(ConstCharType), - /*TInfo=*/nullptr, - SC_None, nullptr); + ParmVarDecl *type = ParmVarDecl::Create( + Context, M, SourceLocation(), SourceLocation(), + &Context.Idents.get("type"), Context.getPointerType(ConstCharType), + /*TInfo=*/nullptr, StorageClass::None, nullptr); Params.push_back(type); M->setMethodParams(Context, Params, None); @@ -817,21 +808,15 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) { /*isImplicitlyDeclared=*/true, /*isDefined=*/false, ObjCMethodDecl::Required, false); SmallVector<ParmVarDecl *, 2> Params; - ParmVarDecl *objects = ParmVarDecl::Create(Context, Method, - SourceLocation(), - SourceLocation(), - &Context.Idents.get("objects"), - Context.getPointerType(IdT), - /*TInfo=*/nullptr, - SC_None, nullptr); + ParmVarDecl *objects = ParmVarDecl::Create( + Context, Method, SourceLocation(), SourceLocation(), + &Context.Idents.get("objects"), Context.getPointerType(IdT), + /*TInfo=*/nullptr, StorageClass::None, nullptr); Params.push_back(objects); - ParmVarDecl *cnt = ParmVarDecl::Create(Context, Method, - SourceLocation(), - SourceLocation(), - &Context.Idents.get("cnt"), - Context.UnsignedLongTy, - /*TInfo=*/nullptr, SC_None, - nullptr); + ParmVarDecl *cnt = ParmVarDecl::Create( + Context, Method, SourceLocation(), SourceLocation(), + &Context.Idents.get("cnt"), Context.UnsignedLongTy, + /*TInfo=*/nullptr, StorageClass::None, nullptr); Params.push_back(cnt); Method->setMethodParams(Context, Params, None); } @@ -979,29 +964,20 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR, /*isImplicitlyDeclared=*/true, /*isDefined=*/false, ObjCMethodDecl::Required, false); SmallVector<ParmVarDecl *, 3> Params; - ParmVarDecl *objects = ParmVarDecl::Create(Context, Method, - SourceLocation(), - SourceLocation(), - &Context.Idents.get("objects"), - Context.getPointerType(IdT), - /*TInfo=*/nullptr, SC_None, - nullptr); + ParmVarDecl *objects = ParmVarDecl::Create( + Context, Method, SourceLocation(), SourceLocation(), + &Context.Idents.get("objects"), Context.getPointerType(IdT), + /*TInfo=*/nullptr, StorageClass::None, nullptr); Params.push_back(objects); - ParmVarDecl *keys = ParmVarDecl::Create(Context, Method, - SourceLocation(), - SourceLocation(), - &Context.Idents.get("keys"), - Context.getPointerType(IdT), - /*TInfo=*/nullptr, SC_None, - nullptr); + ParmVarDecl *keys = ParmVarDecl::Create( + Context, Method, SourceLocation(), SourceLocation(), + &Context.Idents.get("keys"), Context.getPointerType(IdT), + /*TInfo=*/nullptr, StorageClass::None, nullptr); Params.push_back(keys); - ParmVarDecl *cnt = ParmVarDecl::Create(Context, Method, - SourceLocation(), - SourceLocation(), - &Context.Idents.get("cnt"), - Context.UnsignedLongTy, - /*TInfo=*/nullptr, SC_None, - nullptr); + ParmVarDecl *cnt = ParmVarDecl::Create( + Context, Method, SourceLocation(), SourceLocation(), + &Context.Idents.get("cnt"), Context.UnsignedLongTy, + /*TInfo=*/nullptr, StorageClass::None, nullptr); Params.push_back(cnt); Method->setMethodParams(Context, Params, None); } diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp index af61c82..8800ff8 100644 --- a/clang/lib/Sema/SemaLambda.cpp +++ b/clang/lib/Sema/SemaLambda.cpp @@ -395,7 +395,7 @@ CXXMethodDecl *Sema::startLambdaDefinition(CXXRecordDecl *Class, Context, Class, EndLoc, DeclarationNameInfo(MethodName, IntroducerRange.getBegin(), MethodNameLoc), - MethodType, MethodTypeInfo, SC_None, + MethodType, MethodTypeInfo, StorageClass::None, /*isInline=*/true, ConstexprKind, EndLoc, TrailingRequiresClause); Method->setAccess(AS_public); if (!TemplateParams) @@ -867,8 +867,8 @@ VarDecl *Sema::createLambdaInitCaptureVarDecl(SourceLocation Loc, // used as a variable, and only exists as a way to name and refer to the // init-capture. // FIXME: Pass in separate source locations for '&' and identifier. - VarDecl *NewVD = VarDecl::Create(Context, CurContext, Loc, - Loc, Id, InitCaptureType, TSI, SC_Auto); + VarDecl *NewVD = VarDecl::Create(Context, CurContext, Loc, Loc, Id, + InitCaptureType, TSI, StorageClass::Auto); NewVD->setInitCapture(true); NewVD->setReferenced(true); // FIXME: Pass in a VarDecl::InitializationStyle. @@ -1484,7 +1484,8 @@ static void addFunctionPointerConversion(Sema &S, SourceRange IntroducerRange, // to the new static invoker parameters - not the call operator's. CXXMethodDecl *Invoke = CXXMethodDecl::Create( S.Context, Class, Loc, DeclarationNameInfo(InvokerName, Loc), - InvokerFunctionTy, CallOperator->getTypeSourceInfo(), SC_Static, + InvokerFunctionTy, CallOperator->getTypeSourceInfo(), + StorageClass::Static, /*isInline=*/true, ConstexprSpecKind::Unspecified, CallOperator->getBody()->getEndLoc()); for (unsigned I = 0, N = CallOperator->getNumParams(); I != N; ++I) @@ -2008,10 +2009,9 @@ ExprResult Sema::BuildBlockForLambdaConversion(SourceLocation CurrentLocation, // the lambda object. TypeSourceInfo *CapVarTSI = Context.getTrivialTypeSourceInfo(Src->getType()); - VarDecl *CapVar = VarDecl::Create(Context, Block, ConvLocation, - ConvLocation, nullptr, - Src->getType(), CapVarTSI, - SC_None); + VarDecl *CapVar = + VarDecl::Create(Context, Block, ConvLocation, ConvLocation, nullptr, + Src->getType(), CapVarTSI, StorageClass::None); BlockDecl::Capture Capture(/*variable=*/CapVar, /*byRef=*/false, /*nested=*/false, /*copy=*/Init.get()); Block->setCaptures(Context, Capture, /*CapturesCXXThis=*/false); diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 16dd8f5..8d79a47 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -812,7 +812,7 @@ static void InsertOCLBuiltinDeclarationsFromTable(Sema &S, LookupResult &LR, for (unsigned Index = 0; Index < GenTypeMaxCnt; Index++) { NewOpenCLBuiltin = FunctionDecl::Create( Context, Parent, Loc, Loc, II, FunctionList[Index], - /*TInfo=*/nullptr, SC_Extern, false, + /*TInfo=*/nullptr, StorageClass::Extern, false, FunctionList[Index]->isFunctionProtoType()); NewOpenCLBuiltin->setImplicit(); @@ -825,7 +825,7 @@ static void InsertOCLBuiltinDeclarationsFromTable(Sema &S, LookupResult &LR, ParmVarDecl *Parm = ParmVarDecl::Create( Context, NewOpenCLBuiltin, SourceLocation(), SourceLocation(), nullptr, FP->getParamType(IParm), - /*TInfo=*/nullptr, SC_None, nullptr); + /*TInfo=*/nullptr, StorageClass::None, nullptr); Parm->setScopeInfo(0, IParm); ParmList.push_back(Parm); } diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index fdc30fe..781efd8 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -2576,13 +2576,9 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property) { // Invent the arguments for the setter. We don't bother making a // nice name for the argument. - ParmVarDecl *Argument = ParmVarDecl::Create(Context, SetterMethod, - Loc, Loc, - property->getIdentifier(), - paramTy, - /*TInfo=*/nullptr, - SC_None, - nullptr); + ParmVarDecl *Argument = ParmVarDecl::Create( + Context, SetterMethod, Loc, Loc, property->getIdentifier(), paramTy, + /*TInfo=*/nullptr, StorageClass::None, nullptr); SetterMethod->setMethodParams(Context, Argument, None); AddPropertyAttrs(*this, SetterMethod, property); diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 7870748..67a8ac9 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -1182,7 +1182,8 @@ DSAStackTy::DSAVarData DSAStackTy::getDSA(const_iterator &Iter, // Variables with automatic storage duration that are declared in a scope // inside the construct are private. if (VD && isOpenMPLocal(VD, Iter) && VD->isLocalVarDecl() && - (VD->getStorageClass() == SC_Auto || VD->getStorageClass() == SC_None)) { + (VD->getStorageClass() == StorageClass::Auto || + VD->getStorageClass() == StorageClass::None)) { DVar.CKind = OMPC_private; return DVar; } @@ -1398,8 +1399,8 @@ static VarDecl *buildVarDecl(Sema &SemaRef, SourceLocation Loc, QualType Type, DeclContext *DC = SemaRef.CurContext; IdentifierInfo *II = &SemaRef.PP.getIdentifierTable().get(Name); TypeSourceInfo *TInfo = SemaRef.Context.getTrivialTypeSourceInfo(Type, Loc); - auto *Decl = - VarDecl::Create(SemaRef.Context, DC, Loc, Loc, II, Type, TInfo, SC_None); + auto *Decl = VarDecl::Create(SemaRef.Context, DC, Loc, Loc, II, Type, TInfo, + StorageClass::None); if (Attrs) { for (specific_attr_iterator<AlignedAttr> I(Attrs->begin()), E(Attrs->end()); I != E; ++I) @@ -1623,7 +1624,7 @@ const DSAStackTy::DSAVarData DSAStackTy::getTopDSA(ValueDecl *D, !(VD->hasAttr<OMPThreadPrivateDeclAttr>() && SemaRef.getLangOpts().OpenMPUseTLS && SemaRef.getASTContext().getTargetInfo().isTLSSupported())) || - (VD && VD->getStorageClass() == SC_Register && + (VD && VD->getStorageClass() == StorageClass::Register && VD->hasAttr<AsmLabelAttr>() && !VD->isLocalVarDecl())) { DVar.RefExpr = buildDeclRefExpr( SemaRef, VD, D->getType().getNonReferenceType(), D->getLocation()); @@ -2984,8 +2985,8 @@ Sema::CheckOMPThreadPrivateDecl(SourceLocation Loc, ArrayRef<Expr *> VarList) { !(VD->hasAttr<OMPThreadPrivateDeclAttr>() && getLangOpts().OpenMPUseTLS && getASTContext().getTargetInfo().isTLSSupported())) || - (VD->getStorageClass() == SC_Register && VD->hasAttr<AsmLabelAttr>() && - !VD->isLocalVarDecl())) { + (VD->getStorageClass() == StorageClass::Register && + VD->hasAttr<AsmLabelAttr>() && !VD->isLocalVarDecl())) { Diag(ILoc, diag::err_omp_var_thread_local) << VD << ((VD->getTLSKind() != VarDecl::TLS_None) ? 0 : 1); bool IsDecl = @@ -3138,8 +3139,8 @@ Sema::DeclGroupPtrTy Sema::ActOnOpenMPAllocateDirective( // Check if this is a TLS variable or global register. if (VD->getTLSKind() != VarDecl::TLS_None || VD->hasAttr<OMPThreadPrivateDeclAttr>() || - (VD->getStorageClass() == SC_Register && VD->hasAttr<AsmLabelAttr>() && - !VD->isLocalVarDecl())) + (VD->getStorageClass() == StorageClass::Register && + VD->hasAttr<AsmLabelAttr>() && !VD->isLocalVarDecl())) continue; // If the used several times in the allocate directive, the same allocator @@ -5984,9 +5985,10 @@ static void setPrototype(Sema &S, FunctionDecl *FD, FunctionDecl *FDWithProto, FD->setType(NewType); SmallVector<ParmVarDecl *, 16> Params; for (const ParmVarDecl *P : FDWithProto->parameters()) { - auto *Param = ParmVarDecl::Create(S.getASTContext(), FD, SourceLocation(), - SourceLocation(), nullptr, P->getType(), - /*TInfo=*/nullptr, SC_None, nullptr); + auto *Param = + ParmVarDecl::Create(S.getASTContext(), FD, SourceLocation(), + SourceLocation(), nullptr, P->getType(), + /*TInfo=*/nullptr, StorageClass::None, nullptr); Param->setScopeInfo(0, Params.size()); Param->setImplicit(); Params.push_back(Param); @@ -18378,7 +18380,7 @@ Sema::ActOnOpenMPDeclareMapperDirectiveVarDecl(Scope *S, QualType MapperType, Context.getTrivialTypeSourceInfo(MapperType, StartLoc); auto *VD = VarDecl::Create(Context, Context.getTranslationUnitDecl(), StartLoc, StartLoc, VN.getAsIdentifierInfo(), - MapperType, TInfo, SC_None); + MapperType, TInfo, StorageClass::None); if (S) PushOnScopeChains(VD, S, /*AddToContext=*/false); Expr *E = buildDeclRefExpr(*this, VD, MapperType, StartLoc); diff --git a/clang/lib/Sema/SemaPseudoObject.cpp b/clang/lib/Sema/SemaPseudoObject.cpp index d17599a..201ee53 100644 --- a/clang/lib/Sema/SemaPseudoObject.cpp +++ b/clang/lib/Sema/SemaPseudoObject.cpp @@ -1191,15 +1191,12 @@ bool ObjCSubscriptOpBuilder::findAtIndexGetter() { /*isSynthesizedAccessorStub=*/false, /*isImplicitlyDeclared=*/true, /*isDefined=*/false, ObjCMethodDecl::Required, false); - ParmVarDecl *Argument = ParmVarDecl::Create(S.Context, AtIndexGetter, - SourceLocation(), SourceLocation(), - arrayRef ? &S.Context.Idents.get("index") - : &S.Context.Idents.get("key"), - arrayRef ? S.Context.UnsignedLongTy - : S.Context.getObjCIdType(), - /*TInfo=*/nullptr, - SC_None, - nullptr); + ParmVarDecl *Argument = ParmVarDecl::Create( + S.Context, AtIndexGetter, SourceLocation(), SourceLocation(), + arrayRef ? &S.Context.Idents.get("index") + : &S.Context.Idents.get("key"), + arrayRef ? S.Context.UnsignedLongTy : S.Context.getObjCIdType(), + /*TInfo=*/nullptr, StorageClass::None, nullptr); AtIndexGetter->setMethodParams(S.Context, Argument, None); } @@ -1298,23 +1295,17 @@ bool ObjCSubscriptOpBuilder::findAtIndexSetter() { /*isImplicitlyDeclared=*/true, /*isDefined=*/false, ObjCMethodDecl::Required, false); SmallVector<ParmVarDecl *, 2> Params; - ParmVarDecl *object = ParmVarDecl::Create(S.Context, AtIndexSetter, - SourceLocation(), SourceLocation(), - &S.Context.Idents.get("object"), - S.Context.getObjCIdType(), - /*TInfo=*/nullptr, - SC_None, - nullptr); + ParmVarDecl *object = ParmVarDecl::Create( + S.Context, AtIndexSetter, SourceLocation(), SourceLocation(), + &S.Context.Idents.get("object"), S.Context.getObjCIdType(), + /*TInfo=*/nullptr, StorageClass::None, nullptr); Params.push_back(object); - ParmVarDecl *key = ParmVarDecl::Create(S.Context, AtIndexSetter, - SourceLocation(), SourceLocation(), - arrayRef ? &S.Context.Idents.get("index") - : &S.Context.Idents.get("key"), - arrayRef ? S.Context.UnsignedLongTy - : S.Context.getObjCIdType(), - /*TInfo=*/nullptr, - SC_None, - nullptr); + ParmVarDecl *key = ParmVarDecl::Create( + S.Context, AtIndexSetter, SourceLocation(), SourceLocation(), + arrayRef ? &S.Context.Idents.get("index") + : &S.Context.Idents.get("key"), + arrayRef ? S.Context.UnsignedLongTy : S.Context.getObjCIdType(), + /*TInfo=*/nullptr, StorageClass::None, nullptr); Params.push_back(key); AtIndexSetter->setMethodParams(S.Context, Params, None); } diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 027262c..67ecdbe 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -2122,7 +2122,7 @@ VarDecl *BuildForRangeVarDecl(Sema &SemaRef, SourceLocation Loc, IdentifierInfo *II = &SemaRef.PP.getIdentifierTable().get(Name); TypeSourceInfo *TInfo = SemaRef.Context.getTrivialTypeSourceInfo(Type, Loc); VarDecl *Decl = VarDecl::Create(SemaRef.Context, DC, Loc, Loc, II, Type, - TInfo, SC_None); + TInfo, StorageClass::None); Decl->setImplicit(); return Decl; } diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp index 3b631bf..a6965ea 100644 --- a/clang/lib/Sema/SemaStmtAsm.cpp +++ b/clang/lib/Sema/SemaStmtAsm.cpp @@ -195,7 +195,7 @@ static StringRef extractRegisterName(const Expr *Expression, if (const DeclRefExpr *AsmDeclRef = dyn_cast<DeclRefExpr>(Expression)) { // Handle cases where the expression is a variable const VarDecl *Variable = dyn_cast<VarDecl>(AsmDeclRef->getDecl()); - if (Variable && Variable->getStorageClass() == SC_Register) { + if (Variable && Variable->getStorageClass() == StorageClass::Register) { if (AsmLabelAttr *Attr = Variable->getAttr<AsmLabelAttr>()) if (Target.isValidGCCRegisterName(Attr->getLabel())) return Target.getNormalizedGCCRegisterName(Attr->getLabel(), true); diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 6425976..9f5a004 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -2218,9 +2218,10 @@ struct ConvertConstructorToDeductionGuideTransform { // Build the parameters, needed during deduction / substitution. SmallVector<ParmVarDecl*, 4> Params; for (auto T : ParamTypes) { - ParmVarDecl *NewParam = ParmVarDecl::Create( - SemaRef.Context, DC, Loc, Loc, nullptr, T, - SemaRef.Context.getTrivialTypeSourceInfo(T, Loc), SC_None, nullptr); + ParmVarDecl *NewParam = + ParmVarDecl::Create(SemaRef.Context, DC, Loc, Loc, nullptr, T, + SemaRef.Context.getTrivialTypeSourceInfo(T, Loc), + StorageClass::None, nullptr); NewParam->setScopeInfo(0, Params.size()); FPTL.setParam(Params.size(), NewParam); Params.push_back(NewParam); @@ -4331,9 +4332,10 @@ DeclResult Sema::ActOnVarTemplateSpecialization( // -- The argument list of the specialization shall not be identical // to the implicit argument list of the primary template. Diag(TemplateNameLoc, diag::err_partial_spec_args_match_primary_template) - << /*variable template*/ 1 - << /*is definition*/(SC != SC_Extern && !CurContext->isRecord()) - << FixItHint::CreateRemoval(SourceRange(LAngleLoc, RAngleLoc)); + << /*variable template*/ 1 + << /*is definition*/ (SC != StorageClass::Extern && + !CurContext->isRecord()) + << FixItHint::CreateRemoval(SourceRange(LAngleLoc, RAngleLoc)); // FIXME: Recover from this by treating the declaration as a redeclaration // of the primary template. return true; diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index d3d6df5..70e734d 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -2377,7 +2377,7 @@ Decl *TemplateDeclInstantiator::VisitCXXMethodDecl( Conversion->getConstexprKind(), Conversion->getEndLoc(), TrailingRequiresClause); } else { - StorageClass SC = D->isStatic() ? SC_Static : SC_None; + StorageClass SC = D->isStatic() ? StorageClass::Static : StorageClass::None; Method = CXXMethodDecl::Create(SemaRef.Context, Record, StartLoc, NameInfo, T, TInfo, SC, D->isInlineSpecified(), D->getConstexprKind(), D->getEndLoc(), |