Skip to content

Commit 1829b42

Browse files
committed
Merge from 'main' to 'sycl-web' (#2)
CONFLICT (content): Merge conflict in clang/lib/Sema/SemaLookup.cpp
2 parents 7e5cc89 + 2fd11e0 commit 1829b42

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+615
-584
lines changed

clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,8 @@ void ChangeNamespaceTool::run(
632632
return;
633633
// Ignore out-of-line static methods since they will be handled by nested
634634
// name specifiers.
635-
if (Func->getCanonicalDecl()->getStorageClass() == StorageClass::Static &&
635+
if (Func->getCanonicalDecl()->getStorageClass() ==
636+
StorageClass::SC_Static &&
636637
Func->isOutOfLine())
637638
return;
638639
const auto *Context = Result.Nodes.getNodeAs<Decl>("dc");

clang-tools-extra/clang-tidy/google/FunctionNamingCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ FixItHint generateFixItHint(const FunctionDecl *Decl) {
5151
// A fixit can be generated for functions of static storage class but
5252
// otherwise the check cannot determine the appropriate function name prefix
5353
// to use.
54-
if (Decl->getStorageClass() != StorageClass::Static)
54+
if (Decl->getStorageClass() != SC_Static)
5555
return FixItHint();
5656

5757
StringRef Name = Decl->getName();
@@ -109,7 +109,7 @@ void FunctionNamingCheck::registerMatchers(MatchFinder *Finder) {
109109
void FunctionNamingCheck::check(const MatchFinder::MatchResult &Result) {
110110
const auto *MatchedDecl = Result.Nodes.getNodeAs<FunctionDecl>("function");
111111

112-
bool IsGlobal = MatchedDecl->getStorageClass() != StorageClass::Static;
112+
bool IsGlobal = MatchedDecl->getStorageClass() != SC_Static;
113113
diag(MatchedDecl->getLocation(),
114114
"%select{static function|function in global namespace}1 named %0 must "
115115
"%select{be in|have an appropriate prefix followed by}1 Pascal case as "

clang-tools-extra/clang-tidy/google/GlobalVariableDeclarationCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace {
2626
AST_MATCHER(VarDecl, isLocalVariable) { return Node.isLocalVarDecl(); }
2727

2828
FixItHint generateFixItHint(const VarDecl *Decl, bool IsConst) {
29-
if (IsConst && (Decl->getStorageClass() != StorageClass::Static)) {
29+
if (IsConst && (Decl->getStorageClass() != SC_Static)) {
3030
// No fix available if it is not a static constant, since it is difficult
3131
// to determine the proper fix in this case.
3232
return FixItHint();

clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,8 @@ void UseTrailingReturnTypeCheck::keepSpecifiers(
359359
// inline int.
360360
const auto *M = dyn_cast<CXXMethodDecl>(&F);
361361
if (!F.isConstexpr() && !F.isInlineSpecified() &&
362-
F.getStorageClass() != StorageClass::Extern &&
363-
F.getStorageClass() != StorageClass::Static && !Fr &&
364-
!(M && M->isVirtualAsWritten()))
362+
F.getStorageClass() != SC_Extern && F.getStorageClass() != SC_Static &&
363+
!Fr && !(M && M->isVirtualAsWritten()))
365364
return;
366365

367366
// Tokenize return type. If it contains macros which contain a mix of

clang/include/clang/AST/Decl.h

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ class VarDecl : public DeclaratorDecl, public Redeclarable<VarDecl> {
10581058
/// Returns true if a variable with function scope is a non-static local
10591059
/// variable.
10601060
bool hasLocalStorage() const {
1061-
if (getStorageClass() == StorageClass::None) {
1061+
if (getStorageClass() == SC_None) {
10621062
// OpenCL v1.2 s6.5.3: The __constant or constant address space name is
10631063
// used to describe variables allocated in global memory and which are
10641064
// accessed inside a kernel(s) as read-only variables. As such, variables
@@ -1070,40 +1070,29 @@ class VarDecl : public DeclaratorDecl, public Redeclarable<VarDecl> {
10701070
}
10711071

10721072
// Global Named Register (GNU extension)
1073-
if (getStorageClass() == StorageClass::Register && !isLocalVarDeclOrParm())
1073+
if (getStorageClass() == SC_Register && !isLocalVarDeclOrParm())
10741074
return false;
10751075

10761076
// Return true for: Auto, Register.
10771077
// Return false for: Extern, Static, PrivateExtern, OpenCLWorkGroupLocal.
10781078

1079-
switch (getStorageClass()) {
1080-
case StorageClass::Auto:
1081-
case StorageClass::Register:
1082-
return true;
1083-
case StorageClass::Extern:
1084-
case StorageClass::None:
1085-
case StorageClass::PrivateExtern:
1086-
case StorageClass::Static:
1087-
return false;
1088-
}
1089-
llvm_unreachable("unknown storage class");
1079+
return getStorageClass() >= SC_Auto;
10901080
}
10911081

10921082
/// Returns true if a variable with function scope is a static local
10931083
/// variable.
10941084
bool isStaticLocal() const {
1095-
return (getStorageClass() == StorageClass::Static ||
1085+
return (getStorageClass() == SC_Static ||
10961086
// C++11 [dcl.stc]p4
1097-
(getStorageClass() == StorageClass::None &&
1098-
getTSCSpec() == TSCS_thread_local)) &&
1099-
!isFileVarDecl();
1087+
(getStorageClass() == SC_None && getTSCSpec() == TSCS_thread_local))
1088+
&& !isFileVarDecl();
11001089
}
11011090

11021091
/// Returns true if a variable has extern or __private_extern__
11031092
/// storage.
11041093
bool hasExternalStorage() const {
1105-
return getStorageClass() == StorageClass::Extern ||
1106-
getStorageClass() == StorageClass::PrivateExtern;
1094+
return getStorageClass() == SC_Extern ||
1095+
getStorageClass() == SC_PrivateExtern;
11071096
}
11081097

11091098
/// Returns true for all variables that do not have local storage.
@@ -1605,15 +1594,15 @@ class ImplicitParamDecl : public VarDecl {
16051594
IdentifierInfo *Id, QualType Type,
16061595
ImplicitParamKind ParamKind)
16071596
: VarDecl(ImplicitParam, C, DC, IdLoc, IdLoc, Id, Type,
1608-
/*TInfo=*/nullptr, StorageClass::None) {
1597+
/*TInfo=*/nullptr, SC_None) {
16091598
NonParmVarDeclBits.ImplicitParamKind = ParamKind;
16101599
setImplicit();
16111600
}
16121601

16131602
ImplicitParamDecl(ASTContext &C, QualType Type, ImplicitParamKind ParamKind)
16141603
: VarDecl(ImplicitParam, C, /*DC=*/nullptr, SourceLocation(),
16151604
SourceLocation(), /*Id=*/nullptr, Type,
1616-
/*TInfo=*/nullptr, StorageClass::None) {
1605+
/*TInfo=*/nullptr, SC_None) {
16171606
NonParmVarDeclBits.ImplicitParamKind = ParamKind;
16181607
setImplicit();
16191608
}
@@ -2550,7 +2539,7 @@ class FunctionDecl : public DeclaratorDecl,
25502539

25512540
/// Sets the storage class as written in the source.
25522541
void setStorageClass(StorageClass SClass) {
2553-
FunctionDeclBits.SClass = static_cast<uint64_t>(SClass);
2542+
FunctionDeclBits.SClass = SClass;
25542543
}
25552544

25562545
/// Determine whether the "inline" keyword was specified for this
@@ -2577,7 +2566,7 @@ class FunctionDecl : public DeclaratorDecl,
25772566

25782567
bool doesDeclarationForceExternallyVisibleDefinition() const;
25792568

2580-
bool isStatic() const { return getStorageClass() == StorageClass::Static; }
2569+
bool isStatic() const { return getStorageClass() == SC_Static; }
25812570

25822571
/// Whether this function declaration represents an C++ overloaded
25832572
/// operator, e.g., "operator+".

clang/include/clang/AST/DeclCXX.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,7 +1843,7 @@ class CXXDeductionGuideDecl : public FunctionDecl {
18431843
const DeclarationNameInfo &NameInfo, QualType T,
18441844
TypeSourceInfo *TInfo, SourceLocation EndLocation)
18451845
: FunctionDecl(CXXDeductionGuide, C, DC, StartLoc, NameInfo, T, TInfo,
1846-
StorageClass::None, false, ConstexprSpecKind::Unspecified),
1846+
SC_None, false, ConstexprSpecKind::Unspecified),
18471847
ExplicitSpec(ES) {
18481848
if (EndLocation.isValid())
18491849
setRangeEnd(EndLocation);
@@ -2657,8 +2657,8 @@ class CXXDestructorDecl : public CXXMethodDecl {
26572657
bool isImplicitlyDeclared, ConstexprSpecKind ConstexprKind,
26582658
Expr *TrailingRequiresClause = nullptr)
26592659
: CXXMethodDecl(CXXDestructor, C, RD, StartLoc, NameInfo, T, TInfo,
2660-
StorageClass::None, isInline, ConstexprKind,
2661-
SourceLocation(), TrailingRequiresClause) {
2660+
SC_None, isInline, ConstexprKind, SourceLocation(),
2661+
TrailingRequiresClause) {
26622662
setImplicit(isImplicitlyDeclared);
26632663
}
26642664

@@ -2713,7 +2713,7 @@ class CXXConversionDecl : public CXXMethodDecl {
27132713
ConstexprSpecKind ConstexprKind, SourceLocation EndLocation,
27142714
Expr *TrailingRequiresClause = nullptr)
27152715
: CXXMethodDecl(CXXConversion, C, RD, StartLoc, NameInfo, T, TInfo,
2716-
StorageClass::None, isInline, ConstexprKind, EndLocation,
2716+
SC_None, isInline, ConstexprKind, EndLocation,
27172717
TrailingRequiresClause),
27182718
ExplicitSpec(ES) {}
27192719
void anchor() override;

clang/include/clang/AST/DeclOpenMP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class OMPCapturedExprDecl final : public VarDecl {
388388
QualType Type, TypeSourceInfo *TInfo,
389389
SourceLocation StartLoc)
390390
: VarDecl(OMPCapturedExpr, C, DC, StartLoc, StartLoc, Id, Type, TInfo,
391-
StorageClass::None) {
391+
SC_None) {
392392
setImplicit();
393393
}
394394

clang/include/clang/ASTMatchers/ASTMatchers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4723,7 +4723,7 @@ AST_POLYMORPHIC_MATCHER(isExternC, AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl,
47234723
AST_POLYMORPHIC_MATCHER(isStaticStorageClass,
47244724
AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl,
47254725
VarDecl)) {
4726-
return Node.getStorageClass() == StorageClass::Static;
4726+
return Node.getStorageClass() == SC_Static;
47274727
}
47284728

47294729
/// Matches deleted function declarations.

clang/include/clang/Basic/Attr.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,15 +1954,15 @@ def IntelFPGAConstVar : SubsetSubject<Var,
19541954
def IntelFPGALocalStaticSlaveMemVar : SubsetSubject<Var,
19551955
[{S->getKind() != Decl::ImplicitParam &&
19561956
S->getKind() != Decl::NonTypeTemplateParm &&
1957-
(S->getStorageClass() == StorageClass::Static ||
1957+
(S->getStorageClass() == SC_Static ||
19581958
S->hasLocalStorage())}],
19591959
"local variables, static variables, slave memory arguments">;
19601960

19611961
def IntelFPGALocalOrStaticVar : SubsetSubject<Var,
19621962
[{S->getKind() != Decl::ImplicitParam &&
19631963
S->getKind() != Decl::ParmVar &&
19641964
S->getKind() != Decl::NonTypeTemplateParm &&
1965-
(S->getStorageClass() == StorageClass::Static ||
1965+
(S->getStorageClass() == SC_Static ||
19661966
S->hasLocalStorage())}],
19671967
"local variables, static variables">;
19681968

clang/include/clang/Basic/Specifiers.h

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -220,31 +220,21 @@ namespace clang {
220220
};
221221

222222
/// Storage classes.
223-
enum class StorageClass {
223+
enum StorageClass {
224224
// These are legal on both functions and variables.
225-
None,
226-
Extern,
227-
Static,
228-
PrivateExtern,
225+
SC_None,
226+
SC_Extern,
227+
SC_Static,
228+
SC_PrivateExtern,
229229

230230
// These are only legal on variables.
231-
Auto,
232-
Register
231+
SC_Auto,
232+
SC_Register
233233
};
234234

235235
/// Checks whether the given storage class is legal for functions.
236236
inline bool isLegalForFunction(StorageClass SC) {
237-
switch (SC) {
238-
case StorageClass::None:
239-
case StorageClass::Extern:
240-
case StorageClass::Static:
241-
case StorageClass::PrivateExtern:
242-
return true;
243-
case StorageClass::Auto:
244-
case StorageClass::Register:
245-
return false;
246-
}
247-
llvm_unreachable("unknown storage class");
237+
return SC <= SC_PrivateExtern;
248238
}
249239

250240
/// Checks whether the given storage class is legal for variables.

clang/lib/AST/ASTContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10708,7 +10708,7 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
1070810708
if (!VD->isFileVarDecl())
1070910709
return false;
1071010710
// Global named register variables (GNU extension) are never emitted.
10711-
if (VD->getStorageClass() == StorageClass::Register)
10711+
if (VD->getStorageClass() == SC_Register)
1071210712
return false;
1071310713
if (VD->getDescribedVarTemplate() ||
1071410714
isa<VarTemplatePartialSpecializationDecl>(VD))
@@ -11482,7 +11482,7 @@ bool ASTContext::mayExternalizeStaticVar(const Decl *D) const {
1148211482
(D->hasAttr<CUDAConstantAttr>() &&
1148311483
!D->getAttr<CUDAConstantAttr>()->isImplicit())) &&
1148411484
isa<VarDecl>(D) && cast<VarDecl>(D)->isFileVarDecl() &&
11485-
cast<VarDecl>(D)->getStorageClass() == StorageClass::Static;
11485+
cast<VarDecl>(D)->getStorageClass() == SC_Static;
1148611486
}
1148711487

1148811488
bool ASTContext::shouldExternalizeStaticVar(const Decl *D) const {

0 commit comments

Comments
 (0)