aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/DeclSpec.cpp
diff options
context:
space:
mode:
authorThorsten <schuett@gmail.com>2020-11-16 14:08:33 -0500
committerAaron Ballman <aaron@aaronballman.com>2020-11-16 14:10:19 -0500
commit41b65f166b51760f77d0f9e465b3858f46e101f0 (patch)
treeb6ce24e1571e09b9d6d02d27ca864a87fd407e8a /clang/lib/Sema/DeclSpec.cpp
parentee91e2311cf5209c39c46cd99de0fe686b7b5716 (diff)
downloadllvm-41b65f166b51760f77d0f9e465b3858f46e101f0.zip
llvm-41b65f166b51760f77d0f9e465b3858f46e101f0.tar.gz
llvm-41b65f166b51760f77d0f9e465b3858f46e101f0.tar.bz2
Convert ConstexprKind from Specifiers.h to a scoped enum; NFC
Diffstat (limited to 'clang/lib/Sema/DeclSpec.cpp')
-rw-r--r--clang/lib/Sema/DeclSpec.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp
index 7cef655..9368517 100644
--- a/clang/lib/Sema/DeclSpec.cpp
+++ b/clang/lib/Sema/DeclSpec.cpp
@@ -588,10 +588,14 @@ const char *DeclSpec::getSpecifierName(DeclSpec::TST T,
const char *DeclSpec::getSpecifierName(ConstexprSpecKind C) {
switch (C) {
- case CSK_unspecified: return "unspecified";
- case CSK_constexpr: return "constexpr";
- case CSK_consteval: return "consteval";
- case CSK_constinit: return "constinit";
+ case ConstexprSpecKind::Unspecified:
+ return "unspecified";
+ case ConstexprSpecKind::Constexpr:
+ return "constexpr";
+ case ConstexprSpecKind::Consteval:
+ return "consteval";
+ case ConstexprSpecKind::Constinit:
+ return "constinit";
}
llvm_unreachable("Unknown ConstexprSpecKind");
}
@@ -1085,10 +1089,10 @@ bool DeclSpec::setModulePrivateSpec(SourceLocation Loc, const char *&PrevSpec,
bool DeclSpec::SetConstexprSpec(ConstexprSpecKind ConstexprKind,
SourceLocation Loc, const char *&PrevSpec,
unsigned &DiagID) {
- if (getConstexprSpecifier() != CSK_unspecified)
+ if (getConstexprSpecifier() != ConstexprSpecKind::Unspecified)
return BadSpecifier(ConstexprKind, getConstexprSpecifier(), PrevSpec,
DiagID);
- ConstexprSpecifier = ConstexprKind;
+ ConstexprSpecifier = static_cast<unsigned>(ConstexprKind);
ConstexprLoc = Loc;
return false;
}
@@ -1354,11 +1358,11 @@ void DeclSpec::Finish(Sema &S, const PrintingPolicy &Policy) {
else if (TypeSpecType == TST_char16 || TypeSpecType == TST_char32)
S.Diag(TSTLoc, diag::warn_cxx98_compat_unicode_type)
<< (TypeSpecType == TST_char16 ? "char16_t" : "char32_t");
- if (getConstexprSpecifier() == CSK_constexpr)
+ if (getConstexprSpecifier() == ConstexprSpecKind::Constexpr)
S.Diag(ConstexprLoc, diag::warn_cxx98_compat_constexpr);
- else if (getConstexprSpecifier() == CSK_consteval)
+ else if (getConstexprSpecifier() == ConstexprSpecKind::Consteval)
S.Diag(ConstexprLoc, diag::warn_cxx20_compat_consteval);
- else if (getConstexprSpecifier() == CSK_constinit)
+ else if (getConstexprSpecifier() == ConstexprSpecKind::Constinit)
S.Diag(ConstexprLoc, diag::warn_cxx20_compat_constinit);
// C++ [class.friend]p6:
// No storage-class-specifier shall appear in the decl-specifier-seq