aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
authorMark de Wever <koraq@xs4all.nl>2023-04-30 15:27:00 +0200
committerMark de Wever <koraq@xs4all.nl>2023-05-04 19:19:52 +0200
commitba15d186e5cef2620d562c6c9d9a6d570382cd0a (patch)
tree86597639d900a05d6b2c25236f4640f9a1697ca3 /clang/lib
parent6d6880554c2cd8d4d83db56c74eda24c22e6323a (diff)
downloadllvm-ba15d186e5cef2620d562c6c9d9a6d570382cd0a.zip
llvm-ba15d186e5cef2620d562c6c9d9a6d570382cd0a.tar.gz
llvm-ba15d186e5cef2620d562c6c9d9a6d570382cd0a.tar.bz2
[clang] Use -std=c++23 instead of -std=c++2b
During the ISO C++ Committee meeting plenary session the C++23 Standard has been voted as technical complete. This updates the reference to c++2b to c++23 and updates the __cplusplus macro. Drive-by fixes c++1z -> c++17 and c++2a -> c++20 when seen. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D149553
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ExprConstant.cpp2
-rw-r--r--clang/lib/Basic/LangOptions.cpp2
-rw-r--r--clang/lib/Basic/Targets/OSTargets.cpp3
-rw-r--r--clang/lib/Driver/Driver.cpp5
-rw-r--r--clang/lib/Driver/ToolChains/Clang.cpp6
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp10
-rw-r--r--clang/lib/Headers/stdatomic.h2
-rw-r--r--clang/lib/Lex/Lexer.cpp8
-rw-r--r--clang/lib/Lex/LiteralSupport.cpp4
-rw-r--r--clang/lib/Lex/PPDirectives.cpp20
-rw-r--r--clang/lib/Lex/PPExpressions.cpp8
-rw-r--r--clang/lib/Parse/ParseDeclCXX.cpp2
-rw-r--r--clang/lib/Parse/ParseExpr.cpp6
-rw-r--r--clang/lib/Parse/ParseExprCXX.cpp10
-rw-r--r--clang/lib/Parse/ParseStmt.cpp6
-rw-r--r--clang/lib/Sema/Sema.cpp2
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp20
-rw-r--r--clang/lib/Sema/SemaExpr.cpp10
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp8
-rw-r--r--clang/lib/Sema/SemaModule.cpp2
-rw-r--r--clang/lib/Sema/SemaOverload.cpp4
-rw-r--r--clang/lib/Sema/SemaStmt.cpp8
-rw-r--r--clang/lib/Sema/SemaType.cpp2
23 files changed, 77 insertions, 73 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 49572b0..03eb5df 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -5043,7 +5043,7 @@ static EvalStmtResult EvaluateSwitch(StmtResult &Result, EvalInfo &Info,
static bool CheckLocalVariableDeclaration(EvalInfo &Info, const VarDecl *VD) {
// An expression E is a core constant expression unless the evaluation of E
- // would evaluate one of the following: [C++2b] - a control flow that passes
+ // would evaluate one of the following: [C++23] - a control flow that passes
// through a declaration of a variable with static or thread storage duration
// unless that variable is usable in constant expressions.
if (VD->isLocalVarDecl() && VD->isStaticLocal() &&
diff --git a/clang/lib/Basic/LangOptions.cpp b/clang/lib/Basic/LangOptions.cpp
index f22fe9a..1abbaa9 100644
--- a/clang/lib/Basic/LangOptions.cpp
+++ b/clang/lib/Basic/LangOptions.cpp
@@ -117,7 +117,7 @@ void LangOptions::setLangDefaults(LangOptions &Opts, Language Lang,
Opts.CPlusPlus14 = Std.isCPlusPlus14();
Opts.CPlusPlus17 = Std.isCPlusPlus17();
Opts.CPlusPlus20 = Std.isCPlusPlus20();
- Opts.CPlusPlus2b = Std.isCPlusPlus2b();
+ Opts.CPlusPlus23 = Std.isCPlusPlus23();
Opts.GNUMode = Std.isGNUMode();
Opts.GNUCVersion = 0;
Opts.HexFloats = Std.hasHexFloats();
diff --git a/clang/lib/Basic/Targets/OSTargets.cpp b/clang/lib/Basic/Targets/OSTargets.cpp
index 763235f..627bc91 100644
--- a/clang/lib/Basic/Targets/OSTargets.cpp
+++ b/clang/lib/Basic/Targets/OSTargets.cpp
@@ -214,7 +214,8 @@ static void addVisualCDefines(const LangOptions &Opts, MacroBuilder &Builder) {
Builder.defineMacro("_HAS_CHAR16_T_LANGUAGE_SUPPORT", Twine(1));
if (Opts.isCompatibleWithMSVC(LangOptions::MSVC2015)) {
- if (Opts.CPlusPlus2b)
+ if (Opts.CPlusPlus23)
+ // TODO update to the proper value.
Builder.defineMacro("_MSVC_LANG", "202004L");
else if (Opts.CPlusPlus20)
Builder.defineMacro("_MSVC_LANG", "202002L");
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 5091917..a2deb9b 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1395,8 +1395,9 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
const Arg *Std = Args.getLastArg(options::OPT_std_EQ);
ModulesModeCXX20 =
!Args.hasArg(options::OPT_fmodules) && Std &&
- (Std->containsValue("c++20") || Std->containsValue("c++2b") ||
- Std->containsValue("c++2a") || Std->containsValue("c++latest"));
+ (Std->containsValue("c++20") || Std->containsValue("c++2a") ||
+ Std->containsValue("c++23") || Std->containsValue("c++2b") ||
+ Std->containsValue("c++latest"));
// Process -fmodule-header{=} flags.
if (Arg *A = Args.getLastArg(options::OPT_fmodule_header_EQ,
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 5b93b84..32ba560 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3673,7 +3673,8 @@ static bool RenderModulesOptions(Compilation &C, const Driver &D,
bool HaveStdCXXModules =
IsCXX && Std &&
(Std->containsValue("c++2a") || Std->containsValue("c++20") ||
- Std->containsValue("c++2b") || Std->containsValue("c++latest"));
+ Std->containsValue("c++2b") || Std->containsValue("c++23") ||
+ Std->containsValue("c++latest"));
bool HaveModules = HaveStdCXXModules;
// -fmodules enables the use of precompiled modules (off by default).
@@ -6637,7 +6638,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
.Case("c++14", "-std=c++14")
.Case("c++17", "-std=c++17")
.Case("c++20", "-std=c++20")
- .Case("c++latest", "-std=c++2b")
+ // TODO add c++23 when MSVC supports it.
+ .Case("c++latest", "-std=c++23")
.Default("");
if (LanguageStandard.empty())
D.Diag(clang::diag::warn_drv_unused_argument)
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 0b39dd1..0c4e73e 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -452,7 +452,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
} else {
// -- __cplusplus
// FIXME: Use correct value for C++23.
- if (LangOpts.CPlusPlus2b)
+ if (LangOpts.CPlusPlus23)
Builder.defineMacro("__cplusplus", "202101L");
// [C++20] The integer literal 202002L.
else if (LangOpts.CPlusPlus20)
@@ -606,7 +606,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
Builder.defineMacro("__cpp_unicode_literals", "200710L");
Builder.defineMacro("__cpp_user_defined_literals", "200809L");
Builder.defineMacro("__cpp_lambdas", "200907L");
- Builder.defineMacro("__cpp_constexpr", LangOpts.CPlusPlus2b ? "202211L"
+ Builder.defineMacro("__cpp_constexpr", LangOpts.CPlusPlus23 ? "202211L"
: LangOpts.CPlusPlus20 ? "201907L"
: LangOpts.CPlusPlus17 ? "201603L"
: LangOpts.CPlusPlus14 ? "201304L"
@@ -690,15 +690,15 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
//Builder.defineMacro("__cpp_modules", "201907L");
Builder.defineMacro("__cpp_using_enum", "201907L");
}
- // C++2b features.
- if (LangOpts.CPlusPlus2b) {
+ // C++23 features.
+ if (LangOpts.CPlusPlus23) {
Builder.defineMacro("__cpp_implicit_move", "202011L");
Builder.defineMacro("__cpp_size_t_suffix", "202011L");
Builder.defineMacro("__cpp_if_consteval", "202106L");
Builder.defineMacro("__cpp_multidimensional_subscript", "202211L");
}
- // We provide those C++2b features as extensions in earlier language modes, so
+ // We provide those C++23 features as extensions in earlier language modes, so
// we also define their feature test macros.
if (LangOpts.CPlusPlus11)
Builder.defineMacro("__cpp_static_call_operator", "202207L");
diff --git a/clang/lib/Headers/stdatomic.h b/clang/lib/Headers/stdatomic.h
index 48b3ab9..aed33d4 100644
--- a/clang/lib/Headers/stdatomic.h
+++ b/clang/lib/Headers/stdatomic.h
@@ -49,7 +49,7 @@ extern "C" {
in C2x mode; switch to the correct values once they've been published. */
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ < 202000L) || \
defined(__cplusplus)
-/* ATOMIC_VAR_INIT was removed in C2x, but still remains in C++2b. */
+/* ATOMIC_VAR_INIT was removed in C2x, but still remains in C++23. */
#define ATOMIC_VAR_INIT(value) (value)
#endif
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index 1b00f7c..82f65ef 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/lib/Lex/Lexer.cpp
@@ -3348,8 +3348,8 @@ std::optional<uint32_t> Lexer::tryReadNumericUCN(const char *&StartPtr,
}
if (Delimited && PP) {
- Diag(SlashLoc, PP->getLangOpts().CPlusPlus2b
- ? diag::warn_cxx2b_delimited_escape_sequence
+ Diag(SlashLoc, PP->getLangOpts().CPlusPlus23
+ ? diag::warn_cxx23_delimited_escape_sequence
: diag::ext_delimited_escape_sequence)
<< /*delimited*/ 0 << (PP->getLangOpts().CPlusPlus ? 1 : 0);
}
@@ -3436,8 +3436,8 @@ std::optional<uint32_t> Lexer::tryReadNamedUCN(const char *&StartPtr,
}
if (Diagnose && Match)
- Diag(SlashLoc, PP->getLangOpts().CPlusPlus2b
- ? diag::warn_cxx2b_delimited_escape_sequence
+ Diag(SlashLoc, PP->getLangOpts().CPlusPlus23
+ ? diag::warn_cxx23_delimited_escape_sequence
: diag::ext_delimited_escape_sequence)
<< /*named*/ 1 << (PP->getLangOpts().CPlusPlus ? 1 : 0);
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp
index 9cc0215..c066e1d 100644
--- a/clang/lib/Lex/LiteralSupport.cpp
+++ b/clang/lib/Lex/LiteralSupport.cpp
@@ -312,7 +312,7 @@ static unsigned ProcessCharEscape(const char *ThisTokBegin,
<< tok::r_brace;
else if (!HadError) {
Diag(Diags, Features, Loc, ThisTokBegin, EscapeBegin, ThisTokBuf,
- Features.CPlusPlus2b ? diag::warn_cxx2b_delimited_escape_sequence
+ Features.CPlusPlus23 ? diag::warn_cxx23_delimited_escape_sequence
: diag::ext_delimited_escape_sequence)
<< /*delimited*/ 0 << (Features.CPlusPlus ? 1 : 0);
}
@@ -641,7 +641,7 @@ static bool ProcessUCNEscape(const char *ThisTokBegin, const char *&ThisTokBuf,
if ((IsDelimitedEscapeSequence || IsNamedEscapeSequence) && Diags)
Diag(Diags, Features, Loc, ThisTokBegin, UcnBegin, ThisTokBuf,
- Features.CPlusPlus2b ? diag::warn_cxx2b_delimited_escape_sequence
+ Features.CPlusPlus23 ? diag::warn_cxx23_delimited_escape_sequence
: diag::ext_delimited_escape_sequence)
<< (IsNamedEscapeSequence ? 1 : 0) << (Features.CPlusPlus ? 1 : 0);
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 7e4ba98..62e51e1 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -434,7 +434,7 @@ void Preprocessor::SuggestTypoedDirective(const Token &Tok,
std::vector<StringRef> Candidates = {
"if", "ifdef", "ifndef", "elif", "else", "endif"
};
- if (LangOpts.C2x || LangOpts.CPlusPlus2b)
+ if (LangOpts.C2x || LangOpts.CPlusPlus23)
Candidates.insert(Candidates.end(), {"elifdef", "elifndef"});
if (std::optional<StringRef> Sugg = findSimilarStr(Directive, Candidates)) {
@@ -745,12 +745,12 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation HashTokenLoc,
if (!CondInfo.WasSkipping)
SkippingRangeState.endLexPass(Hashptr);
- // Warn if using `#elifdef` & `#elifndef` in not C2x & C++2b mode even
+ // Warn if using `#elifdef` & `#elifndef` in not C2x & C++23 mode even
// if this branch is in a skipping block.
unsigned DiagID;
if (LangOpts.CPlusPlus)
- DiagID = LangOpts.CPlusPlus2b ? diag::warn_cxx2b_compat_pp_directive
- : diag::ext_cxx2b_pp_directive;
+ DiagID = LangOpts.CPlusPlus23 ? diag::warn_cxx23_compat_pp_directive
+ : diag::ext_cxx23_pp_directive;
else
DiagID = LangOpts.C2x ? diag::warn_c2x_compat_pp_directive
: diag::ext_c2x_pp_directive;
@@ -1256,10 +1256,10 @@ void Preprocessor::HandleDirective(Token &Result) {
case tok::pp_warning:
if (LangOpts.CPlusPlus)
- Diag(Result, LangOpts.CPlusPlus2b
- ? diag::warn_cxx2b_compat_warning_directive
+ Diag(Result, LangOpts.CPlusPlus23
+ ? diag::warn_cxx23_compat_warning_directive
: diag::ext_pp_warning_directive)
- << /*C++2b*/ 1;
+ << /*C++23*/ 1;
else
Diag(Result, LangOpts.C2x ? diag::warn_c2x_compat_warning_directive
: diag::ext_pp_warning_directive)
@@ -3423,14 +3423,14 @@ void Preprocessor::HandleElifFamilyDirective(Token &ElifToken,
: PED_Elifndef;
++NumElse;
- // Warn if using `#elifdef` & `#elifndef` in not C2x & C++2b mode.
+ // Warn if using `#elifdef` & `#elifndef` in not C2x & C++23 mode.
switch (DirKind) {
case PED_Elifdef:
case PED_Elifndef:
unsigned DiagID;
if (LangOpts.CPlusPlus)
- DiagID = LangOpts.CPlusPlus2b ? diag::warn_cxx2b_compat_pp_directive
- : diag::ext_cxx2b_pp_directive;
+ DiagID = LangOpts.CPlusPlus23 ? diag::warn_cxx23_compat_pp_directive
+ : diag::ext_cxx23_pp_directive;
else
DiagID = LangOpts.C2x ? diag::warn_c2x_compat_pp_directive
: diag::ext_c2x_pp_directive;
diff --git a/clang/lib/Lex/PPExpressions.cpp b/clang/lib/Lex/PPExpressions.cpp
index aa411cf..6c93514 100644
--- a/clang/lib/Lex/PPExpressions.cpp
+++ b/clang/lib/Lex/PPExpressions.cpp
@@ -323,13 +323,13 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT,
PP.Diag(PeekTok, diag::ext_c99_longlong);
}
- // 'z/uz' literals are a C++2b feature.
+ // 'z/uz' literals are a C++23 feature.
if (Literal.isSizeT)
PP.Diag(PeekTok, PP.getLangOpts().CPlusPlus
- ? PP.getLangOpts().CPlusPlus2b
+ ? PP.getLangOpts().CPlusPlus23
? diag::warn_cxx20_compat_size_t_suffix
- : diag::ext_cxx2b_size_t_suffix
- : diag::err_cxx2b_size_t_suffix);
+ : diag::ext_cxx23_size_t_suffix
+ : diag::err_cxx23_size_t_suffix);
// 'wb/uwb' literals are a C2x feature. We explicitly do not support the
// suffix in C++ as an extension because a library-based UDL that resolves
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index 4aecd48..717c014 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -1076,7 +1076,7 @@ SourceLocation Parser::ParseDecltypeSpecifier(DeclSpec &DS) {
// Check for C++1y 'decltype(auto)'.
if (Tok.is(tok::kw_auto) && NextToken().is(tok::r_paren)) {
// the typename-specifier in a function-style cast expression may
- // be 'auto' since C++2b.
+ // be 'auto' since C++23.
Diag(Tok.getLocation(),
getLangOpts().CPlusPlus14
? diag::warn_cxx11_compat_decltype_auto_type_specifier
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 14f48c7..b99baf4 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -1871,7 +1871,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
/// primary-expression
/// postfix-expression '[' expression ']'
/// postfix-expression '[' braced-init-list ']'
-/// postfix-expression '[' expression-list [opt] ']' [C++2b 12.4.5]
+/// postfix-expression '[' expression-list [opt] ']' [C++23 12.4.5]
/// postfix-expression '(' argument-expression-list[opt] ')'
/// postfix-expression '.' identifier
/// postfix-expression '->' identifier
@@ -1946,10 +1946,10 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
// We try to parse a list of indexes in all language mode first
// and, in we find 0 or one index, we try to parse an OpenMP array
- // section. This allow us to support C++2b multi dimensional subscript and
+ // section. This allow us to support C++23 multi dimensional subscript and
// OpenMp sections in the same language mode.
if (!getLangOpts().OpenMP || Tok.isNot(tok::colon)) {
- if (!getLangOpts().CPlusPlus2b) {
+ if (!getLangOpts().CPlusPlus23) {
ExprResult Idx;
if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace)) {
Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index 54f5408..8f56316 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -725,7 +725,7 @@ ExprResult Parser::ParseCXXIdExpression(bool isAddressOfOperand) {
/// '&' identifier initializer
///
/// lambda-declarator:
-/// lambda-specifiers [C++2b]
+/// lambda-specifiers [C++23]
/// '(' parameter-declaration-clause ')' lambda-specifiers
/// requires-clause[opt]
///
@@ -1205,7 +1205,7 @@ static void tryConsumeLambdaSpecifierToken(Parser &P,
static void addStaticToLambdaDeclSpecifier(Parser &P, SourceLocation StaticLoc,
DeclSpec &DS) {
if (StaticLoc.isValid()) {
- P.Diag(StaticLoc, !P.getLangOpts().CPlusPlus2b
+ P.Diag(StaticLoc, !P.getLangOpts().CPlusPlus23
? diag::err_static_lambda
: diag::warn_cxx20_compat_static_lambda);
const char *PrevSpec = nullptr;
@@ -1362,7 +1362,7 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer(
// or operator template declaration. We accept this as a conforming extension
// in all language modes that support lambdas.
if (isCXX11AttributeSpecifier()) {
- Diag(Tok, getLangOpts().CPlusPlus2b
+ Diag(Tok, getLangOpts().CPlusPlus23
? diag::warn_cxx20_compat_decl_attrs_on_lambda
: diag::ext_decl_attrs_on_lambda);
MaybeParseCXX11Attributes(D);
@@ -1501,7 +1501,7 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer(
tok::kw_requires, tok::kw_noexcept) ||
(Tok.is(tok::l_square) && NextToken().is(tok::l_square));
- if (HasSpecifiers && !HasParentheses && !getLangOpts().CPlusPlus2b) {
+ if (HasSpecifiers && !HasParentheses && !getLangOpts().CPlusPlus23) {
// It's common to forget that one needs '()' before 'mutable', an
// attribute specifier, the result type, or the requires clause. Deal with
// this.
@@ -1996,7 +1996,7 @@ Parser::ParseAliasDeclarationInInitStatement(DeclaratorContext Context,
if (!DG)
return DG;
- Diag(DeclStart, !getLangOpts().CPlusPlus2b
+ Diag(DeclStart, !getLangOpts().CPlusPlus23
? diag::ext_alias_in_init_statement
: diag::warn_cxx20_alias_in_init_statement)
<< SourceRange(DeclStart, DeclEnd);
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index 5a68e74..b423c5c 100644
--- a/clang/lib/Parse/ParseStmt.cpp
+++ b/clang/lib/Parse/ParseStmt.cpp
@@ -1053,7 +1053,7 @@ void Parser::ParseCompoundStatementLeadingPragmas() {
void Parser::DiagnoseLabelAtEndOfCompoundStatement() {
if (getLangOpts().CPlusPlus) {
- Diag(Tok, getLangOpts().CPlusPlus2b
+ Diag(Tok, getLangOpts().CPlusPlus23
? diag::warn_cxx20_compat_label_end_of_compound_statement
: diag::ext_cxx_label_end_of_compound_statement);
} else {
@@ -1457,7 +1457,7 @@ StmtResult Parser::ParseIfStatement(SourceLocation *TrailingElseLoc) {
}
if (Tok.is(tok::kw_consteval)) {
- Diag(Tok, getLangOpts().CPlusPlus2b ? diag::warn_cxx20_compat_consteval_if
+ Diag(Tok, getLangOpts().CPlusPlus23 ? diag::warn_cxx20_compat_consteval_if
: diag::ext_consteval_if);
IsConsteval = true;
ConstevalLoc = ConsumeToken();
@@ -1929,7 +1929,7 @@ bool Parser::isForRangeIdentifier() {
/// [C++] for-init-statement:
/// [C++] expression-statement
/// [C++] simple-declaration
-/// [C++2b] alias-declaration
+/// [C++23] alias-declaration
///
/// [C++0x] for-range-declaration:
/// [C++0x] attribute-specifier-seq[opt] type-specifier-seq declarator
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 2df9b19..07ece40 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -2169,7 +2169,7 @@ static void checkEscapingByref(VarDecl *VD, Sema &S) {
new (S.Context) DeclRefExpr(S.Context, VD, false, T, VK_LValue, Loc);
ExprResult Result;
auto IE = InitializedEntity::InitializeBlock(Loc, T);
- if (S.getLangOpts().CPlusPlus2b) {
+ if (S.getLangOpts().CPlusPlus23) {
auto *E = ImplicitCastExpr::Create(S.Context, T, CK_NoOp, VarRef, nullptr,
VK_XValue, FPOptionsOverride());
Result = S.PerformCopyInitialization(IE, SourceLocation(), E);
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index eb31081..a746d8c 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -762,7 +762,7 @@ Sema::ActOnDecompositionDeclarator(Scope *S, Declarator &D,
// C++20 [dcl.dcl]/8:
// If decl-specifier-seq contains any decl-specifier other than static,
// thread_local, auto, or cv-qualifiers, the program is ill-formed.
- // C++2b [dcl.pre]/6:
+ // C++23 [dcl.pre]/6:
// Each decl-specifier in the decl-specifier-seq shall be static,
// thread_local, auto (9.2.9.6 [dcl.spec.auto]), or a cv-qualifier.
auto &DS = D.getDeclSpec();
@@ -1928,16 +1928,16 @@ static bool CheckConstexprDeclStmt(Sema &SemaRef, const FunctionDecl *Dcl,
if (VD->isStaticLocal()) {
if (Kind == Sema::CheckConstexprKind::Diagnose) {
SemaRef.Diag(VD->getLocation(),
- SemaRef.getLangOpts().CPlusPlus2b
+ SemaRef.getLangOpts().CPlusPlus23
? diag::warn_cxx20_compat_constexpr_var
: diag::ext_constexpr_static_var)
<< isa<CXXConstructorDecl>(Dcl)
<< (VD->getTLSKind() == VarDecl::TLS_Dynamic);
- } else if (!SemaRef.getLangOpts().CPlusPlus2b) {
+ } else if (!SemaRef.getLangOpts().CPlusPlus23) {
return false;
}
}
- if (SemaRef.LangOpts.CPlusPlus2b) {
+ if (SemaRef.LangOpts.CPlusPlus23) {
CheckLiteralType(SemaRef, Kind, VD->getLocation(), VD->getType(),
diag::warn_cxx20_compat_constexpr_var,
isa<CXXConstructorDecl>(Dcl),
@@ -2276,15 +2276,15 @@ static bool CheckConstexprFunctionBody(Sema &SemaRef, const FunctionDecl *Dcl,
if (Kind == Sema::CheckConstexprKind::CheckValid) {
// If this is only valid as an extension, report that we don't satisfy the
// constraints of the current language.
- if ((Cxx2bLoc.isValid() && !SemaRef.getLangOpts().CPlusPlus2b) ||
+ if ((Cxx2bLoc.isValid() && !SemaRef.getLangOpts().CPlusPlus23) ||
(Cxx2aLoc.isValid() && !SemaRef.getLangOpts().CPlusPlus20) ||
(Cxx1yLoc.isValid() && !SemaRef.getLangOpts().CPlusPlus17))
return false;
} else if (Cxx2bLoc.isValid()) {
SemaRef.Diag(Cxx2bLoc,
- SemaRef.getLangOpts().CPlusPlus2b
+ SemaRef.getLangOpts().CPlusPlus23
? diag::warn_cxx20_compat_constexpr_body_invalid_stmt
- : diag::ext_constexpr_body_invalid_stmt_cxx2b)
+ : diag::ext_constexpr_body_invalid_stmt_cxx23)
<< isa<CXXConstructorDecl>(Dcl);
} else if (Cxx2aLoc.isValid()) {
SemaRef.Diag(Cxx2aLoc,
@@ -15976,7 +15976,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) {
if (MethodDecl->isStatic()) {
if (Op == OO_Call || Op == OO_Subscript)
Diag(FnDecl->getLocation(),
- (LangOpts.CPlusPlus2b
+ (LangOpts.CPlusPlus23
? diag::warn_cxx20_compat_operator_overload_static
: diag::ext_operator_overload_static))
<< FnDecl;
@@ -16017,7 +16017,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) {
}
if (FirstDefaultedParam) {
if (Op == OO_Subscript) {
- Diag(FnDecl->getLocation(), LangOpts.CPlusPlus2b
+ Diag(FnDecl->getLocation(), LangOpts.CPlusPlus23
? diag::ext_subscript_overload
: diag::error_subscript_overload)
<< FnDecl->getDeclName() << 1
@@ -16068,7 +16068,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) {
}
if (Op == OO_Subscript && NumParams != 2) {
- Diag(FnDecl->getLocation(), LangOpts.CPlusPlus2b
+ Diag(FnDecl->getLocation(), LangOpts.CPlusPlus23
? diag::ext_subscript_overload
: diag::error_subscript_overload)
<< FnDecl->getDeclName() << (NumParams == 1 ? 0 : 2);
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index ce5f5fa..622b364 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -3957,13 +3957,13 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
} else {
QualType Ty;
- // 'z/uz' literals are a C++2b feature.
+ // 'z/uz' literals are a C++23 feature.
if (Literal.isSizeT)
Diag(Tok.getLocation(), getLangOpts().CPlusPlus
- ? getLangOpts().CPlusPlus2b
+ ? getLangOpts().CPlusPlus23
? diag::warn_cxx20_compat_size_t_suffix
- : diag::ext_cxx2b_size_t_suffix
- : diag::err_cxx2b_size_t_suffix);
+ : diag::ext_cxx23_size_t_suffix
+ : diag::err_cxx23_size_t_suffix);
// 'wb/uwb' literals are a C2x feature. We support _BitInt as a type in C++,
// but we do not currently support the suffix in C++ mode because it's not
@@ -4043,7 +4043,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
Ty = Context.getBitIntType(Literal.isUnsigned, Width);
}
- // Check C++2b size_t literals.
+ // Check C++23 size_t literals.
if (Literal.isSizeT) {
assert(!Literal.MicrosoftInteger &&
"size_t literals can't be Microsoft literals");
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index c440a4d..2bf5e6a 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -1467,10 +1467,10 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo,
: InitializationKind::CreateValue(TyBeginLoc, LParenOrBraceLoc,
RParenOrBraceLoc);
- // C++1z [expr.type.conv]p1:
+ // C++17 [expr.type.conv]p1:
// If the type is a placeholder for a deduced class type, [...perform class
// template argument deduction...]
- // C++2b:
+ // C++23:
// Otherwise, if the type contains a placeholder type, it is replaced by the
// type determined by placeholder type deduction.
DeducedType *Deduced = Ty->getContainedDeducedType();
@@ -1497,7 +1497,7 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo,
diag::err_auto_expr_init_multiple_expressions)
<< Ty << FullRange);
}
- if (getLangOpts().CPlusPlus2b) {
+ if (getLangOpts().CPlusPlus23) {
if (Ty->getAs<AutoType>())
Diag(TyBeginLoc, diag::warn_cxx20_compat_auto_expr) << FullRange;
}
@@ -4022,7 +4022,7 @@ ExprResult Sema::CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr) {
// The value of a condition that is an expression is the value of the
// expression, implicitly converted to bool.
//
- // C++2b 8.5.2p2
+ // C++23 8.5.2p2
// If the if statement is of the form if constexpr, the value of the condition
// is contextually converted to bool and the converted expression shall be
// a constant expression.
diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp
index 84a1fd8..53e453b 100644
--- a/clang/lib/Sema/SemaModule.cpp
+++ b/clang/lib/Sema/SemaModule.cpp
@@ -255,7 +255,7 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc,
}
}
- // C++2b [module.unit]p1: ... The identifiers module and import shall not
+ // C++23 [module.unit]p1: ... The identifiers module and import shall not
// appear as identifiers in a module-name or module-partition. All
// module-names either beginning with an identifier consisting of std
// followed by zero or more digits or containing a reserved identifier
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 2f26c8f..135bf80 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -9929,7 +9929,7 @@ bool clang::isBetterOverloadCandidate(
}
}
- // C++ [over.match.best]p1: (Changed in C++2b)
+ // C++ [over.match.best]p1: (Changed in C++23)
//
// -- if F is a static member function, ICS1(F) is defined such
// that ICS1(F) is neither better nor worse than ICS1(G) for
@@ -15099,7 +15099,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
bool IsError = false;
// Initialize the implicit object parameter if needed.
- // Since C++2b, this could also be a call to a static call operator
+ // Since C++23, this could also be a call to a static call operator
// which we emit as a regular CallExpr.
if (Method->isInstance()) {
ExprResult ObjRes = PerformObjectArgumentInitialization(
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 1af5f73..7daebbd 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -3364,7 +3364,7 @@ Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) {
/// might be modified by the implementation.
///
/// \param Mode Overrides detection of current language mode
-/// and uses the rules for C++2b.
+/// and uses the rules for C++23.
///
/// \returns An aggregate which contains the Candidate and isMoveEligible
/// and isCopyElidable methods. If Candidate is non-null, it means
@@ -3385,7 +3385,7 @@ Sema::NamedReturnInfo Sema::getNamedReturnInfo(Expr *&E,
if (Res.Candidate && !E->isXValue() &&
(Mode == SimplerImplicitMoveMode::ForceOn ||
(Mode != SimplerImplicitMoveMode::ForceOff &&
- getLangOpts().CPlusPlus2b))) {
+ getLangOpts().CPlusPlus23))) {
E = ImplicitCastExpr::Create(Context, VD->getType().getNonReferenceType(),
CK_NoOp, E, nullptr, VK_XValue,
FPOptionsOverride());
@@ -3529,7 +3529,7 @@ ExprResult Sema::PerformMoveOrCopyInitialization(
const InitializedEntity &Entity, const NamedReturnInfo &NRInfo, Expr *Value,
bool SupressSimplerImplicitMoves) {
if (getLangOpts().CPlusPlus &&
- (!getLangOpts().CPlusPlus2b || SupressSimplerImplicitMoves) &&
+ (!getLangOpts().CPlusPlus23 || SupressSimplerImplicitMoves) &&
NRInfo.isMoveEligible()) {
ImplicitCastExpr AsRvalue(ImplicitCastExpr::OnStack, Value->getType(),
CK_NoOp, Value, VK_XValue, FPOptionsOverride());
@@ -3902,7 +3902,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
static bool CheckSimplerImplicitMovesMSVCWorkaround(const Sema &S,
const Expr *E) {
- if (!E || !S.getLangOpts().CPlusPlus2b || !S.getLangOpts().MSVCCompat)
+ if (!E || !S.getLangOpts().CPlusPlus23 || !S.getLangOpts().MSVCCompat)
return false;
const Decl *D = E->getReferencedDeclOfCallee();
if (!D || !S.SourceMgr.isInSystemHeader(D->getLocation()))
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 19a41b0..da105e3 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -3645,7 +3645,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state,
case DeclaratorContext::FunctionalCast:
if (isa<DeducedTemplateSpecializationType>(Deduced))
break;
- if (SemaRef.getLangOpts().CPlusPlus2b && IsCXXAutoType &&
+ if (SemaRef.getLangOpts().CPlusPlus23 && IsCXXAutoType &&
!Auto->isDecltypeAuto())
break; // auto(x)
[[fallthrough]];