[llvm-branch-commits] [clang] 2fd11e0 - Revert "[NFC, Refactor] Modernize StorageClass from Specifiers.h to a scoped enum (II)"
Thorsten Schütt via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jan 4 14:22:04 PST 2021
Author: Thorsten Schütt
Date: 2021-01-04T23:17:45+01:00
New Revision: 2fd11e0b1ef8bc6ea356670f15d78795aa8bb0e7
URL: https://github.com/llvm/llvm-project/commit/2fd11e0b1ef8bc6ea356670f15d78795aa8bb0e7
DIFF: https://github.com/llvm/llvm-project/commit/2fd11e0b1ef8bc6ea356670f15d78795aa8bb0e7.diff
LOG: Revert "[NFC, Refactor] Modernize StorageClass from Specifiers.h to a scoped enum (II)"
This reverts commit efc82c4ad2bcb256a4f4c20238d08cd3afba4d2d.
Added:
Modified:
clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp
clang-tools-extra/clang-tidy/google/FunctionNamingCheck.cpp
clang-tools-extra/clang-tidy/google/GlobalVariableDeclarationCheck.cpp
clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
clang/include/clang/AST/Decl.h
clang/include/clang/AST/DeclCXX.h
clang/include/clang/AST/DeclOpenMP.h
clang/include/clang/ASTMatchers/ASTMatchers.h
clang/include/clang/Basic/Specifiers.h
clang/lib/AST/ASTContext.cpp
clang/lib/AST/Decl.cpp
clang/lib/AST/DeclCXX.cpp
clang/lib/AST/DeclPrinter.cpp
clang/lib/AST/DeclTemplate.cpp
clang/lib/AST/Expr.cpp
clang/lib/AST/JSONNodeDumper.cpp
clang/lib/AST/ODRHash.cpp
clang/lib/AST/TextNodeDumper.cpp
clang/lib/Analysis/CFG.cpp
clang/lib/CodeGen/CGBlocks.cpp
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/CodeGen/CGDecl.cpp
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CGNonTrivialStruct.cpp
clang/lib/CodeGen/CGObjC.cpp
clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
clang/lib/CodeGen/CGStmt.cpp
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
clang/lib/Frontend/Rewrite/RewriteObjC.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaCoroutine.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaDeclObjC.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaExprObjC.cpp
clang/lib/Sema/SemaLambda.cpp
clang/lib/Sema/SemaLookup.cpp
clang/lib/Sema/SemaObjCProperty.cpp
clang/lib/Sema/SemaOpenMP.cpp
clang/lib/Sema/SemaPseudoObject.cpp
clang/lib/Sema/SemaStmt.cpp
clang/lib/Sema/SemaStmtAsm.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTWriterDecl.cpp
clang/tools/libclang/CIndex.cpp
clang/unittests/Sema/ExternalSemaSourceTest.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp b/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp
index cf00f74dcd8d..c5ff44c4e50b 100644
--- a/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp
+++ b/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp
@@ -632,7 +632,8 @@ void ChangeNamespaceTool::run(
return;
// Ignore out-of-line static methods since they will be handled by nested
// name specifiers.
- if (Func->getCanonicalDecl()->getStorageClass() == StorageClass::Static &&
+ if (Func->getCanonicalDecl()->getStorageClass() ==
+ StorageClass::SC_Static &&
Func->isOutOfLine())
return;
const auto *Context = Result.Nodes.getNodeAs<Decl>("dc");
diff --git a/clang-tools-extra/clang-tidy/google/FunctionNamingCheck.cpp b/clang-tools-extra/clang-tidy/google/FunctionNamingCheck.cpp
index 7055b536511a..f29d650bf5fc 100644
--- a/clang-tools-extra/clang-tidy/google/FunctionNamingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/google/FunctionNamingCheck.cpp
@@ -51,7 +51,7 @@ FixItHint generateFixItHint(const FunctionDecl *Decl) {
// A fixit can be generated for functions of static storage class but
// otherwise the check cannot determine the appropriate function name prefix
// to use.
- if (Decl->getStorageClass() != StorageClass::Static)
+ if (Decl->getStorageClass() != SC_Static)
return FixItHint();
StringRef Name = Decl->getName();
@@ -109,7 +109,7 @@ void FunctionNamingCheck::registerMatchers(MatchFinder *Finder) {
void FunctionNamingCheck::check(const MatchFinder::MatchResult &Result) {
const auto *MatchedDecl = Result.Nodes.getNodeAs<FunctionDecl>("function");
- bool IsGlobal = MatchedDecl->getStorageClass() != StorageClass::Static;
+ bool IsGlobal = MatchedDecl->getStorageClass() != SC_Static;
diag(MatchedDecl->getLocation(),
"%select{static function|function in global namespace}1 named %0 must "
"%select{be in|have an appropriate prefix followed by}1 Pascal case as "
diff --git a/clang-tools-extra/clang-tidy/google/GlobalVariableDeclarationCheck.cpp b/clang-tools-extra/clang-tidy/google/GlobalVariableDeclarationCheck.cpp
index 8f538944307d..8b718ad97d90 100644
--- a/clang-tools-extra/clang-tidy/google/GlobalVariableDeclarationCheck.cpp
+++ b/clang-tools-extra/clang-tidy/google/GlobalVariableDeclarationCheck.cpp
@@ -26,7 +26,7 @@ namespace {
AST_MATCHER(VarDecl, isLocalVariable) { return Node.isLocalVarDecl(); }
FixItHint generateFixItHint(const VarDecl *Decl, bool IsConst) {
- if (IsConst && (Decl->getStorageClass() != StorageClass::Static)) {
+ if (IsConst && (Decl->getStorageClass() != SC_Static)) {
// No fix available if it is not a static constant, since it is
diff icult
// to determine the proper fix in this case.
return FixItHint();
diff --git a/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
index 997aa7709633..bbb1e8c65a4f 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
@@ -359,9 +359,8 @@ void UseTrailingReturnTypeCheck::keepSpecifiers(
// inline int.
const auto *M = dyn_cast<CXXMethodDecl>(&F);
if (!F.isConstexpr() && !F.isInlineSpecified() &&
- F.getStorageClass() != StorageClass::Extern &&
- F.getStorageClass() != StorageClass::Static && !Fr &&
- !(M && M->isVirtualAsWritten()))
+ F.getStorageClass() != SC_Extern && F.getStorageClass() != SC_Static &&
+ !Fr && !(M && M->isVirtualAsWritten()))
return;
// Tokenize return type. If it contains macros which contain a mix of
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index e73ec070113f..47c282f0a63d 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -1057,7 +1057,7 @@ class VarDecl : public DeclaratorDecl, public Redeclarable<VarDecl> {
/// Returns true if a variable with function scope is a non-static local
/// variable.
bool hasLocalStorage() const {
- if (getStorageClass() == StorageClass::None) {
+ if (getStorageClass() == SC_None) {
// OpenCL v1.2 s6.5.3: The __constant or constant address space name is
// used to describe variables allocated in global memory and which are
// accessed inside a kernel(s) as read-only variables. As such, variables
@@ -1069,40 +1069,29 @@ class VarDecl : public DeclaratorDecl, public Redeclarable<VarDecl> {
}
// Global Named Register (GNU extension)
- if (getStorageClass() == StorageClass::Register && !isLocalVarDeclOrParm())
+ if (getStorageClass() == SC_Register && !isLocalVarDeclOrParm())
return false;
// Return true for: Auto, Register.
// Return false for: Extern, Static, PrivateExtern, OpenCLWorkGroupLocal.
- switch (getStorageClass()) {
- case StorageClass::Auto:
- case StorageClass::Register:
- return true;
- case StorageClass::Extern:
- case StorageClass::None:
- case StorageClass::PrivateExtern:
- case StorageClass::Static:
- return false;
- }
- llvm_unreachable("unknown storage class");
+ return getStorageClass() >= SC_Auto;
}
/// Returns true if a variable with function scope is a static local
/// variable.
bool isStaticLocal() const {
- return (getStorageClass() == StorageClass::Static ||
+ return (getStorageClass() == SC_Static ||
// C++11 [dcl.stc]p4
- (getStorageClass() == StorageClass::None &&
- getTSCSpec() == TSCS_thread_local)) &&
- !isFileVarDecl();
+ (getStorageClass() == SC_None && getTSCSpec() == TSCS_thread_local))
+ && !isFileVarDecl();
}
/// Returns true if a variable has extern or __private_extern__
/// storage.
bool hasExternalStorage() const {
- return getStorageClass() == StorageClass::Extern ||
- getStorageClass() == StorageClass::PrivateExtern;
+ return getStorageClass() == SC_Extern ||
+ getStorageClass() == SC_PrivateExtern;
}
/// Returns true for all variables that do not have local storage.
@@ -1604,7 +1593,7 @@ class ImplicitParamDecl : public VarDecl {
IdentifierInfo *Id, QualType Type,
ImplicitParamKind ParamKind)
: VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type,
- /*TInfo=*/nullptr, StorageClass::None) {
+ /*TInfo=*/nullptr, SC_None) {
NonParmVarDeclBits.ImplicitParamKind = ParamKind;
setImplicit();
}
@@ -1612,7 +1601,7 @@ class ImplicitParamDecl : public VarDecl {
ImplicitParamDecl(ASTContext &C, QualType Type, ImplicitParamKind ParamKind)
: VarDecl(ImplicitParam, C, /*DC=*/nullptr, SourceLocation(),
SourceLocation(), /*Id=*/nullptr, Type,
- /*TInfo=*/nullptr, StorageClass::None) {
+ /*TInfo=*/nullptr, SC_None) {
NonParmVarDeclBits.ImplicitParamKind = ParamKind;
setImplicit();
}
@@ -2549,7 +2538,7 @@ class FunctionDecl : public DeclaratorDecl,
/// Sets the storage class as written in the source.
void setStorageClass(StorageClass SClass) {
- FunctionDeclBits.SClass = static_cast<uint64_t>(SClass);
+ FunctionDeclBits.SClass = SClass;
}
/// Determine whether the "inline" keyword was specified for this
@@ -2576,7 +2565,7 @@ class FunctionDecl : public DeclaratorDecl,
bool doesDeclarationForceExternallyVisibleDefinition() const;
- bool isStatic() const { return getStorageClass() == StorageClass::Static; }
+ bool isStatic() const { return getStorageClass() == SC_Static; }
/// Whether this function declaration represents an C++ overloaded
/// operator, e.g., "operator+".
diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h
index 4db19dff7bcf..568eeb614a76 100644
--- a/clang/include/clang/AST/DeclCXX.h
+++ b/clang/include/clang/AST/DeclCXX.h
@@ -1843,7 +1843,7 @@ class CXXDeductionGuideDecl : public FunctionDecl {
const DeclarationNameInfo &NameInfo, QualType T,
TypeSourceInfo *TInfo, SourceLocation EndLocation)
: FunctionDecl(CXXDeductionGuide, C, DC, StartLoc, NameInfo, T, TInfo,
- StorageClass::None, false, ConstexprSpecKind::Unspecified),
+ SC_None, false, ConstexprSpecKind::Unspecified),
ExplicitSpec(ES) {
if (EndLocation.isValid())
setRangeEnd(EndLocation);
@@ -2657,8 +2657,8 @@ class CXXDestructorDecl : public CXXMethodDecl {
bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind,
Expr *TrailingRequiresClause = nullptr)
: CXXMethodDecl(CXXDestructor, C, RD, StartLoc, NameInfo, T, TInfo,
- StorageClass::None, isInline, ConstexprKind,
- SourceLocation(), TrailingRequiresClause) {
+ SC_None, isInline, ConstexprKind, SourceLocation(),
+ TrailingRequiresClause) {
setImplicit(isImplicitlyDeclared);
}
@@ -2713,7 +2713,7 @@ class CXXConversionDecl : public CXXMethodDecl {
ConstexprSpecKind ConstexprKind, SourceLocation EndLocation,
Expr *TrailingRequiresClause = nullptr)
: CXXMethodDecl(CXXConversion, C, RD, StartLoc, NameInfo, T, TInfo,
- StorageClass::None, isInline, ConstexprKind, EndLocation,
+ SC_None, isInline, ConstexprKind, EndLocation,
TrailingRequiresClause),
ExplicitSpec(ES) {}
void anchor() override;
diff --git a/clang/include/clang/AST/DeclOpenMP.h b/clang/include/clang/AST/DeclOpenMP.h
index f4de3b2e0839..e595ec98d914 100644
--- a/clang/include/clang/AST/DeclOpenMP.h
+++ b/clang/include/clang/AST/DeclOpenMP.h
@@ -388,7 +388,7 @@ class OMPCapturedExprDecl final : public VarDecl {
QualType Type, TypeSourceInfo *TInfo,
SourceLocation StartLoc)
: VarDecl(OMPCapturedExpr, C, DC, StartLoc, StartLoc, Id, Type, TInfo,
- StorageClass::None) {
+ SC_None) {
setImplicit();
}
diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h
index b01cf4579d14..ba2dd862f171 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchers.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -4723,7 +4723,7 @@ AST_POLYMORPHIC_MATCHER(isExternC, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl,
AST_POLYMORPHIC_MATCHER(isStaticStorageClass,
AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl,
VarDecl)) {
- return Node.getStorageClass() == StorageClass::Static;
+ return Node.getStorageClass() == SC_Static;
}
/// Matches deleted function declarations.
diff --git a/clang/include/clang/Basic/Specifiers.h b/clang/include/clang/Basic/Specifiers.h
index 252f7babb125..07d8177b8ab2 100644
--- a/clang/include/clang/Basic/Specifiers.h
+++ b/clang/include/clang/Basic/Specifiers.h
@@ -220,31 +220,21 @@ namespace clang {
};
/// Storage classes.
- enum class StorageClass {
+ enum StorageClass {
// These are legal on both functions and variables.
- None,
- Extern,
- Static,
- PrivateExtern,
+ SC_None,
+ SC_Extern,
+ SC_Static,
+ SC_PrivateExtern,
// These are only legal on variables.
- Auto,
- Register
+ SC_Auto,
+ SC_Register
};
/// Checks whether the given storage class is legal for functions.
inline bool isLegalForFunction(StorageClass SC) {
- switch (SC) {
- case StorageClass::None:
- case StorageClass::Extern:
- case StorageClass::Static:
- case StorageClass::PrivateExtern:
- return true;
- case StorageClass::Auto:
- case StorageClass::Register:
- return false;
- }
- llvm_unreachable("unknown storage class");
+ return SC <= SC_PrivateExtern;
}
/// Checks whether the given storage class is legal for variables.
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 098e8ac1130a..44545f00b146 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -10681,7 +10681,7 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
if (!VD->isFileVarDecl())
return false;
// Global named register variables (GNU extension) are never emitted.
- if (VD->getStorageClass() == StorageClass::Register)
+ if (VD->getStorageClass() == SC_Register)
return false;
if (VD->getDescribedVarTemplate() ||
isa<VarTemplatePartialSpecializationDecl>(VD))
@@ -11441,7 +11441,7 @@ bool ASTContext::mayExternalizeStaticVar(const Decl *D) const {
(D->hasAttr<CUDAConstantAttr>() &&
!D->getAttr<CUDAConstantAttr>()->isImplicit())) &&
isa<VarDecl>(D) && cast<VarDecl>(D)->isFileVarDecl() &&
- cast<VarDecl>(D)->getStorageClass() == StorageClass::Static;
+ cast<VarDecl>(D)->getStorageClass() == SC_Static;
}
bool ASTContext::shouldExternalizeStaticVar(const Decl *D) const {
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index f28f983d6a37..3cea3c23b527 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -620,7 +620,7 @@ static StorageClass getStorageClass(const Decl *D) {
if (auto *FD = dyn_cast<FunctionDecl>(D))
return FD->getStorageClass();
}
- return StorageClass::None;
+ return SC_None;
}
LinkageInfo
@@ -635,7 +635,7 @@ LinkageComputer::getLVForNamespaceScopeDecl(const NamedDecl *D,
// A name having namespace scope (3.3.6) has internal linkage if it
// is the name of
- if (getStorageClass(D->getCanonicalDecl()) == StorageClass::Static) {
+ if (getStorageClass(D->getCanonicalDecl()) == SC_Static) {
// - a variable, variable template, function, or function template
// that is explicitly declared static; or
// (This bullet corresponds to C99 6.2.2p3.)
@@ -660,19 +660,19 @@ LinkageComputer::getLVForNamespaceScopeDecl(const NamedDecl *D,
if (PrevVar)
return getLVForDecl(PrevVar, computation);
- if (Var->getStorageClass() != StorageClass::Extern &&
- Var->getStorageClass() != StorageClass::PrivateExtern &&
+ if (Var->getStorageClass() != SC_Extern &&
+ Var->getStorageClass() != SC_PrivateExtern &&
!isSingleLineLanguageLinkage(*Var))
return getInternalLinkageFor(Var);
}
for (const VarDecl *PrevVar = Var->getPreviousDecl(); PrevVar;
PrevVar = PrevVar->getPreviousDecl()) {
- if (PrevVar->getStorageClass() == StorageClass::PrivateExtern &&
- Var->getStorageClass() == StorageClass::None)
+ if (PrevVar->getStorageClass() == SC_PrivateExtern &&
+ Var->getStorageClass() == SC_None)
return getDeclLinkageAndVisibility(PrevVar);
// Explicitly declared static.
- if (PrevVar->getStorageClass() == StorageClass::Static)
+ if (PrevVar->getStorageClass() == SC_Static)
return getInternalLinkageFor(Var);
}
} else if (const auto *IFD = dyn_cast<IndirectFieldDecl>(D)) {
@@ -789,7 +789,7 @@ LinkageComputer::getLVForNamespaceScopeDecl(const NamedDecl *D,
LV.mergeVisibility(TypeLV);
}
- if (Var->getStorageClass() == StorageClass::PrivateExtern)
+ if (Var->getStorageClass() == SC_PrivateExtern)
LV.mergeVisibility(HiddenVisibility, true);
// Note that Sema::MergeVarDecl already takes care of implementing
@@ -810,7 +810,7 @@ LinkageComputer::getLVForNamespaceScopeDecl(const NamedDecl *D,
// for justification). In practice, GCC doesn't do this, so it's
// just too painful to make work.
- if (Function->getStorageClass() == StorageClass::PrivateExtern)
+ if (Function->getStorageClass() == SC_PrivateExtern)
LV.mergeVisibility(HiddenVisibility, true);
// Note that Sema::MergeCompatibleFunctionDecls already takes care of
@@ -1229,7 +1229,7 @@ LinkageInfo LinkageComputer::getLVForLocalDecl(const NamedDecl *D,
return getInternalLinkageFor(Function);
// This is a "void f();" which got merged with a file static.
- if (Function->getCanonicalDecl()->getStorageClass() == StorageClass::Static)
+ if (Function->getCanonicalDecl()->getStorageClass() == SC_Static)
return getInternalLinkageFor(Function);
LinkageInfo LV;
@@ -1252,7 +1252,7 @@ LinkageInfo LinkageComputer::getLVForLocalDecl(const NamedDecl *D,
return getInternalLinkageFor(Var);
LinkageInfo LV;
- if (Var->getStorageClass() == StorageClass::PrivateExtern)
+ if (Var->getStorageClass() == SC_PrivateExtern)
LV.mergeVisibility(HiddenVisibility, true);
else if (!hasExplicitVisibilityAlready(computation)) {
if (Optional<Visibility> Vis = getExplicitVisibility(Var, computation))
@@ -1962,18 +1962,12 @@ void QualifierInfo::setTemplateParameterListsInfo(
const char *VarDecl::getStorageClassSpecifierString(StorageClass SC) {
switch (SC) {
- case StorageClass::None:
- break;
- case StorageClass::Auto:
- return "auto";
- case StorageClass::Extern:
- return "extern";
- case StorageClass::PrivateExtern:
- return "__private_extern__";
- case StorageClass::Register:
- return "register";
- case StorageClass::Static:
- return "static";
+ case SC_None: break;
+ case SC_Auto: return "auto";
+ case SC_Extern: return "extern";
+ case SC_PrivateExtern: return "__private_extern__";
+ case SC_Register: return "register";
+ case SC_Static: return "static";
}
llvm_unreachable("Invalid storage class");
@@ -1992,7 +1986,7 @@ VarDecl::VarDecl(Kind DK, ASTContext &C, DeclContext *DC,
static_assert(sizeof(NonParmVarDeclBitfields) <= sizeof(unsigned),
"NonParmVarDeclBitfields too large!");
AllBits = 0;
- VarDeclBits.SClass = static_cast<unsigned>(SC);
+ VarDeclBits.SClass = SC;
// Everything else is implicitly initialized to false.
}
@@ -2006,12 +2000,12 @@ VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC,
VarDecl *VarDecl::CreateDeserialized(ASTContext &C, unsigned ID) {
return new (C, ID)
VarDecl(Var, C, nullptr, SourceLocation(), SourceLocation(), nullptr,
- QualType(), nullptr, StorageClass::None);
+ QualType(), nullptr, SC_None);
}
void VarDecl::setStorageClass(StorageClass SC) {
assert(isLegalForVariable(SC));
- VarDeclBits.SClass = static_cast<unsigned>(SC);
+ VarDeclBits.SClass = SC;
}
VarDecl::TLSKind VarDecl::getTLSKind() const {
@@ -2726,7 +2720,7 @@ QualType ParmVarDecl::getOriginalType() const {
ParmVarDecl *ParmVarDecl::CreateDeserialized(ASTContext &C, unsigned ID) {
return new (C, ID)
ParmVarDecl(ParmVar, C, nullptr, SourceLocation(), SourceLocation(),
- nullptr, QualType(), nullptr, StorageClass::None, nullptr);
+ nullptr, QualType(), nullptr, SC_None, nullptr);
}
SourceRange ParmVarDecl::getSourceRange() const {
@@ -2836,7 +2830,7 @@ FunctionDecl::FunctionDecl(Kind DK, ASTContext &C, DeclContext *DC,
DeclContext(DK), redeclarable_base(C), Body(), ODRHash(0),
EndRangeLoc(NameInfo.getEndLoc()), DNLoc(NameInfo.getInfo()) {
assert(T.isNull() || T->isFunctionType());
- FunctionDeclBits.SClass = static_cast<uint64_t>(S);
+ FunctionDeclBits.SClass = S;
FunctionDeclBits.IsInline = isInlineSpecified;
FunctionDeclBits.IsInlineSpecified = isInlineSpecified;
FunctionDeclBits.IsVirtualAsWritten = false;
@@ -3187,7 +3181,7 @@ bool FunctionDecl::isGlobal() const {
if (const auto *Method = dyn_cast<CXXMethodDecl>(this))
return Method->isStatic();
- if (getCanonicalDecl()->getStorageClass() == StorageClass::Static)
+ if (getCanonicalDecl()->getStorageClass() == SC_Static)
return false;
for (const DeclContext *DC = getDeclContext();
@@ -3294,7 +3288,7 @@ unsigned FunctionDecl::getBuiltinID(bool ConsiderWrapperFunctions) const {
// function or whether it just has the same name.
// If this is a static function, it's not a builtin.
- if (!ConsiderWrapperFunctions && getStorageClass() == StorageClass::Static)
+ if (!ConsiderWrapperFunctions && getStorageClass() == SC_Static)
return 0;
// OpenCL v1.2 s6.9.f - The library functions defined in
@@ -3386,19 +3380,19 @@ bool FunctionDecl::isMSExternInline() const {
for (const FunctionDecl *FD = getMostRecentDecl(); FD;
FD = FD->getPreviousDecl())
- if (!FD->isImplicit() && FD->getStorageClass() == StorageClass::Extern)
+ if (!FD->isImplicit() && FD->getStorageClass() == SC_Extern)
return true;
return false;
}
static bool redeclForcesDefMSVC(const FunctionDecl *Redecl) {
- if (Redecl->getStorageClass() != StorageClass::Extern)
+ if (Redecl->getStorageClass() != SC_Extern)
return false;
for (const FunctionDecl *FD = Redecl->getPreviousDecl(); FD;
FD = FD->getPreviousDecl())
- if (!FD->isImplicit() && FD->getStorageClass() == StorageClass::Extern)
+ if (!FD->isImplicit() && FD->getStorageClass() == SC_Extern)
return false;
return true;
@@ -3414,8 +3408,7 @@ static bool RedeclForcesDefC99(const FunctionDecl *Redecl) {
if (Redecl->isImplicit())
return false;
- if (!Redecl->isInlineSpecified() ||
- Redecl->getStorageClass() == StorageClass::Extern)
+ if (!Redecl->isInlineSpecified() || Redecl->getStorageClass() == SC_Extern)
return true; // Not an inline definition
return false;
@@ -3449,7 +3442,7 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const {
//
// FIXME: What happens if gnu_inline gets added on after the first
// declaration?
- if (!isInlineSpecified() || getStorageClass() == StorageClass::Extern)
+ if (!isInlineSpecified() || getStorageClass() == SC_Extern)
return false;
const FunctionDecl *Prev = this;
@@ -3461,10 +3454,10 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const {
// If it's not the case that both 'inline' and 'extern' are
// specified on the definition, then it is always externally visible.
if (!Prev->isInlineSpecified() ||
- Prev->getStorageClass() != StorageClass::Extern)
+ Prev->getStorageClass() != SC_Extern)
return false;
} else if (Prev->isInlineSpecified() &&
- Prev->getStorageClass() != StorageClass::Extern) {
+ Prev->getStorageClass() != SC_Extern) {
return false;
}
}
@@ -3475,7 +3468,7 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const {
// [...] If all of the file scope declarations for a function in a
// translation unit include the inline function specifier without extern,
// then the definition in that translation unit is an inline definition.
- if (isInlineSpecified() && getStorageClass() != StorageClass::Extern)
+ if (isInlineSpecified() && getStorageClass() != SC_Extern)
return false;
const FunctionDecl *Prev = this;
bool FoundBody = false;
@@ -3563,14 +3556,14 @@ bool FunctionDecl::isInlineDefinitionExternallyVisible() const {
// externally visible.
if (Context.getLangOpts().CPlusPlus)
return false;
- if (!(isInlineSpecified() && getStorageClass() == StorageClass::Extern))
+ if (!(isInlineSpecified() && getStorageClass() == SC_Extern))
return true;
// If any declaration is 'inline' but not 'extern', then this definition
// is externally visible.
for (auto Redecl : redecls()) {
if (Redecl->isInlineSpecified() &&
- Redecl->getStorageClass() != StorageClass::Extern)
+ Redecl->getStorageClass() != SC_Extern)
return true;
}
@@ -4845,10 +4838,9 @@ FunctionDecl *FunctionDecl::Create(ASTContext &C, DeclContext *DC,
}
FunctionDecl *FunctionDecl::CreateDeserialized(ASTContext &C, unsigned ID) {
- return new (C, ID) FunctionDecl(Function, C, nullptr, SourceLocation(),
- DeclarationNameInfo(), QualType(), nullptr,
- StorageClass::None, false,
- ConstexprSpecKind::Unspecified, nullptr);
+ return new (C, ID) FunctionDecl(
+ Function, C, nullptr, SourceLocation(), DeclarationNameInfo(), QualType(),
+ nullptr, SC_None, false, ConstexprSpecKind::Unspecified, nullptr);
}
BlockDecl *BlockDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L) {
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index d533622dc158..b806adf36bfb 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -2085,7 +2085,7 @@ void CXXMethodDecl::anchor() {}
bool CXXMethodDecl::isStatic() const {
const CXXMethodDecl *MD = getCanonicalDecl();
- if (MD->getStorageClass() == StorageClass::Static)
+ if (MD->getStorageClass() == SC_Static)
return true;
OverloadedOperatorKind OOK = getDeclName().getCXXOverloadedOperator();
@@ -2187,10 +2187,10 @@ CXXMethodDecl *CXXMethodDecl::Create(ASTContext &C, CXXRecordDecl *RD,
}
CXXMethodDecl *CXXMethodDecl::CreateDeserialized(ASTContext &C, unsigned ID) {
- return new (C, ID) CXXMethodDecl(
- CXXMethod, C, nullptr, SourceLocation(), DeclarationNameInfo(),
- QualType(), nullptr, StorageClass::None, false,
- ConstexprSpecKind::Unspecified, SourceLocation(), nullptr);
+ return new (C, ID)
+ CXXMethodDecl(CXXMethod, C, nullptr, SourceLocation(),
+ DeclarationNameInfo(), QualType(), nullptr, SC_None, false,
+ ConstexprSpecKind::Unspecified, SourceLocation(), nullptr);
}
CXXMethodDecl *CXXMethodDecl::getDevirtualizedMethod(const Expr *Base,
@@ -2567,8 +2567,8 @@ CXXConstructorDecl::CXXConstructorDecl(
ConstexprSpecKind ConstexprKind, InheritedConstructor Inherited,
Expr *TrailingRequiresClause)
: CXXMethodDecl(CXXConstructor, C, RD, StartLoc, NameInfo, T, TInfo,
- StorageClass::None, isInline, ConstexprKind,
- SourceLocation(), TrailingRequiresClause) {
+ SC_None, isInline, ConstexprKind, SourceLocation(),
+ TrailingRequiresClause) {
setNumCtorInitializers(0);
setInheritingConstructor(static_cast<bool>(Inherited));
setImplicit(isImplicitlyDeclared);
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index 68327d51a3b0..ca64f8f6cfbe 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -600,19 +600,11 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
CXXDeductionGuideDecl *GuideDecl = dyn_cast<CXXDeductionGuideDecl>(D);
if (!Policy.SuppressSpecifiers) {
switch (D->getStorageClass()) {
- case StorageClass::None:
- break;
- case StorageClass::Extern:
- Out << "extern ";
- break;
- case StorageClass::Static:
- Out << "static ";
- break;
- case StorageClass::PrivateExtern:
- Out << "__private_extern__ ";
- break;
- case StorageClass::Auto:
- case StorageClass::Register:
+ case SC_None: break;
+ case SC_Extern: Out << "extern "; break;
+ case SC_Static: Out << "static "; break;
+ case SC_PrivateExtern: Out << "__private_extern__ "; break;
+ case SC_Auto: case SC_Register:
llvm_unreachable("invalid for functions");
}
@@ -856,7 +848,7 @@ void DeclPrinter::VisitVarDecl(VarDecl *D) {
if (!Policy.SuppressSpecifiers) {
StorageClass SC = D->getStorageClass();
- if (SC != StorageClass::None)
+ if (SC != SC_None)
Out << VarDecl::getStorageClassSpecifierString(SC) << " ";
switch (D->getTSCSpec()) {
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index 77779385c081..25235c56ec46 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -1226,7 +1226,7 @@ VarTemplateSpecializationDecl::VarTemplateSpecializationDecl(
VarTemplateSpecializationDecl::VarTemplateSpecializationDecl(Kind DK,
ASTContext &C)
: VarDecl(DK, C, nullptr, SourceLocation(), SourceLocation(), nullptr,
- QualType(), nullptr, StorageClass::None),
+ QualType(), nullptr, SC_None),
SpecializationKind(TSK_Undeclared), IsCompleteDefinition(false) {}
VarTemplateSpecializationDecl *VarTemplateSpecializationDecl::Create(
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index cf46a4b41660..a274bf37a407 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -3835,7 +3835,7 @@ bool Expr::refersToGlobalRegisterVar() const {
if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
if (const auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
- if (VD->getStorageClass() == StorageClass::Register &&
+ if (VD->getStorageClass() == SC_Register &&
VD->hasAttr<AsmLabelAttr>() && !VD->isLocalVarDecl())
return true;
diff --git a/clang/lib/AST/JSONNodeDumper.cpp b/clang/lib/AST/JSONNodeDumper.cpp
index 04f8de424853..7b99546bbe2d 100644
--- a/clang/lib/AST/JSONNodeDumper.cpp
+++ b/clang/lib/AST/JSONNodeDumper.cpp
@@ -765,7 +765,7 @@ void JSONNodeDumper::VisitVarDecl(const VarDecl *VD) {
JOS.attribute("type", createQualType(VD->getType()));
StorageClass SC = VD->getStorageClass();
- if (SC != StorageClass::None)
+ if (SC != SC_None)
JOS.attribute("storageClass", VarDecl::getStorageClassSpecifierString(SC));
switch (VD->getTLSKind()) {
case VarDecl::TLS_Dynamic: JOS.attribute("tls", "dynamic"); break;
@@ -799,7 +799,7 @@ void JSONNodeDumper::VisitFunctionDecl(const FunctionDecl *FD) {
VisitNamedDecl(FD);
JOS.attribute("type", createQualType(FD->getType()));
StorageClass SC = FD->getStorageClass();
- if (SC != StorageClass::None)
+ if (SC != SC_None)
JOS.attribute("storageClass", VarDecl::getStorageClassSpecifierString(SC));
attributeOnlyIfTrue("inline", FD->isInlineSpecified());
attributeOnlyIfTrue("virtual", FD->isVirtualAsWritten());
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index f8e3680e72f9..735bcff8f113 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -551,7 +551,7 @@ void ODRHash::AddFunctionDecl(const FunctionDecl *Function,
AddBoolean(Method->isVolatile());
}
- ID.AddInteger(static_cast<int>(Function->getStorageClass()));
+ ID.AddInteger(Function->getStorageClass());
AddBoolean(Function->isInlineSpecified());
AddBoolean(Function->isVirtualAsWritten());
AddBoolean(Function->isPure());
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index 86b7aac6fd5e..e3132752546f 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -1579,7 +1579,7 @@ void TextNodeDumper::VisitFunctionDecl(const FunctionDecl *D) {
dumpType(D->getType());
StorageClass SC = D->getStorageClass();
- if (SC != StorageClass::None)
+ if (SC != SC_None)
OS << ' ' << VarDecl::getStorageClassSpecifierString(SC);
if (D->isInlineSpecified())
OS << " inline";
@@ -1668,7 +1668,7 @@ void TextNodeDumper::VisitVarDecl(const VarDecl *D) {
dumpName(D);
dumpType(D->getType());
StorageClass SC = D->getStorageClass();
- if (SC != StorageClass::None)
+ if (SC != SC_None)
OS << ' ' << VarDecl::getStorageClassSpecifierString(SC);
switch (D->getTLSKind()) {
case VarDecl::TLS_None:
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index fcc6731bbec3..edc86c41c3b9 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/lib/Analysis/CFG.cpp
@@ -2023,9 +2023,9 @@ LocalScope* CFGBuilder::addLocalScopeForVarDecl(VarDecl *VD,
// Check if variable is local.
switch (VD->getStorageClass()) {
- case StorageClass::None:
- case StorageClass::Auto:
- case StorageClass::Register:
+ case SC_None:
+ case SC_Auto:
+ case SC_Register:
break;
default: return Scope;
}
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp
index a34f2e3ed08d..a4f09afa671b 100644
--- a/clang/lib/CodeGen/CGBlocks.cpp
+++ b/clang/lib/CodeGen/CGBlocks.cpp
@@ -1954,7 +1954,7 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) {
FunctionDecl *FD = FunctionDecl::Create(
C, C.getTranslationUnitDecl(), SourceLocation(), SourceLocation(), II,
- FunctionTy, nullptr, StorageClass::Static, false, false);
+ FunctionTy, nullptr, SC_Static, false, false);
setBlockHelperAttributesVisibility(blockInfo.CapturesNonExternalType, Fn, FI,
CGM);
// This is necessary to avoid inheriting the previous line number.
@@ -2148,7 +2148,7 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) {
FunctionDecl *FD = FunctionDecl::Create(
C, C.getTranslationUnitDecl(), SourceLocation(), SourceLocation(), II,
- FunctionTy, nullptr, StorageClass::Static, false, false);
+ FunctionTy, nullptr, SC_Static, false, false);
setBlockHelperAttributesVisibility(blockInfo.CapturesNonExternalType, Fn, FI,
CGM);
@@ -2400,10 +2400,9 @@ generateByrefCopyHelper(CodeGenFunction &CGF, const BlockByrefInfo &byrefInfo,
ArgTys.push_back(Context.VoidPtrTy);
QualType FunctionTy = Context.getFunctionType(ReturnTy, ArgTys, {});
- FunctionDecl *FD =
- FunctionDecl::Create(Context, Context.getTranslationUnitDecl(),
- SourceLocation(), SourceLocation(), II, FunctionTy,
- nullptr, StorageClass::Static, false, false);
+ FunctionDecl *FD = FunctionDecl::Create(
+ Context, Context.getTranslationUnitDecl(), SourceLocation(),
+ SourceLocation(), II, FunctionTy, nullptr, SC_Static, false, false);
CGF.CGM.SetInternalFunctionAttributes(GlobalDecl(), Fn, FI);
@@ -2476,10 +2475,9 @@ generateByrefDisposeHelper(CodeGenFunction &CGF,
ArgTys.push_back(Context.VoidPtrTy);
QualType FunctionTy = Context.getFunctionType(R, ArgTys, {});
- FunctionDecl *FD =
- FunctionDecl::Create(Context, Context.getTranslationUnitDecl(),
- SourceLocation(), SourceLocation(), II, FunctionTy,
- nullptr, StorageClass::Static, false, false);
+ FunctionDecl *FD = FunctionDecl::Create(
+ Context, Context.getTranslationUnitDecl(), SourceLocation(),
+ SourceLocation(), II, FunctionTy, nullptr, SC_Static, false, false);
CGF.CGM.SetInternalFunctionAttributes(GlobalDecl(), Fn, FI);
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index c5073c2e2482..6e98af407a9a 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -1700,7 +1700,7 @@ llvm::Function *CodeGenFunction::generateBuiltinOSLogHelperFunction(
IdentifierInfo *II = &Ctx.Idents.get(Name);
FunctionDecl *FD = FunctionDecl::Create(
Ctx, Ctx.getTranslationUnitDecl(), SourceLocation(), SourceLocation(), II,
- FuncionTy, nullptr, StorageClass::PrivateExtern, false, false);
+ FuncionTy, nullptr, SC_PrivateExtern, false, false);
// Avoid generating debug location info for the function.
FD->setImplicit();
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index b0b8601e14fc..a01638f0b67b 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -1388,7 +1388,7 @@ void CodeGenFunction::EmitAndRegisterVariableArrayDimensions(
auto *ArtificialDecl = VarDecl::Create(
getContext(), const_cast<DeclContext *>(D.getDeclContext()),
D.getLocation(), D.getLocation(), NameIdent, QT,
- getContext().CreateTypeSourceInfo(QT), StorageClass::Auto);
+ getContext().CreateTypeSourceInfo(QT), SC_Auto);
ArtificialDecl->setImplicit();
MD = DI->EmitDeclareOfAutoVariable(ArtificialDecl, VlaSize.NumElts,
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 9a09458e872e..3013fffcbf6d 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -2675,7 +2675,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
if (const auto *VD = dyn_cast<VarDecl>(ND)) {
// Global Named registers access via intrinsics only
- if (VD->getStorageClass() == StorageClass::Register &&
+ if (VD->getStorageClass() == SC_Register &&
VD->hasAttr<AsmLabelAttr>() && !VD->isLocalVarDecl())
return EmitGlobalNamedRegister(VD, CGM);
diff --git a/clang/lib/CodeGen/CGNonTrivialStruct.cpp b/clang/lib/CodeGen/CGNonTrivialStruct.cpp
index 1a4e295a4184..d134be83a9dc 100644
--- a/clang/lib/CodeGen/CGNonTrivialStruct.cpp
+++ b/clang/lib/CodeGen/CGNonTrivialStruct.cpp
@@ -476,7 +476,7 @@ template <class Derived> struct GenFuncBase {
FunctionDecl *FD = FunctionDecl::Create(
Ctx, Ctx.getTranslationUnitDecl(), SourceLocation(), SourceLocation(),
II, Ctx.getFunctionType(Ctx.VoidTy, llvm::None, {}), nullptr,
- StorageClass::PrivateExtern, false, false);
+ SC_PrivateExtern, false, false);
CodeGenFunction NewCGF(CGM);
setCGF(&NewCGF);
CGF->StartFunction(FD, Ctx.VoidTy, F, FI, Args);
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index 75a72edf0a7e..bdb9f4002f3c 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -3642,7 +3642,7 @@ CodeGenFunction::GenerateObjCAtomicSetterCopyHelperFunction(
FunctionDecl *FD = FunctionDecl::Create(
C, C.getTranslationUnitDecl(), SourceLocation(), SourceLocation(), II,
- FunctionTy, nullptr, StorageClass::Static, false, false);
+ FunctionTy, nullptr, SC_Static, false, false);
FunctionArgList args;
ImplicitParamDecl DstDecl(C, FD, SourceLocation(), /*Id=*/nullptr, DestTy,
@@ -3726,7 +3726,7 @@ CodeGenFunction::GenerateObjCAtomicGetterCopyHelperFunction(
FunctionDecl *FD = FunctionDecl::Create(
C, C.getTranslationUnitDecl(), SourceLocation(), SourceLocation(), II,
- FunctionTy, nullptr, StorageClass::Static, false, false);
+ FunctionTy, nullptr, SC_Static, false, false);
FunctionArgList args;
ImplicitParamDecl DstDecl(C, FD, SourceLocation(), /*Id=*/nullptr, DestTy,
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
index e7282ba0312e..a3540bd30ab3 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -4127,7 +4127,7 @@ CGOpenMPRuntimeGPU::translateParameter(const FieldDecl *FD,
const_cast<DeclContext *>(NativeParam->getDeclContext()),
NativeParam->getBeginLoc(), NativeParam->getLocation(),
NativeParam->getIdentifier(), ArgType,
- /*TInfo=*/nullptr, StorageClass::None, /*DefArg=*/nullptr);
+ /*TInfo=*/nullptr, SC_None, /*DefArg=*/nullptr);
}
Address
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 79994d197ad8..d67e73a2ec3b 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -1997,7 +1997,7 @@ AddVariableConstraints(const std::string &Constraint, const Expr &AsmExpr,
const VarDecl *Variable = dyn_cast<VarDecl>(&Value);
if (!Variable)
return Constraint;
- if (Variable->getStorageClass() != StorageClass::Register)
+ if (Variable->getStorageClass() != SC_Register)
return Constraint;
AsmLabelAttr *Attr = Variable->getAttr<AsmLabelAttr>();
if (!Attr)
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index dd3b16074cca..5e8d98cfe5ef 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -433,7 +433,7 @@ static llvm::Function *emitOutlinedFunctionPrologue(
DebugFunctionDecl = FunctionDecl::Create(
Ctx, Ctx.getTranslationUnitDecl(), FO.S->getBeginLoc(),
SourceLocation(), DeclarationName(), FunctionTy,
- Ctx.getTrivialTypeSourceInfo(FunctionTy), StorageClass::Static,
+ Ctx.getTrivialTypeSourceInfo(FunctionTy), SC_Static,
/*isInlineSpecified=*/false, /*hasWrittenPrototype=*/false);
}
for (const FieldDecl *FD : RD->fields()) {
@@ -468,7 +468,7 @@ static llvm::Function *emitOutlinedFunctionPrologue(
Ctx, DebugFunctionDecl,
CapVar ? CapVar->getBeginLoc() : FD->getBeginLoc(),
CapVar ? CapVar->getLocation() : FD->getLocation(), II, ArgType,
- /*TInfo=*/nullptr, StorageClass::None, /*DefArg=*/nullptr);
+ /*TInfo=*/nullptr, SC_None, /*DefArg=*/nullptr);
} else {
Arg = ImplicitParamDecl::Create(Ctx, /*DC=*/nullptr, FD->getLocation(),
II, ArgType, ImplicitParamDecl::Other);
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index 797d624f0eb2..50fb30a95cbb 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -2546,10 +2546,9 @@ static FunctionDecl *
createGlobalInitOrCleanupFnDecl(CodeGen::CodeGenModule &CGM, StringRef FnName) {
ASTContext &Ctx = CGM.getContext();
QualType FunctionTy = Ctx.getFunctionType(Ctx.VoidTy, llvm::None, {});
- return FunctionDecl::Create(Ctx, Ctx.getTranslationUnitDecl(),
- SourceLocation(), SourceLocation(),
- &Ctx.Idents.get(FnName), FunctionTy, nullptr,
- StorageClass::Static, false, false);
+ return FunctionDecl::Create(
+ Ctx, Ctx.getTranslationUnitDecl(), SourceLocation(), SourceLocation(),
+ &Ctx.Idents.get(FnName), FunctionTy, nullptr, SC_Static, false, false);
}
void CodeGenModule::unregisterGlobalDtorsWithUnAtExit() {
diff --git a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
index ae1ba80b6a23..b7c1e693413b 100644
--- a/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
+++ b/clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
@@ -58,8 +58,8 @@ class InterfaceStubFunctionsConsumer : public ASTConsumer {
if (isa<BlockDecl>(Parent) || isa<CXXMethodDecl>(Parent))
return true;
- if ((VD->getStorageClass() == StorageClass::Extern) ||
- (VD->getStorageClass() == StorageClass::Static &&
+ if ((VD->getStorageClass() == StorageClass::SC_Extern) ||
+ (VD->getStorageClass() == StorageClass::SC_Static &&
VD->getParentFunctionOrMethod() == nullptr))
return true;
}
@@ -75,7 +75,7 @@ class InterfaceStubFunctionsConsumer : public ASTConsumer {
if (MD->isDependentContext() || !MD->hasBody())
return true;
}
- if (FD->getStorageClass() == StorageClass::Static)
+ if (FD->getStorageClass() == StorageClass::SC_Static)
return true;
}
return false;
diff --git a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
index dd2a204076a4..9d5366bb161e 100644
--- a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
+++ b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
@@ -2318,9 +2318,11 @@ void RewriteModernObjC::SynthSelGetUidFunctionDecl() {
ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst()));
QualType getFuncType =
getSimpleFunctionType(Context->getObjCSelType(), ArgTys);
- SelGetUidFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), SelGetUidIdent,
- getFuncType, nullptr, StorageClass::Extern);
+ SelGetUidFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ SelGetUidIdent, getFuncType,
+ nullptr, SC_Extern);
}
void RewriteModernObjC::RewriteFunctionDecl(FunctionDecl *FD) {
@@ -2414,9 +2416,11 @@ void RewriteModernObjC::SynthSuperConstructorFunctionDecl() {
ArgTys.push_back(argT);
QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(),
ArgTys);
- SuperConstructorFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent,
- msgSendType, nullptr, StorageClass::Extern);
+ SuperConstructorFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ msgSendIdent, msgSendType,
+ nullptr, SC_Extern);
}
// SynthMsgSendFunctionDecl - id objc_msgSend(id self, SEL op, ...);
@@ -2431,9 +2435,11 @@ void RewriteModernObjC::SynthMsgSendFunctionDecl() {
ArgTys.push_back(argT);
QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(),
ArgTys, /*variadic=*/true);
- MsgSendFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent,
- msgSendType, nullptr, StorageClass::Extern);
+ MsgSendFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ msgSendIdent, msgSendType, nullptr,
+ SC_Extern);
}
// SynthMsgSendSuperFunctionDecl - id objc_msgSendSuper(void);
@@ -2443,9 +2449,11 @@ void RewriteModernObjC::SynthMsgSendSuperFunctionDecl() {
ArgTys.push_back(Context->VoidTy);
QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(),
ArgTys, /*variadic=*/true);
- MsgSendSuperFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent,
- msgSendType, nullptr, StorageClass::Extern);
+ MsgSendSuperFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ msgSendIdent, msgSendType,
+ nullptr, SC_Extern);
}
// SynthMsgSendStretFunctionDecl - id objc_msgSend_stret(id self, SEL op, ...);
@@ -2460,9 +2468,11 @@ void RewriteModernObjC::SynthMsgSendStretFunctionDecl() {
ArgTys.push_back(argT);
QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(),
ArgTys, /*variadic=*/true);
- MsgSendStretFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent,
- msgSendType, nullptr, StorageClass::Extern);
+ MsgSendStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ msgSendIdent, msgSendType,
+ nullptr, SC_Extern);
}
// SynthMsgSendSuperStretFunctionDecl -
@@ -2474,9 +2484,12 @@ void RewriteModernObjC::SynthMsgSendSuperStretFunctionDecl() {
ArgTys.push_back(Context->VoidTy);
QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(),
ArgTys, /*variadic=*/true);
- MsgSendSuperStretFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent,
- msgSendType, nullptr, StorageClass::Extern);
+ MsgSendSuperStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ msgSendIdent,
+ msgSendType, nullptr,
+ SC_Extern);
}
// SynthMsgSendFpretFunctionDecl - double objc_msgSend_fpret(id self, SEL op, ...);
@@ -2491,9 +2504,11 @@ void RewriteModernObjC::SynthMsgSendFpretFunctionDecl() {
ArgTys.push_back(argT);
QualType msgSendType = getSimpleFunctionType(Context->DoubleTy,
ArgTys, /*variadic=*/true);
- MsgSendFpretFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent,
- msgSendType, nullptr, StorageClass::Extern);
+ MsgSendFpretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ msgSendIdent, msgSendType,
+ nullptr, SC_Extern);
}
// SynthGetClassFunctionDecl - Class objc_getClass(const char *name);
@@ -2503,9 +2518,11 @@ void RewriteModernObjC::SynthGetClassFunctionDecl() {
ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst()));
QualType getClassType = getSimpleFunctionType(Context->getObjCClassType(),
ArgTys);
- GetClassFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), getClassIdent,
- getClassType, nullptr, StorageClass::Extern);
+ GetClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ getClassIdent, getClassType,
+ nullptr, SC_Extern);
}
// SynthGetSuperClassFunctionDecl - Class class_getSuperclass(Class cls);
@@ -2516,9 +2533,12 @@ void RewriteModernObjC::SynthGetSuperClassFunctionDecl() {
ArgTys.push_back(Context->getObjCClassType());
QualType getClassType = getSimpleFunctionType(Context->getObjCClassType(),
ArgTys);
- GetSuperClassFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), getSuperClassIdent,
- getClassType, nullptr, StorageClass::Extern);
+ GetSuperClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ getSuperClassIdent,
+ getClassType, nullptr,
+ SC_Extern);
}
// SynthGetMetaClassFunctionDecl - Class objc_getMetaClass(const char *name);
@@ -2528,9 +2548,11 @@ void RewriteModernObjC::SynthGetMetaClassFunctionDecl() {
ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst()));
QualType getClassType = getSimpleFunctionType(Context->getObjCClassType(),
ArgTys);
- GetMetaClassFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), getClassIdent,
- getClassType, nullptr, StorageClass::Extern);
+ GetMetaClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ getClassIdent, getClassType,
+ nullptr, SC_Extern);
}
Stmt *RewriteModernObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) {
@@ -2564,7 +2586,7 @@ Stmt *RewriteModernObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) {
VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, SourceLocation(),
SourceLocation(), &Context->Idents.get(S),
- strType, nullptr, StorageClass::Static);
+ strType, nullptr, SC_Static);
DeclRefExpr *DRE = new (Context)
DeclRefExpr(*Context, NewVD, false, strType, VK_LValue, SourceLocation());
Expr *Unop = UnaryOperator::Create(
@@ -3026,7 +3048,7 @@ static SourceLocation getFunctionSourceLocation (RewriteModernObjC &R,
if (!LSD->getRBraceLoc().isValid())
return LSD->getExternLoc();
}
- if (FD->getStorageClass() != StorageClass::None)
+ if (FD->getStorageClass() != SC_None)
R.RewriteBlockLiteralFunctionDecl(FD);
return FD->getTypeSpecStartLoc();
}
@@ -3151,9 +3173,9 @@ Expr *RewriteModernObjC::SynthMsgSendStretCallExpr(FunctionDecl *MsgSendStretFla
// AST for __Stretn(receiver, args).s;
IdentifierInfo *ID = &Context->Idents.get(name);
- FunctionDecl *FD = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), ID, FuncType,
- nullptr, StorageClass::Extern, false, false);
+ FunctionDecl *FD =
+ FunctionDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(),
+ ID, FuncType, nullptr, SC_Extern, false, false);
DeclRefExpr *DRE = new (Context)
DeclRefExpr(*Context, FD, false, castType, VK_RValue, SourceLocation());
CallExpr *STCE =
@@ -3571,9 +3593,9 @@ Stmt *RewriteModernObjC::RewriteObjCProtocolExpr(ObjCProtocolExpr *Exp) {
std::string Name = "_OBJC_PROTOCOL_REFERENCE_$_" +
Exp->getProtocol()->getNameAsString();
IdentifierInfo *ID = &Context->Idents.get(Name);
- VarDecl *VD =
- VarDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(), ID,
- getProtocolType(), nullptr, StorageClass::Extern);
+ VarDecl *VD = VarDecl::Create(*Context, TUDecl, SourceLocation(),
+ SourceLocation(), ID, getProtocolType(),
+ nullptr, SC_Extern);
DeclRefExpr *DRE = new (Context) DeclRefExpr(
*Context, VD, false, getProtocolType(), VK_LValue, SourceLocation());
CastExpr *castExpr = NoTypeInfoCStyleCastExpr(
@@ -4309,8 +4331,9 @@ std::string RewriteModernObjC::SynthesizeBlockDescriptor(std::string DescTag,
void RewriteModernObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart,
StringRef FunName) {
- bool RewriteSC = (GlobalVarDecl && !Blocks.empty() &&
- GlobalVarDecl->getStorageClass() == StorageClass::Static &&
+ bool RewriteSC = (GlobalVarDecl &&
+ !Blocks.empty() &&
+ GlobalVarDecl->getStorageClass() == SC_Static &&
GlobalVarDecl->getType().getCVRQualifiers());
if (RewriteSC) {
std::string SC(" void __");
@@ -4378,7 +4401,7 @@ void RewriteModernObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart,
// Must insert any 'const/volatile/static here. Since it has been
// removed as result of rewriting of block literals.
std::string SC;
- if (GlobalVarDecl->getStorageClass() == StorageClass::Static)
+ if (GlobalVarDecl->getStorageClass() == SC_Static)
SC = "static ";
if (GlobalVarDecl->getType().isConstQualified())
SC += "const ";
@@ -5178,8 +5201,8 @@ FunctionDecl *RewriteModernObjC::SynthBlockInitFunctionDecl(StringRef name) {
IdentifierInfo *ID = &Context->Idents.get(name);
QualType FType = Context->getFunctionNoProtoType(Context->VoidPtrTy);
return FunctionDecl::Create(*Context, TUDecl, SourceLocation(),
- SourceLocation(), ID, FType, nullptr,
- StorageClass::Extern, false, false);
+ SourceLocation(), ID, FType, nullptr, SC_Extern,
+ false, false);
}
Stmt *RewriteModernObjC::SynthBlockInitExpr(BlockExpr *Exp,
@@ -5275,10 +5298,9 @@ Stmt *RewriteModernObjC::SynthBlockInitExpr(BlockExpr *Exp,
// Initialize the block descriptor.
std::string DescData = "__" + FuncName + "_block_desc_" + BlockNumber + "_DATA";
- VarDecl *NewVD =
- VarDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(),
- &Context->Idents.get(DescData), Context->VoidPtrTy,
- nullptr, StorageClass::Static);
+ VarDecl *NewVD = VarDecl::Create(
+ *Context, TUDecl, SourceLocation(), SourceLocation(),
+ &Context->Idents.get(DescData), Context->VoidPtrTy, nullptr, SC_Static);
UnaryOperator *DescRefExpr = UnaryOperator::Create(
const_cast<ASTContext &>(*Context),
new (Context) DeclRefExpr(*Context, NewVD, false, Context->VoidPtrTy,
@@ -7466,10 +7488,10 @@ Stmt *RewriteModernObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) {
Context->getPointerType(Context->CharTy),
CK_BitCast,
BaseExpr);
- VarDecl *NewVD = VarDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(),
- &Context->Idents.get(IvarOffsetName), Context->UnsignedLongTy,
- nullptr, StorageClass::Extern);
+ VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, SourceLocation(),
+ SourceLocation(), &Context->Idents.get(IvarOffsetName),
+ Context->UnsignedLongTy, nullptr,
+ SC_Extern);
DeclRefExpr *DRE = new (Context)
DeclRefExpr(*Context, NewVD, false, Context->UnsignedLongTy,
VK_LValue, SourceLocation());
diff --git a/clang/lib/Frontend/Rewrite/RewriteObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
index 1032d565e6fd..543b3b09a9cc 100644
--- a/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
+++ b/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
@@ -2232,9 +2232,11 @@ void RewriteObjC::SynthSelGetUidFunctionDecl() {
ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst()));
QualType getFuncType =
getSimpleFunctionType(Context->getObjCSelType(), ArgTys);
- SelGetUidFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), SelGetUidIdent,
- getFuncType, nullptr, StorageClass::Extern);
+ SelGetUidFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ SelGetUidIdent, getFuncType,
+ nullptr, SC_Extern);
}
void RewriteObjC::RewriteFunctionDecl(FunctionDecl *FD) {
@@ -2325,9 +2327,11 @@ void RewriteObjC::SynthSuperConstructorFunctionDecl() {
ArgTys.push_back(argT);
QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(),
ArgTys);
- SuperConstructorFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent,
- msgSendType, nullptr, StorageClass::Extern);
+ SuperConstructorFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ msgSendIdent, msgSendType,
+ nullptr, SC_Extern);
}
// SynthMsgSendFunctionDecl - id objc_msgSend(id self, SEL op, ...);
@@ -2342,9 +2346,11 @@ void RewriteObjC::SynthMsgSendFunctionDecl() {
ArgTys.push_back(argT);
QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(),
ArgTys, /*variadic=*/true);
- MsgSendFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent,
- msgSendType, nullptr, StorageClass::Extern);
+ MsgSendFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ msgSendIdent, msgSendType,
+ nullptr, SC_Extern);
}
// SynthMsgSendSuperFunctionDecl - id objc_msgSendSuper(struct objc_super *, SEL op, ...);
@@ -2362,9 +2368,11 @@ void RewriteObjC::SynthMsgSendSuperFunctionDecl() {
ArgTys.push_back(argT);
QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(),
ArgTys, /*variadic=*/true);
- MsgSendSuperFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent,
- msgSendType, nullptr, StorageClass::Extern);
+ MsgSendSuperFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ msgSendIdent, msgSendType,
+ nullptr, SC_Extern);
}
// SynthMsgSendStretFunctionDecl - id objc_msgSend_stret(id self, SEL op, ...);
@@ -2379,9 +2387,11 @@ void RewriteObjC::SynthMsgSendStretFunctionDecl() {
ArgTys.push_back(argT);
QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(),
ArgTys, /*variadic=*/true);
- MsgSendStretFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent,
- msgSendType, nullptr, StorageClass::Extern);
+ MsgSendStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ msgSendIdent, msgSendType,
+ nullptr, SC_Extern);
}
// SynthMsgSendSuperStretFunctionDecl -
@@ -2401,9 +2411,12 @@ void RewriteObjC::SynthMsgSendSuperStretFunctionDecl() {
ArgTys.push_back(argT);
QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(),
ArgTys, /*variadic=*/true);
- MsgSendSuperStretFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent,
- msgSendType, nullptr, StorageClass::Extern);
+ MsgSendSuperStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ msgSendIdent,
+ msgSendType, nullptr,
+ SC_Extern);
}
// SynthMsgSendFpretFunctionDecl - double objc_msgSend_fpret(id self, SEL op, ...);
@@ -2418,9 +2431,11 @@ void RewriteObjC::SynthMsgSendFpretFunctionDecl() {
ArgTys.push_back(argT);
QualType msgSendType = getSimpleFunctionType(Context->DoubleTy,
ArgTys, /*variadic=*/true);
- MsgSendFpretFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent,
- msgSendType, nullptr, StorageClass::Extern);
+ MsgSendFpretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ msgSendIdent, msgSendType,
+ nullptr, SC_Extern);
}
// SynthGetClassFunctionDecl - id objc_getClass(const char *name);
@@ -2430,9 +2445,11 @@ void RewriteObjC::SynthGetClassFunctionDecl() {
ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst()));
QualType getClassType = getSimpleFunctionType(Context->getObjCIdType(),
ArgTys);
- GetClassFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), getClassIdent,
- getClassType, nullptr, StorageClass::Extern);
+ GetClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ getClassIdent, getClassType,
+ nullptr, SC_Extern);
}
// SynthGetSuperClassFunctionDecl - Class class_getSuperclass(Class cls);
@@ -2443,9 +2460,12 @@ void RewriteObjC::SynthGetSuperClassFunctionDecl() {
ArgTys.push_back(Context->getObjCClassType());
QualType getClassType = getSimpleFunctionType(Context->getObjCClassType(),
ArgTys);
- GetSuperClassFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), getSuperClassIdent,
- getClassType, nullptr, StorageClass::Extern);
+ GetSuperClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ getSuperClassIdent,
+ getClassType, nullptr,
+ SC_Extern);
}
// SynthGetMetaClassFunctionDecl - id objc_getMetaClass(const char *name);
@@ -2455,9 +2475,11 @@ void RewriteObjC::SynthGetMetaClassFunctionDecl() {
ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst()));
QualType getClassType = getSimpleFunctionType(Context->getObjCIdType(),
ArgTys);
- GetMetaClassFunctionDecl = FunctionDecl::Create(
- *Context, TUDecl, SourceLocation(), SourceLocation(), getClassIdent,
- getClassType, nullptr, StorageClass::Extern);
+ GetMetaClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
+ SourceLocation(),
+ SourceLocation(),
+ getClassIdent, getClassType,
+ nullptr, SC_Extern);
}
Stmt *RewriteObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) {
@@ -2491,7 +2513,7 @@ Stmt *RewriteObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) {
VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, SourceLocation(),
SourceLocation(), &Context->Idents.get(S),
- strType, nullptr, StorageClass::Static);
+ strType, nullptr, SC_Static);
DeclRefExpr *DRE = new (Context)
DeclRefExpr(*Context, NewVD, false, strType, VK_LValue, SourceLocation());
Expr *Unop = UnaryOperator::Create(
@@ -3027,9 +3049,9 @@ QualType RewriteObjC::getProtocolType() {
Stmt *RewriteObjC::RewriteObjCProtocolExpr(ObjCProtocolExpr *Exp) {
std::string Name = "_OBJC_PROTOCOL_" + Exp->getProtocol()->getNameAsString();
IdentifierInfo *ID = &Context->Idents.get(Name);
- VarDecl *VD =
- VarDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(), ID,
- getProtocolType(), nullptr, StorageClass::Extern);
+ VarDecl *VD = VarDecl::Create(*Context, TUDecl, SourceLocation(),
+ SourceLocation(), ID, getProtocolType(),
+ nullptr, SC_Extern);
DeclRefExpr *DRE = new (Context) DeclRefExpr(
*Context, VD, false, getProtocolType(), VK_LValue, SourceLocation());
Expr *DerefExpr = UnaryOperator::Create(
@@ -3523,8 +3545,9 @@ void RewriteObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart,
// Insert declaration for the function in which block literal is used.
if (CurFunctionDeclToDeclareForBlock && !Blocks.empty())
RewriteBlockLiteralFunctionDecl(CurFunctionDeclToDeclareForBlock);
- bool RewriteSC = (GlobalVarDecl && !Blocks.empty() &&
- GlobalVarDecl->getStorageClass() == StorageClass::Static &&
+ bool RewriteSC = (GlobalVarDecl &&
+ !Blocks.empty() &&
+ GlobalVarDecl->getStorageClass() == SC_Static &&
GlobalVarDecl->getType().getCVRQualifiers());
if (RewriteSC) {
std::string SC(" void __");
@@ -3588,7 +3611,7 @@ void RewriteObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart,
// Must insert any 'const/volatile/static here. Since it has been
// removed as result of rewriting of block literals.
std::string SC;
- if (GlobalVarDecl->getStorageClass() == StorageClass::Static)
+ if (GlobalVarDecl->getStorageClass() == SC_Static)
SC = "static ";
if (GlobalVarDecl->getType().isConstQualified())
SC += "const ";
@@ -4333,8 +4356,8 @@ FunctionDecl *RewriteObjC::SynthBlockInitFunctionDecl(StringRef name) {
IdentifierInfo *ID = &Context->Idents.get(name);
QualType FType = Context->getFunctionNoProtoType(Context->VoidPtrTy);
return FunctionDecl::Create(*Context, TUDecl, SourceLocation(),
- SourceLocation(), ID, FType, nullptr,
- StorageClass::Extern, false, false);
+ SourceLocation(), ID, FType, nullptr, SC_Extern,
+ false, false);
}
Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp,
@@ -4414,10 +4437,9 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp,
// Initialize the block descriptor.
std::string DescData = "__" + FuncName + "_block_desc_" + BlockNumber + "_DATA";
- VarDecl *NewVD =
- VarDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(),
- &Context->Idents.get(DescData), Context->VoidPtrTy,
- nullptr, StorageClass::Static);
+ VarDecl *NewVD = VarDecl::Create(
+ *Context, TUDecl, SourceLocation(), SourceLocation(),
+ &Context->Idents.get(DescData), Context->VoidPtrTy, nullptr, SC_Static);
UnaryOperator *DescRefExpr = UnaryOperator::Create(
const_cast<ASTContext &>(*Context),
new (Context) DeclRefExpr(*Context, NewVD, false, Context->VoidPtrTy,
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 690358d45ce9..83df76b967c4 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() == StorageClass::Static &&
+ if (FD->getStorageClass() == SC_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 0a02b4ba6033..7e83a39b16ab 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() == StorageClass::Register &&
- !getLangOpts().CPlusPlus;
+ IsCRegister =
+ PV->getStorageClass() == SC_Register && !getLangOpts().CPlusPlus;
}
}
@@ -10249,7 +10249,8 @@ void CheckFreeArgumentsOnLvalue(Sema &S, const std::string &CalleeName,
const UnaryOperator *UnaryExpr,
const VarDecl *Var) {
StorageClass Class = Var->getStorageClass();
- if (Class == StorageClass::Extern || Class == StorageClass::PrivateExtern ||
+ if (Class == StorageClass::SC_Extern ||
+ Class == StorageClass::SC_PrivateExtern ||
Var->getType()->isReferenceType())
return;
diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp
index 7dba53a98484..7a48bfa429e9 100644
--- a/clang/lib/Sema/SemaCoroutine.cpp
+++ b/clang/lib/Sema/SemaCoroutine.cpp
@@ -543,8 +543,7 @@ VarDecl *Sema::buildCoroutinePromise(SourceLocation Loc) {
auto *VD = VarDecl::Create(Context, FD, FD->getLocation(), FD->getLocation(),
&PP.getIdentifierTable().get("__promise"), T,
- Context.getTrivialTypeSourceInfo(T, Loc),
- StorageClass::None);
+ Context.getTrivialTypeSourceInfo(T, Loc), SC_None);
VD->setImplicit();
CheckVariableDeclarationType(VD);
if (VD->isInvalidDecl())
@@ -1578,7 +1577,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), StorageClass::None);
+ S.Context.getTrivialTypeSourceInfo(GroType, Loc), SC_None);
GroDecl->setImplicit();
S.CheckVariableDeclarationType(GroDecl);
@@ -1646,7 +1645,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, StorageClass::None);
+ TInfo, SC_None);
Decl->setImplicit();
return Decl;
}
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 204a035130ab..949df53b40e0 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2061,10 +2061,9 @@ FunctionDecl *Sema::CreateBuiltin(IdentifierInfo *II, QualType Type,
Parent = CLinkageDecl;
}
- FunctionDecl *New =
- FunctionDecl::Create(Context, Parent, Loc, Loc, II, Type,
- /*TInfo=*/nullptr, StorageClass::Extern, false,
- Type->isFunctionProtoType());
+ FunctionDecl *New = FunctionDecl::Create(Context, Parent, Loc, Loc, II, Type,
+ /*TInfo=*/nullptr, SC_Extern, false,
+ Type->isFunctionProtoType());
New->setImplicit();
New->addAttr(BuiltinAttr::CreateImplicit(Context, ID));
@@ -2075,7 +2074,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, StorageClass::None, nullptr);
+ FT->getParamType(i), /*TInfo=*/nullptr, SC_None, nullptr);
parm->setScopeInfo(0, i);
Params.push_back(parm);
}
@@ -3073,8 +3072,9 @@ 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() == StorageClass::Extern);
+ !LangOpts.CPlusPlus &&
+ FD->isInlineSpecified() &&
+ FD->getStorageClass() == SC_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() == StorageClass::Static &&
+ New->getStorageClass() == SC_Static &&
Old->hasExternalFormalLinkage() &&
!New->getTemplateSpecializationInfo() &&
!canRedefineFunction(Old, getLangOpts())) {
@@ -3689,9 +3689,10 @@ 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, StorageClass::None, nullptr);
+ ParmVarDecl *Param = ParmVarDecl::Create(Context, New, SourceLocation(),
+ SourceLocation(), nullptr,
+ ParamType, /*TInfo=*/nullptr,
+ SC_None, nullptr);
Param->setScopeInfo(0, Params.size());
Param->setImplicit();
Params.push_back(Param);
@@ -4071,7 +4072,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() == StorageClass::None &&
+ Old->getStorageClass() == SC_None &&
!Old->hasAttr<WeakImportAttr>()) {
Diag(New->getLocation(), diag::warn_weak_import) << New->getDeclName();
notePreviousDefinition(Old, New->getLocation());
@@ -4106,8 +4107,9 @@ 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() == StorageClass::Static &&
- !New->isStaticDataMember() && Old->hasExternalFormalLinkage()) {
+ if (New->getStorageClass() == SC_Static &&
+ !New->isStaticDataMember() &&
+ Old->hasExternalFormalLinkage()) {
if (getLangOpts().MicrosoftExt) {
Diag(New->getLocation(), diag::ext_static_non_static)
<< New->getDeclName();
@@ -4130,9 +4132,9 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
// identifier has external linkage.
if (New->hasExternalStorage() && Old->hasLinkage())
/* Okay */;
- else if (New->getCanonicalDecl()->getStorageClass() != StorageClass::Static &&
+ else if (New->getCanonicalDecl()->getStorageClass() != SC_Static &&
!New->isStaticDataMember() &&
- Old->getCanonicalDecl()->getStorageClass() == StorageClass::Static) {
+ Old->getCanonicalDecl()->getStorageClass() == SC_Static) {
Diag(New->getLocation(), diag::err_non_static_static) << New->getDeclName();
Diag(OldLocation, PrevDiag);
return New->setInvalidDecl();
@@ -4914,24 +4916,18 @@ StorageClassSpecToVarDeclStorageClass(const DeclSpec &DS) {
assert(StorageClassSpec != DeclSpec::SCS_typedef &&
"Parser allowed 'typedef' as storage class VarDecl.");
switch (StorageClassSpec) {
- case DeclSpec::SCS_unspecified:
- return StorageClass::None;
+ case DeclSpec::SCS_unspecified: return SC_None;
case DeclSpec::SCS_extern:
if (DS.isExternInLinkageSpec())
- 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;
+ 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;
// Illegal SCSs map to None: error reporting is up to the caller.
case DeclSpec::SCS_mutable: // Fall through.
- case DeclSpec::SCS_typedef:
- return StorageClass::None;
+ case DeclSpec::SCS_typedef: return SC_None;
}
llvm_unreachable("unknown storage class specifier");
}
@@ -5189,7 +5185,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
// an error here
Diag(Record->getLocation(), diag::err_mutable_nonmember);
Invalid = true;
- SC = StorageClass::None;
+ SC = SC_None;
}
assert(DS.getAttributes().empty() && "No attribute expected");
@@ -6850,21 +6846,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 == StorageClass::None && !DC->isRecord() &&
+ if (SC == SC_None && !DC->isRecord() &&
hasParsedAttr(S, D, ParsedAttr::AT_DLLImport) &&
!hasParsedAttr(S, D, ParsedAttr::AT_DLLExport))
- SC = StorageClass::Extern;
+ SC = SC_Extern;
DeclContext *OriginalDC = DC;
- bool IsLocalExternDecl =
- SC == StorageClass::Extern && adjustContextForLocalExternDecl(DC);
+ bool IsLocalExternDecl = SC == SC_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 = StorageClass::None;
+ SC = SC_None;
}
if (getLangOpts().CPlusPlus11 && SCSpec == DeclSpec::SCS_register &&
@@ -6885,8 +6881,7 @@ 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 == StorageClass::Auto ||
- (SC == StorageClass::Register && !D.getAsmLabel())) {
+ if (SC == SC_Auto || (SC == SC_Register && !D.getAsmLabel())) {
Diag(D.getIdentifierLoc(), diag::err_typecheck_sclass_fscope);
D.setInvalidType();
}
@@ -6925,16 +6920,16 @@ NamedDecl *Sema::ActOnVariableDeclarator(
if (DC->isRecord() && !CurContext->isRecord()) {
// This is an out-of-line definition of a static data member.
switch (SC) {
- case StorageClass::None:
+ case SC_None:
break;
- case StorageClass::Static:
+ case SC_Static:
Diag(D.getDeclSpec().getStorageClassSpecLoc(),
diag::err_static_out_of_line)
<< FixItHint::CreateRemoval(D.getDeclSpec().getStorageClassSpecLoc());
break;
- case StorageClass::Auto:
- case StorageClass::Register:
- case StorageClass::Extern:
+ case SC_Auto:
+ case SC_Register:
+ case SC_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
@@ -6944,12 +6939,12 @@ NamedDecl *Sema::ActOnVariableDeclarator(
diag::err_storage_class_for_static_member)
<< FixItHint::CreateRemoval(D.getDeclSpec().getStorageClassSpecLoc());
break;
- case StorageClass::PrivateExtern:
+ case SC_PrivateExtern:
llvm_unreachable("C storage class in c++!");
}
}
- if (SC == StorageClass::Static && CurContext->isRecord()) {
+ if (SC == SC_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.
@@ -7200,7 +7195,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 == StorageClass::Static && S->getFnParent() != nullptr &&
+ if (SC == SC_Static && S->getFnParent() != nullptr &&
!NewVD->getType().isConstQualified()) {
FunctionDecl *CurFD = getCurFunctionDecl();
if (CurFD && isFunctionDefinitionDiscarded(*this, CurFD)) {
@@ -7259,10 +7254,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 == StorageClass::None && S->getFnParent() != nullptr &&
+ if (SC == SC_None && S->getFnParent() != nullptr &&
(NewVD->hasAttr<CUDASharedAttr>() ||
NewVD->hasAttr<CUDAConstantAttr>())) {
- NewVD->setStorageClass(StorageClass::Static);
+ NewVD->setStorageClass(SC_Static);
}
}
@@ -7271,8 +7266,7 @@ NamedDecl *Sema::ActOnVariableDeclarator(
// check the VarDecl itself.
assert(!NewVD->hasAttr<DLLImportAttr>() ||
NewVD->getAttr<DLLImportAttr>()->isInherited() ||
- NewVD->isStaticDataMember() ||
- NewVD->getStorageClass() != StorageClass::None);
+ NewVD->isStaticDataMember() || NewVD->getStorageClass() != SC_None);
// In auto-retain/release, infer strong retension for variables of
// retainable type.
@@ -7286,22 +7280,22 @@ NamedDecl *Sema::ActOnVariableDeclarator(
StringRef Label = SE->getString();
if (S->getFnParent() != nullptr) {
switch (SC) {
- case StorageClass::None:
- case StorageClass::Auto:
+ case SC_None:
+ case SC_Auto:
Diag(E->getExprLoc(), diag::warn_asm_label_on_auto_decl) << Label;
break;
- case StorageClass::Register:
+ case SC_Register:
// Local Named register
if (!Context.getTargetInfo().isValidGCCRegisterName(Label) &&
DeclAttrsMatchCUDAMode(getLangOpts(), getCurFunctionDecl()))
Diag(E->getExprLoc(), diag::err_asm_unknown_register_name) << Label;
break;
- case StorageClass::Static:
- case StorageClass::Extern:
- case StorageClass::PrivateExtern:
+ case SC_Static:
+ case SC_Extern:
+ case SC_PrivateExtern:
break;
}
- } else if (SC == StorageClass::Register) {
+ } else if (SC == SC_Register) {
// Global Named register
if (DeclAttrsMatchCUDAMode(getLangOpts(), NewVD)) {
const auto &TI = Context.getTargetInfo();
@@ -8395,8 +8389,8 @@ static StorageClass getFunctionStorageClass(Sema &SemaRef, Declarator &D) {
case DeclSpec::SCS_unspecified: break;
case DeclSpec::SCS_extern:
if (D.getDeclSpec().isExternInLinkageSpec())
- return StorageClass::None;
- return StorageClass::Extern;
+ return SC_None;
+ return SC_Extern;
case DeclSpec::SCS_static: {
if (SemaRef.CurContext->getRedeclContext()->isFunctionOrMethod()) {
// C99 6.7.1p5:
@@ -8408,14 +8402,13 @@ static StorageClass getFunctionStorageClass(Sema &SemaRef, Declarator &D) {
diag::err_static_block_func);
break;
} else
- return StorageClass::Static;
+ return SC_Static;
}
- case DeclSpec::SCS_private_extern:
- return StorageClass::PrivateExtern;
+ case DeclSpec::SCS_private_extern: return SC_PrivateExtern;
}
// No explicit storage class has already been returned
- return StorageClass::None;
+ return SC_None;
}
static FunctionDecl *CreateNewFunctionDecl(Sema &SemaRef, Declarator &D,
@@ -9217,7 +9210,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
NewFD->setImplicitlyInline();
}
- if (SC == StorageClass::Static && isa<CXXMethodDecl>(NewFD) &&
+ if (SC == SC_Static && isa<CXXMethodDecl>(NewFD) &&
!CurContext->isRecord()) {
// C++ [class.static]p1:
// A data or function member of a class may be declared static
@@ -9547,13 +9540,13 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
// specialization (14.7.3)
FunctionTemplateSpecializationInfo *Info =
NewFD->getTemplateSpecializationInfo();
- if (Info && SC != StorageClass::None) {
+ if (Info && SC != SC_None) {
if (SC != Info->getTemplate()->getTemplatedDecl()->getStorageClass())
Diag(NewFD->getLocation(),
diag::err_explicit_specialization_inconsistent_storage_class)
- << static_cast<int>(SC)
- << FixItHint::CreateRemoval(
- D.getDeclSpec().getStorageClassSpecLoc());
+ << SC
+ << FixItHint::CreateRemoval(
+ D.getDeclSpec().getStorageClassSpecLoc());
else
Diag(NewFD->getLocation(),
@@ -9810,7 +9803,8 @@ 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 == StorageClass::Static)) {
+ if ((getLangOpts().OpenCLVersion >= 120)
+ && (SC == SC_Static)) {
Diag(D.getIdentifierLoc(), diag::err_static_kernel);
D.setInvalidType();
}
@@ -11006,7 +11000,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() == StorageClass::Static)
+ if (FD->getStorageClass() == SC_Static)
Diag(DS.getStorageClassSpecLoc(), getLangOpts().CPlusPlus
? diag::err_static_main : diag::warn_static_main)
<< FixItHint::CreateRemoval(DS.getStorageClassSpecLoc());
@@ -12261,7 +12255,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() == StorageClass::Static) {
+ } else if (VDecl->getStorageClass() == SC_Static) {
CheckForConstantInitializer(Init, DclT);
// C89 is stricter than C99 for aggregate initializers.
@@ -12389,7 +12383,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() == StorageClass::Extern &&
+ if (VDecl->getStorageClass() == SC_Extern &&
((!getLangOpts().CPlusPlus && !VDecl->hasAttr<SelectAnyAttr>()) ||
!Context.getBaseElementType(VDecl->getType()).isConstQualified()) &&
!(getLangOpts().CPlusPlus && VDecl->isExternC()) &&
@@ -12402,7 +12396,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(StorageClass::Extern);
+ VDecl->setStorageClass(SC_Extern);
// C99 6.7.8p4. All file scoped initializers need to be constant.
if (!getLangOpts().CPlusPlus && !VDecl->isInvalidDecl())
@@ -12536,14 +12530,14 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) {
// be initialized.
if (!Var->isInvalidDecl() &&
Var->getType().getAddressSpace() == LangAS::opencl_constant &&
- Var->getStorageClass() != StorageClass::Extern && !Var->getInit()) {
+ Var->getStorageClass() != SC_Extern && !Var->getInit()) {
Diag(Var->getLocation(), diag::err_opencl_constant_no_init);
Var->setInvalidDecl();
return;
}
if (!Var->isInvalidDecl() && RealDecl->hasAttr<LoaderUninitializedAttr>()) {
- if (Var->getStorageClass() == StorageClass::Extern) {
+ if (Var->getStorageClass() == SC_Extern) {
Diag(Var->getLocation(), diag::err_loader_uninitialized_extern_decl)
<< Var;
Var->setInvalidDecl();
@@ -12600,7 +12594,7 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) {
AbstractVariableType))
Var->setInvalidDecl();
if (!Type->isDependentType() && !Var->isInvalidDecl() &&
- Var->getStorageClass() == StorageClass::PrivateExtern) {
+ Var->getStorageClass() == SC_PrivateExtern) {
Diag(Var->getLocation(), diag::warn_private_extern);
Diag(Var->getLocation(), diag::note_private_extern);
}
@@ -12624,7 +12618,7 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) {
Var->getLocation(), ArrayT->getElementType(),
diag::err_array_incomplete_or_sizeless_type))
Var->setInvalidDecl();
- } else if (Var->getStorageClass() == StorageClass::Static) {
+ } else if (Var->getStorageClass() == SC_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.
@@ -12772,21 +12766,21 @@ void Sema::ActOnCXXForRangeDecl(Decl *D) {
// for-range-declaration cannot be given a storage class specifier.
int Error = -1;
switch (VD->getStorageClass()) {
- case StorageClass::None:
+ case SC_None:
break;
- case StorageClass::Extern:
+ case SC_Extern:
Error = 0;
break;
- case StorageClass::Static:
+ case SC_Static:
Error = 1;
break;
- case StorageClass::PrivateExtern:
+ case SC_PrivateExtern:
Error = 2;
break;
- case StorageClass::Auto:
+ case SC_Auto:
Error = 3;
break;
- case StorageClass::Register:
+ case SC_Register:
Error = 4;
break;
}
@@ -13534,9 +13528,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 = StorageClass::None;
+ StorageClass SC = SC_None;
if (DS.getStorageClassSpec() == DeclSpec::SCS_register) {
- SC = StorageClass::Register;
+ SC = SC_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) {
@@ -13547,7 +13541,7 @@ Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
}
} else if (getLangOpts().CPlusPlus &&
DS.getStorageClassSpec() == DeclSpec::SCS_auto) {
- SC = StorageClass::Auto;
+ SC = SC_Auto;
} else if (DS.getStorageClassSpec() != DeclSpec::SCS_unspecified) {
Diag(DS.getStorageClassSpecLoc(),
diag::err_invalid_storage_class_in_func_decl);
@@ -13641,9 +13635,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), StorageClass::None, nullptr);
+ ParmVarDecl *Param = ParmVarDecl::Create(Context, DC, Loc, Loc, nullptr,
+ T, Context.getTrivialTypeSourceInfo(T, Loc),
+ SC_None, nullptr);
Param->setImplicit();
return Param;
}
@@ -13949,7 +13943,7 @@ Sema::CheckForFunctionRedefinition(FunctionDecl *FD,
}
if (getLangOpts().GNUMode && Definition->isInlineSpecified() &&
- Definition->getStorageClass() == StorageClass::Extern)
+ Definition->getStorageClass() == SC_Extern)
Diag(FD->getLocation(), diag::err_redefinition_extern_inline)
<< FD << getLangOpts().CPlusPlus;
else
@@ -14447,7 +14441,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
};
Diag(FD->getTypeSpecStartLoc(), diag::note_static_for_internal_linkage)
<< /* function */ 1
- << (FD->getStorageClass() == StorageClass::None
+ << (FD->getStorageClass() == SC_None
? FixItHint::CreateInsertion(findBeginLoc(), "static ")
: FixItHint{});
}
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 30164ce07150..7750d713f927 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() == StorageClass::Register)
+ if (VD->getStorageClass() == SC_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() != StorageClass::Extern)
+ if (S.LangOpts.CPlusPlus && Fn->getStorageClass() != SC_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(),
- StorageClass::None, false /*isInlineSpecified*/, FD->hasPrototype(),
+ DeclarationName(II), FD->getType(), FD->getTypeSourceInfo(), SC_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 3e6b53602631..0df022f036f2 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() == StorageClass::Static &&
+ VD->getStorageClass() == SC_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() == StorageClass::Static) {
+ if (MD->getStorageClass() == SC_Static) {
if (ReportOverrides(*this, diag::err_static_overrides_virtual, MD,
[](const CXXMethodDecl *) { return true; }))
return;
@@ -8092,7 +8092,7 @@ class DefaultedComparisonSynthesizer
}
VarDecl *IterationVar = VarDecl::Create(
S.Context, S.CurContext, Loc, Loc, IterationVarName, SizeType,
- S.Context.getTrivialTypeSourceInfo(SizeType, Loc), StorageClass::None);
+ S.Context.getTrivialTypeSourceInfo(SizeType, Loc), SC_None);
llvm::APInt Zero(S.Context.getTypeSize(SizeType), 0);
IterationVar->setInit(
IntegerLiteral::Create(S.Context, Zero, SizeType, Loc));
@@ -8191,9 +8191,9 @@ class DefaultedComparisonSynthesizer
// 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),
- StorageClass::None);
+ VarDecl *VD =
+ VarDecl::Create(S.Context, S.CurContext, Loc, Loc, Name, R,
+ S.Context.getTrivialTypeSourceInfo(R, Loc), SC_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 == StorageClass::Static) {
+ if (SC == SC_Static) {
if (!D.isInvalidType())
Diag(D.getIdentifierLoc(), diag::err_constructor_cannot_be)
<< "static" << SourceRange(D.getDeclSpec().getStorageClassSpecLoc())
<< SourceRange(D.getIdentifierLoc());
D.setInvalidType();
- SC = StorageClass::None;
+ SC = SC_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 == StorageClass::Static) {
+ if (SC == SC_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 = StorageClass::None;
+ SC = SC_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 == StorageClass::Static) {
+ if (SC == SC_Static) {
if (!D.isInvalidType())
Diag(D.getIdentifierLoc(), diag::err_conv_function_not_member)
<< SourceRange(D.getDeclSpec().getStorageClassSpecLoc())
<< D.getName().getSourceRange();
D.setInvalidType();
- SC = StorageClass::None;
+ SC = SC_None;
}
TypeSourceInfo *ConvTSI = nullptr;
@@ -10714,7 +10714,7 @@ void Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R,
Diagnoser.check(DS.getStorageClassSpecLoc(), DS.getStorageClassSpec());
DS.ClearStorageClassSpecs();
- SC = StorageClass::None;
+ SC = SC_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, StorageClass::None, /*DefArg=*/nullptr);
+ FPT->getParamType(I), TInfo, SC_None, /*DefArg=*/nullptr);
PD->setScopeInfo(0, I);
PD->setImplicit();
// Ensure attributes are propagated onto parameters (this matters for
@@ -13788,9 +13788,10 @@ 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), StorageClass::None);
+ VarDecl *IterationVar = VarDecl::Create(S.Context, S.CurContext, Loc, Loc,
+ IterationVarName, SizeType,
+ S.Context.getTrivialTypeSourceInfo(SizeType, Loc),
+ SC_None);
// Initialize the iteration variable to zero.
llvm::APInt Zero(S.Context.getTypeSize(SizeType), 0);
@@ -13899,7 +13900,7 @@ CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) {
DeclarationNameInfo NameInfo(Name, ClassLoc);
CXXMethodDecl *CopyAssignment = CXXMethodDecl::Create(
Context, ClassDecl, ClassLoc, NameInfo, QualType(),
- /*TInfo=*/nullptr, /*StorageClass=*/StorageClass::None,
+ /*TInfo=*/nullptr, /*StorageClass=*/SC_None,
/*isInline=*/true,
Constexpr ? ConstexprSpecKind::Constexpr : ConstexprSpecKind::Unspecified,
SourceLocation());
@@ -13917,10 +13918,11 @@ 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, StorageClass::None, nullptr);
+ ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyAssignment,
+ ClassLoc, ClassLoc,
+ /*Id=*/nullptr, ArgType,
+ /*TInfo=*/nullptr, SC_None,
+ nullptr);
CopyAssignment->setParams(FromParam);
CopyAssignment->setTrivial(
@@ -14224,7 +14226,7 @@ CXXMethodDecl *Sema::DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl) {
DeclarationNameInfo NameInfo(Name, ClassLoc);
CXXMethodDecl *MoveAssignment = CXXMethodDecl::Create(
Context, ClassDecl, ClassLoc, NameInfo, QualType(),
- /*TInfo=*/nullptr, /*StorageClass=*/StorageClass::None,
+ /*TInfo=*/nullptr, /*StorageClass=*/SC_None,
/*isInline=*/true,
Constexpr ? ConstexprSpecKind::Constexpr : ConstexprSpecKind::Unspecified,
SourceLocation());
@@ -14245,10 +14247,11 @@ 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, StorageClass::None, nullptr);
+ ParmVarDecl *FromParam = ParmVarDecl::Create(Context, MoveAssignment,
+ ClassLoc, ClassLoc,
+ /*Id=*/nullptr, ArgType,
+ /*TInfo=*/nullptr, SC_None,
+ nullptr);
MoveAssignment->setParams(FromParam);
MoveAssignment->setTrivial(
@@ -14624,10 +14627,11 @@ 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, StorageClass::None, nullptr);
+ ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyConstructor,
+ ClassLoc, ClassLoc,
+ /*IdentifierInfo=*/nullptr,
+ ArgType, /*TInfo=*/nullptr,
+ SC_None, nullptr);
CopyConstructor->setParams(FromParam);
CopyConstructor->setTrivial(
@@ -14757,10 +14761,11 @@ 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, StorageClass::None, nullptr);
+ ParmVarDecl *FromParam = ParmVarDecl::Create(Context, MoveConstructor,
+ ClassLoc, ClassLoc,
+ /*IdentifierInfo=*/nullptr,
+ ArgType, /*TInfo=*/nullptr,
+ SC_None, nullptr);
MoveConstructor->setParams(FromParam);
MoveConstructor->setTrivial(
@@ -15244,7 +15249,7 @@ CheckOperatorNewDeleteDeclarationScope(Sema &SemaRef,
}
if (isa<TranslationUnitDecl>(DC) &&
- FnDecl->getStorageClass() == StorageClass::Static) {
+ FnDecl->getStorageClass() == SC_Static) {
return SemaRef.Diag(FnDecl->getLocation(),
diag::err_operator_new_delete_declared_static)
<< FnDecl->getDeclName();
@@ -15901,7 +15906,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S,
}
VarDecl *ExDecl = VarDecl::Create(Context, CurContext, StartLoc, Loc, Name,
- ExDeclType, TInfo, StorageClass::None);
+ ExDeclType, TInfo, SC_None);
ExDecl->setExceptionVariable(true);
// In ARC, infer 'retaining' for variables of retainable type.
@@ -16914,7 +16919,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() == StorageClass::Static)
+ if (New->getStorageClass() == SC_Static)
return false;
Diag(New->getLocation(),
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index da7c0ee4b76c..60253a82e93a 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, StorageClass::None);
+ ParmVarDecl* Param = CheckParameter(ObjCMethod, StartLoc,
+ ArgInfo[i].NameLoc, ArgInfo[i].Name,
+ ArgType, DI, SC_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, StorageClass::None);
+ VarDecl *New = VarDecl::Create(Context, CurContext, StartLoc, IdLoc, Id,
+ T, TInfo, SC_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 b6e8ee095968..3992a373f721 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() != StorageClass::None)
+ if (I->getStorageClass() != SC_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, StorageClass::None);
+ D.DeclIdent, DeclTy, TInfo, SC_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, StorageClass::None);
+ Res.get()->getType(), nullptr, SC_None);
CounterVD->setImplicit();
ExprResult RefRes =
BuildDeclRefExpr(CounterVD, CounterVD->getType(), VK_LValue,
@@ -6177,19 +6177,22 @@ 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, StorageClass::Extern, false,
- /*hasPrototype=*/true);
+ FunctionDecl *OverloadDecl = FunctionDecl::Create(Context, Parent,
+ FDecl->getLocation(),
+ FDecl->getLocation(),
+ FDecl->getIdentifier(),
+ OverloadTy,
+ /*TInfo=*/nullptr,
+ SC_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, StorageClass::None, nullptr);
+ SourceLocation(), nullptr, ParamType,
+ /*TInfo=*/nullptr, SC_None, nullptr);
Parm->setScopeInfo(0, i);
Params.push_back(Parm);
}
@@ -13458,7 +13461,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() == StorageClass::Register &&
+ if (vd->getStorageClass() == SC_Register &&
!getLangOpts().CPlusPlus) {
AddressOfError = AO_Register_Variable;
}
@@ -19086,7 +19089,7 @@ ExprResult RebuildUnknownAnyExpr::resolveDecl(Expr *E, ValueDecl *VD) {
FunctionDecl *NewFD = FunctionDecl::Create(
S.Context, FD->getDeclContext(), Loc, Loc,
FD->getNameInfo().getName(), DestType, FD->getTypeSourceInfo(),
- StorageClass::None, false /*isInlineSpecified*/, FD->hasPrototype(),
+ SC_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 8e48abc77910..05b28c11e5a5 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, StorageClass::None, false, true);
+ Context, GlobalCtx, SourceLocation(), SourceLocation(), Name,
+ FnType, /*TInfo=*/nullptr, SC_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, StorageClass::None, nullptr));
+ /*TInfo=*/nullptr, SC_None, nullptr));
ParamDecls.back()->setImplicit();
}
Alloc->setParams(ParamDecls);
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index d4554261376c..f5456ee0711e 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -293,10 +293,11 @@ 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,
- StorageClass::None, nullptr);
+ ParmVarDecl *value = ParmVarDecl::Create(S.Context, Method,
+ SourceLocation(), SourceLocation(),
+ &CX.Idents.get("value"),
+ NumberType, /*TInfo=*/nullptr,
+ SC_None, nullptr);
Method->setMethodParams(S.Context, value, None);
}
@@ -569,11 +570,13 @@ 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, StorageClass::None, nullptr);
+ ParmVarDecl *value =
+ ParmVarDecl::Create(Context, M,
+ SourceLocation(), SourceLocation(),
+ &Context.Idents.get("value"),
+ Context.getPointerType(ConstCharType),
+ /*TInfo=*/nullptr,
+ SC_None, nullptr);
M->setMethodParams(Context, value, None);
BoxingMethod = M;
}
@@ -683,17 +686,23 @@ 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, StorageClass::None, nullptr);
+ ParmVarDecl *bytes =
+ ParmVarDecl::Create(Context, M,
+ SourceLocation(), SourceLocation(),
+ &Context.Idents.get("bytes"),
+ Context.VoidPtrTy.withConst(),
+ /*TInfo=*/nullptr,
+ SC_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, StorageClass::None, nullptr);
+ ParmVarDecl *type =
+ ParmVarDecl::Create(Context, M,
+ SourceLocation(), SourceLocation(),
+ &Context.Idents.get("type"),
+ Context.getPointerType(ConstCharType),
+ /*TInfo=*/nullptr,
+ SC_None, nullptr);
Params.push_back(type);
M->setMethodParams(Context, Params, None);
@@ -808,15 +817,21 @@ 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, StorageClass::None, nullptr);
+ ParmVarDecl *objects = ParmVarDecl::Create(Context, Method,
+ SourceLocation(),
+ SourceLocation(),
+ &Context.Idents.get("objects"),
+ Context.getPointerType(IdT),
+ /*TInfo=*/nullptr,
+ SC_None, nullptr);
Params.push_back(objects);
- ParmVarDecl *cnt = ParmVarDecl::Create(
- Context, Method, SourceLocation(), SourceLocation(),
- &Context.Idents.get("cnt"), Context.UnsignedLongTy,
- /*TInfo=*/nullptr, StorageClass::None, nullptr);
+ ParmVarDecl *cnt = ParmVarDecl::Create(Context, Method,
+ SourceLocation(),
+ SourceLocation(),
+ &Context.Idents.get("cnt"),
+ Context.UnsignedLongTy,
+ /*TInfo=*/nullptr, SC_None,
+ nullptr);
Params.push_back(cnt);
Method->setMethodParams(Context, Params, None);
}
@@ -964,20 +979,29 @@ 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, StorageClass::None, nullptr);
+ ParmVarDecl *objects = ParmVarDecl::Create(Context, Method,
+ SourceLocation(),
+ SourceLocation(),
+ &Context.Idents.get("objects"),
+ Context.getPointerType(IdT),
+ /*TInfo=*/nullptr, SC_None,
+ nullptr);
Params.push_back(objects);
- ParmVarDecl *keys = ParmVarDecl::Create(
- Context, Method, SourceLocation(), SourceLocation(),
- &Context.Idents.get("keys"), Context.getPointerType(IdT),
- /*TInfo=*/nullptr, StorageClass::None, nullptr);
+ ParmVarDecl *keys = ParmVarDecl::Create(Context, Method,
+ SourceLocation(),
+ SourceLocation(),
+ &Context.Idents.get("keys"),
+ Context.getPointerType(IdT),
+ /*TInfo=*/nullptr, SC_None,
+ nullptr);
Params.push_back(keys);
- ParmVarDecl *cnt = ParmVarDecl::Create(
- Context, Method, SourceLocation(), SourceLocation(),
- &Context.Idents.get("cnt"), Context.UnsignedLongTy,
- /*TInfo=*/nullptr, StorageClass::None, nullptr);
+ ParmVarDecl *cnt = ParmVarDecl::Create(Context, Method,
+ SourceLocation(),
+ SourceLocation(),
+ &Context.Idents.get("cnt"),
+ Context.UnsignedLongTy,
+ /*TInfo=*/nullptr, SC_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 8800ff81cb10..af61c82c2002 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, StorageClass::None,
+ MethodType, MethodTypeInfo, SC_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, StorageClass::Auto);
+ VarDecl *NewVD = VarDecl::Create(Context, CurContext, Loc,
+ Loc, Id, InitCaptureType, TSI, SC_Auto);
NewVD->setInitCapture(true);
NewVD->setReferenced(true);
// FIXME: Pass in a VarDecl::InitializationStyle.
@@ -1484,8 +1484,7 @@ 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(),
- StorageClass::Static,
+ InvokerFunctionTy, CallOperator->getTypeSourceInfo(), SC_Static,
/*isInline=*/true, ConstexprSpecKind::Unspecified,
CallOperator->getBody()->getEndLoc());
for (unsigned I = 0, N = CallOperator->getNumParams(); I != N; ++I)
@@ -2009,9 +2008,10 @@ 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, StorageClass::None);
+ VarDecl *CapVar = VarDecl::Create(Context, Block, ConvLocation,
+ ConvLocation, nullptr,
+ Src->getType(), CapVarTSI,
+ SC_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 8d79a4764e4c..16dd8f510596 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, StorageClass::Extern, false,
+ /*TInfo=*/nullptr, SC_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, StorageClass::None, nullptr);
+ /*TInfo=*/nullptr, SC_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 781efd80a810..fdc30fe6f657 100644
--- a/clang/lib/Sema/SemaObjCProperty.cpp
+++ b/clang/lib/Sema/SemaObjCProperty.cpp
@@ -2576,9 +2576,13 @@ 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, StorageClass::None, nullptr);
+ ParmVarDecl *Argument = ParmVarDecl::Create(Context, SetterMethod,
+ Loc, Loc,
+ property->getIdentifier(),
+ paramTy,
+ /*TInfo=*/nullptr,
+ SC_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 67a8ac95377d..78707484f588 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -1182,8 +1182,7 @@ 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() == StorageClass::Auto ||
- VD->getStorageClass() == StorageClass::None)) {
+ (VD->getStorageClass() == SC_Auto || VD->getStorageClass() == SC_None)) {
DVar.CKind = OMPC_private;
return DVar;
}
@@ -1399,8 +1398,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,
- StorageClass::None);
+ auto *Decl =
+ VarDecl::Create(SemaRef.Context, DC, Loc, Loc, II, Type, TInfo, SC_None);
if (Attrs) {
for (specific_attr_iterator<AlignedAttr> I(Attrs->begin()), E(Attrs->end());
I != E; ++I)
@@ -1624,7 +1623,7 @@ const DSAStackTy::DSAVarData DSAStackTy::getTopDSA(ValueDecl *D,
!(VD->hasAttr<OMPThreadPrivateDeclAttr>() &&
SemaRef.getLangOpts().OpenMPUseTLS &&
SemaRef.getASTContext().getTargetInfo().isTLSSupported())) ||
- (VD && VD->getStorageClass() == StorageClass::Register &&
+ (VD && VD->getStorageClass() == SC_Register &&
VD->hasAttr<AsmLabelAttr>() && !VD->isLocalVarDecl())) {
DVar.RefExpr = buildDeclRefExpr(
SemaRef, VD, D->getType().getNonReferenceType(), D->getLocation());
@@ -2985,8 +2984,8 @@ Sema::CheckOMPThreadPrivateDecl(SourceLocation Loc, ArrayRef<Expr *> VarList) {
!(VD->hasAttr<OMPThreadPrivateDeclAttr>() &&
getLangOpts().OpenMPUseTLS &&
getASTContext().getTargetInfo().isTLSSupported())) ||
- (VD->getStorageClass() == StorageClass::Register &&
- VD->hasAttr<AsmLabelAttr>() && !VD->isLocalVarDecl())) {
+ (VD->getStorageClass() == SC_Register && VD->hasAttr<AsmLabelAttr>() &&
+ !VD->isLocalVarDecl())) {
Diag(ILoc, diag::err_omp_var_thread_local)
<< VD << ((VD->getTLSKind() != VarDecl::TLS_None) ? 0 : 1);
bool IsDecl =
@@ -3139,8 +3138,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() == StorageClass::Register &&
- VD->hasAttr<AsmLabelAttr>() && !VD->isLocalVarDecl()))
+ (VD->getStorageClass() == SC_Register && VD->hasAttr<AsmLabelAttr>() &&
+ !VD->isLocalVarDecl()))
continue;
// If the used several times in the allocate directive, the same allocator
@@ -5985,10 +5984,9 @@ 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, StorageClass::None, nullptr);
+ auto *Param = ParmVarDecl::Create(S.getASTContext(), FD, SourceLocation(),
+ SourceLocation(), nullptr, P->getType(),
+ /*TInfo=*/nullptr, SC_None, nullptr);
Param->setScopeInfo(0, Params.size());
Param->setImplicit();
Params.push_back(Param);
@@ -18380,7 +18378,7 @@ Sema::ActOnOpenMPDeclareMapperDirectiveVarDecl(Scope *S, QualType MapperType,
Context.getTrivialTypeSourceInfo(MapperType, StartLoc);
auto *VD = VarDecl::Create(Context, Context.getTranslationUnitDecl(),
StartLoc, StartLoc, VN.getAsIdentifierInfo(),
- MapperType, TInfo, StorageClass::None);
+ MapperType, TInfo, SC_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 201ee536423c..d17599a6ed14 100644
--- a/clang/lib/Sema/SemaPseudoObject.cpp
+++ b/clang/lib/Sema/SemaPseudoObject.cpp
@@ -1191,12 +1191,15 @@ 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, StorageClass::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,
+ SC_None,
+ nullptr);
AtIndexGetter->setMethodParams(S.Context, Argument, None);
}
@@ -1295,17 +1298,23 @@ 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, StorageClass::None, nullptr);
+ ParmVarDecl *object = ParmVarDecl::Create(S.Context, AtIndexSetter,
+ SourceLocation(), SourceLocation(),
+ &S.Context.Idents.get("object"),
+ S.Context.getObjCIdType(),
+ /*TInfo=*/nullptr,
+ SC_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, StorageClass::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,
+ SC_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 67ecdbed3241..027262ca8ec9 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, StorageClass::None);
+ TInfo, SC_None);
Decl->setImplicit();
return Decl;
}
diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp
index a6965eadcd5b..3b631bf747c6 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() == StorageClass::Register) {
+ if (Variable && Variable->getStorageClass() == SC_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 9f5a0049ea00..64259767d98a 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -2218,10 +2218,9 @@ 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),
- StorageClass::None, nullptr);
+ ParmVarDecl *NewParam = ParmVarDecl::Create(
+ SemaRef.Context, DC, Loc, Loc, nullptr, T,
+ SemaRef.Context.getTrivialTypeSourceInfo(T, Loc), SC_None, nullptr);
NewParam->setScopeInfo(0, Params.size());
FPTL.setParam(Params.size(), NewParam);
Params.push_back(NewParam);
@@ -4332,10 +4331,9 @@ 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 != StorageClass::Extern &&
- !CurContext->isRecord())
- << FixItHint::CreateRemoval(SourceRange(LAngleLoc, RAngleLoc));
+ << /*variable template*/ 1
+ << /*is definition*/(SC != SC_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 70e734d21ded..d3d6df5e0064 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() ? StorageClass::Static : StorageClass::None;
+ StorageClass SC = D->isStatic() ? SC_Static : SC_None;
Method = CXXMethodDecl::Create(SemaRef.Context, Record, StartLoc, NameInfo,
T, TInfo, SC, D->isInlineSpecified(),
D->getConstexprKind(), D->getEndLoc(),
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 165bb5376b67..b48b23ce4a51 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -10622,8 +10622,8 @@ void ASTReader::diagnoseOdrViolations() {
// class needs to be checked instead.
const auto FirstStorage = FirstMethod->getStorageClass();
const auto SecondStorage = SecondMethod->getStorageClass();
- const bool FirstStatic = FirstStorage == StorageClass::Static;
- const bool SecondStatic = SecondStorage == StorageClass::Static;
+ const bool FirstStatic = FirstStorage == SC_Static;
+ const bool SecondStatic = SecondStorage == SC_Static;
if (FirstStatic != SecondStatic) {
ODRDiagDeclError(FirstRecord, FirstModule, FirstMethod->getLocation(),
FirstMethod->getSourceRange(), MethodStatic)
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp
index a0f3a3957fb6..6bfb9bd783b5 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -1412,7 +1412,7 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::VisitVarDeclImpl(VarDecl *VD) {
RedeclarableResult Redecl = VisitRedeclarable(VD);
VisitDeclaratorDecl(VD);
- VD->VarDeclBits.SClass = Record.readInt();
+ VD->VarDeclBits.SClass = (StorageClass)Record.readInt();
VD->VarDeclBits.TSCSpec = Record.readInt();
VD->VarDeclBits.InitStyle = Record.readInt();
VD->VarDeclBits.ARCPseudoStrong = Record.readInt();
@@ -1435,8 +1435,7 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::VisitVarDeclImpl(VarDecl *VD) {
VD->setCachedLinkage(VarLinkage);
// Reconstruct the one piece of the IdentifierNamespace that we need.
- if (VD->getStorageClass() == StorageClass::Extern &&
- VarLinkage != NoLinkage &&
+ if (VD->getStorageClass() == SC_Extern && VarLinkage != NoLinkage &&
VD->getLexicalDeclContext()->isFunctionOrMethod())
VD->setLocalExternDecl();
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
index b62fb216d970..2cb44bf9038b 100644
--- a/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/clang/lib/Serialization/ASTWriterDecl.cpp
@@ -983,7 +983,7 @@ void ASTDeclWriter::VisitIndirectFieldDecl(IndirectFieldDecl *D) {
void ASTDeclWriter::VisitVarDecl(VarDecl *D) {
VisitRedeclarable(D);
VisitDeclaratorDecl(D);
- Record.push_back(static_cast<uint64_t>(D->getStorageClass()));
+ Record.push_back(D->getStorageClass());
Record.push_back(D->getTSCSpec());
Record.push_back(D->getInitStyle());
Record.push_back(D->isARCPseudoStrong());
@@ -1099,15 +1099,23 @@ void ASTDeclWriter::VisitParmVarDecl(ParmVarDecl *D) {
// If the assumptions about the DECL_PARM_VAR abbrev are true, use it. Here
// we dynamically check for the properties that we optimize for, but don't
// know are true of all PARM_VAR_DECLs.
- if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
- !D->hasExtInfo() && !D->isImplicit() && !D->isUsed(false) &&
- !D->isInvalidDecl() && !D->isReferenced() && D->getAccess() == AS_none &&
- !D->isModulePrivate() && D->getStorageClass() == StorageClass::None &&
+ if (D->getDeclContext() == D->getLexicalDeclContext() &&
+ !D->hasAttrs() &&
+ !D->hasExtInfo() &&
+ !D->isImplicit() &&
+ !D->isUsed(false) &&
+ !D->isInvalidDecl() &&
+ !D->isReferenced() &&
+ D->getAccess() == AS_none &&
+ !D->isModulePrivate() &&
+ D->getStorageClass() == 0 &&
D->getInitStyle() == VarDecl::CInit && // Can params have anything else?
- D->getFunctionScopeDepth() == 0 && D->getObjCDeclQualifier() == 0 &&
- !D->isKNRPromoted() && !D->hasInheritedDefaultArg() &&
+ D->getFunctionScopeDepth() == 0 &&
+ D->getObjCDeclQualifier() == 0 &&
+ !D->isKNRPromoted() &&
+ !D->hasInheritedDefaultArg() &&
D->getInit() == nullptr &&
- !D->hasUninstantiatedDefaultArg()) // No default expr.
+ !D->hasUninstantiatedDefaultArg()) // No default expr.
AbbrevToUse = Writer.getDeclParmVarAbbrev();
// Check things we know are true of *every* PARM_VAR_DECL, which is more than
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 0875ba151ecd..f1008319ddc7 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -8120,7 +8120,7 @@ static const Decl *maybeGetTemplateCursor(const Decl *D) {
}
enum CX_StorageClass clang_Cursor_getStorageClass(CXCursor C) {
- StorageClass sc = StorageClass::None;
+ StorageClass sc = SC_None;
const Decl *D = getCursorDecl(C);
if (D) {
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
@@ -8134,17 +8134,17 @@ enum CX_StorageClass clang_Cursor_getStorageClass(CXCursor C) {
return CX_SC_Invalid;
}
switch (sc) {
- case StorageClass::None:
+ case SC_None:
return CX_SC_None;
- case StorageClass::Extern:
+ case SC_Extern:
return CX_SC_Extern;
- case StorageClass::Static:
+ case SC_Static:
return CX_SC_Static;
- case StorageClass::PrivateExtern:
+ case SC_PrivateExtern:
return CX_SC_PrivateExtern;
- case StorageClass::Auto:
+ case SC_Auto:
return CX_SC_Auto;
- case StorageClass::Register:
+ case SC_Register:
return CX_SC_Register;
}
llvm_unreachable("Unhandled storage class!");
diff --git a/clang/unittests/Sema/ExternalSemaSourceTest.cpp b/clang/unittests/Sema/ExternalSemaSourceTest.cpp
index 931ccca89f3b..842eb83eb3d9 100644
--- a/clang/unittests/Sema/ExternalSemaSourceTest.cpp
+++ b/clang/unittests/Sema/ExternalSemaSourceTest.cpp
@@ -163,8 +163,7 @@ class FunctionTypoProvider : public clang::ExternalSemaSource {
CurrentSema->getPreprocessor().getIdentifierInfo(CorrectTo);
auto *NewFunction = FunctionDecl::Create(
Context, DestContext, SourceLocation(), SourceLocation(), ToIdent,
- Context.getFunctionType(Context.VoidTy, {}, {}), nullptr,
- StorageClass::Static);
+ Context.getFunctionType(Context.VoidTy, {}, {}), nullptr, SC_Static);
DestContext->addDecl(NewFunction);
TypoCorrection Correction(ToIdent);
Correction.addCorrectionDecl(NewFunction);
More information about the llvm-branch-commits
mailing list