From 5a3c1a32ba18b9a218e7597890257cf05a5a4eb8 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 31 Oct 2014 06:57:13 +0000 Subject: [PATCH] Remove StorageClass typedefs from VarDecl and FunctionDecl since StorageClass is in the clang namespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220956 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/Decl.h | 4 ---- lib/Sema/SemaDecl.cpp | 25 +++++++++++-------------- lib/Sema/SemaTemplate.cpp | 2 +- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 1b33f95284..017f5b8024 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -662,8 +662,6 @@ struct EvaluatedStmt { /// declaration or definition. class VarDecl : public DeclaratorDecl, public Redeclarable { public: - typedef clang::StorageClass StorageClass; - /// getStorageClassSpecifierString - Return the string used to /// specify the storage class \p SC. /// @@ -1437,8 +1435,6 @@ private: class FunctionDecl : public DeclaratorDecl, public DeclContext, public Redeclarable { public: - typedef clang::StorageClass StorageClass; - /// \brief The kind of templated function a FunctionDecl can be. enum TemplatedKind { TK_NonTemplate, diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index deac7c7d33..3d0ebf277d 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -3995,7 +3995,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, FieldCollector->Add(cast(Anon)); } else { DeclSpec::SCS SCSpec = DS.getStorageClassSpec(); - VarDecl::StorageClass SC = StorageClassSpecToVarDeclStorageClass(DS); + StorageClass SC = StorageClassSpecToVarDeclStorageClass(DS); if (SCSpec == DeclSpec::SCS_mutable) { // mutable can only appear on non-static class members, so it's always // an error here @@ -5325,8 +5325,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, DeclarationName Name = GetNameForDeclarator(D).getName(); DeclSpec::SCS SCSpec = D.getDeclSpec().getStorageClassSpec(); - VarDecl::StorageClass SC = - StorageClassSpecToVarDeclStorageClass(D.getDeclSpec()); + StorageClass SC = StorageClassSpecToVarDeclStorageClass(D.getDeclSpec()); // dllimport globals without explicit storage class are treated as extern. We // have to change the storage class this early to get the right DeclContext. @@ -6539,8 +6538,7 @@ static NamedDecl *DiagnoseInvalidRedeclaration( return nullptr; } -static FunctionDecl::StorageClass getFunctionStorageClass(Sema &SemaRef, - Declarator &D) { +static StorageClass getFunctionStorageClass(Sema &SemaRef, Declarator &D) { switch (D.getDeclSpec().getStorageClassSpec()) { default: llvm_unreachable("Unknown storage class!"); case DeclSpec::SCS_auto: @@ -6578,7 +6576,7 @@ static FunctionDecl::StorageClass getFunctionStorageClass(Sema &SemaRef, static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, DeclContext *DC, QualType &R, TypeSourceInfo *TInfo, - FunctionDecl::StorageClass SC, + StorageClass SC, bool &IsVirtualOkay) { DeclarationNameInfo NameInfo = SemaRef.GetNameForDeclarator(D); DeclarationName Name = NameInfo.getName(); @@ -6905,7 +6903,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // TODO: consider using NameInfo for diagnostic. DeclarationNameInfo NameInfo = GetNameForDeclarator(D); DeclarationName Name = NameInfo.getName(); - FunctionDecl::StorageClass SC = getFunctionStorageClass(*this, D); + StorageClass SC = getFunctionStorageClass(*this, D); if (DeclSpec::TSCS TSCS = D.getDeclSpec().getThreadStorageClassSpec()) Diag(D.getDeclSpec().getThreadStorageClassSpecLoc(), @@ -9757,12 +9755,12 @@ 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'. - VarDecl::StorageClass StorageClass = SC_None; + StorageClass SC = SC_None; if (DS.getStorageClassSpec() == DeclSpec::SCS_register) { - StorageClass = SC_Register; + SC = SC_Register; } else if (getLangOpts().CPlusPlus && DS.getStorageClassSpec() == DeclSpec::SCS_auto) { - StorageClass = SC_Auto; + SC = SC_Auto; } else if (DS.getStorageClassSpec() != DeclSpec::SCS_unspecified) { Diag(DS.getStorageClassSpecLoc(), diag::err_invalid_storage_class_in_func_decl); @@ -9836,7 +9834,7 @@ Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { D.getLocStart(), D.getIdentifierLoc(), II, parmDeclType, TInfo, - StorageClass); + SC); if (D.isInvalidType()) New->setInvalidDecl(); @@ -9928,7 +9926,7 @@ void Sema::DiagnoseSizeOfParametersAndReturnValue(ParmVarDecl * const *Param, ParmVarDecl *Sema::CheckParameter(DeclContext *DC, SourceLocation StartLoc, SourceLocation NameLoc, IdentifierInfo *Name, QualType T, TypeSourceInfo *TSInfo, - VarDecl::StorageClass StorageClass) { + StorageClass SC) { // In ARC, infer a lifetime qualifier for appropriate parameter types. if (getLangOpts().ObjCAutoRefCount && T.getObjCLifetime() == Qualifiers::OCL_None && @@ -9954,8 +9952,7 @@ ParmVarDecl *Sema::CheckParameter(DeclContext *DC, SourceLocation StartLoc, ParmVarDecl *New = ParmVarDecl::Create(Context, DC, StartLoc, NameLoc, Name, Context.getAdjustedParameterType(T), - TSInfo, - StorageClass, nullptr); + TSInfo, SC, nullptr); // Parameters can not be abstract class types. // For record types, this is done by the AbstractClassUsageDiagnoser once diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 42b42a5703..57d1ab8d75 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -2399,7 +2399,7 @@ makeTemplateArgumentListInfo(Sema &S, TemplateIdAnnotation &TemplateId) { DeclResult Sema::ActOnVarTemplateSpecialization( Scope *S, Declarator &D, TypeSourceInfo *DI, SourceLocation TemplateKWLoc, - TemplateParameterList *TemplateParams, VarDecl::StorageClass SC, + TemplateParameterList *TemplateParams, StorageClass SC, bool IsPartialSpecialization) { // D must be variable template id. assert(D.getName().getKind() == UnqualifiedId::IK_TemplateId && -- 2.40.0