diff --git a/clang/include/clang/Basic/DiagnosticLexKinds.td b/clang/include/clang/Basic/DiagnosticLexKinds.td index 9e0449d34104..ef90bdf84c8a 100644 --- a/clang/include/clang/Basic/DiagnosticLexKinds.td +++ b/clang/include/clang/Basic/DiagnosticLexKinds.td @@ -33,7 +33,7 @@ def warn_cxx98_compat_less_colon_colon : Warning< def warn_cxx17_compat_spaceship : Warning< "'<=>' operator is incompatible with C++ standards before C++20">, InGroup, DefaultIgnore; -def warn_cxx2a_compat_spaceship : Warning< +def warn_cxx20_compat_spaceship : Warning< "'<=>' is a single token in C++20; " "add a space to avoid a change in behavior">, InGroup; @@ -78,7 +78,7 @@ def ext_token_used : Extension<"extension used">, def warn_cxx11_keyword : Warning<"'%0' is a keyword in C++11">, InGroup, DefaultIgnore; -def warn_cxx2a_keyword : Warning<"'%0' is a keyword in C++20">, +def warn_cxx20_keyword : Warning<"'%0' is a keyword in C++20">, InGroup, DefaultIgnore; def ext_unterminated_char_or_string : ExtWarn< diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 29497f9c8296..337614c33661 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -676,7 +676,7 @@ def err_ms_property_expected_comma_or_rparen : Error< def err_ms_property_initializer : Error< "property declaration cannot have an in-class initializer">; -def warn_cxx2a_compat_explicit_bool : Warning< +def warn_cxx20_compat_explicit_bool : Warning< "this expression will be parsed as explicit(bool) in C++20">, InGroup, DefaultIgnore; def warn_cxx17_compat_explicit_bool : Warning< diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 014ee1c2f2d7..1101bd5a4bb6 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -2009,7 +2009,7 @@ def err_reference_bind_init_list : Error< def err_init_list_bad_dest_type : Error< "%select{|non-aggregate }0type %1 cannot be initialized with an initializer " "list">; -def warn_cxx2a_compat_aggregate_init_with_ctors : Warning< +def warn_cxx20_compat_aggregate_init_with_ctors : Warning< "aggregate initialization of type %0 with user-declared constructors " "is incompatible with C++20">, DefaultIgnore, InGroup; @@ -2530,7 +2530,7 @@ def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning< "use of this statement in a constexpr %select{function|constructor}0 " "is incompatible with C++ standards before C++14">, InGroup, DefaultIgnore; -def ext_constexpr_body_invalid_stmt_cxx2a : ExtWarn< +def ext_constexpr_body_invalid_stmt_cxx20 : ExtWarn< "use of this statement in a constexpr %select{function|constructor}0 " "is a C++20 extension">, InGroup; def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning< @@ -2593,7 +2593,7 @@ def note_constexpr_body_previous_return : Note< "previous return statement is here">; // C++20 function try blocks in constexpr -def ext_constexpr_function_try_block_cxx2a : ExtWarn< +def ext_constexpr_function_try_block_cxx20 : ExtWarn< "function try block in constexpr %select{function|constructor}0 is " "a C++20 extension">, InGroup; def warn_cxx17_compat_constexpr_function_try_block : Warning< @@ -6294,10 +6294,10 @@ def note_array_init_plain_string_into_char8_t : Note< def err_array_init_utf8_string_into_char : Error< "%select{|ISO C++20 does not permit }0initialization of char array with " "UTF-8 string literal%select{ is not permitted by '-fchar8_t'|}0">; -def warn_cxx2a_compat_utf8_string : Warning< +def warn_cxx20_compat_utf8_string : Warning< "type of UTF-8 string literal will change from array of const char to " "array of const char8_t in C++20">, InGroup, DefaultIgnore; -def note_cxx2a_compat_utf8_string_remove_u8 : Note< +def note_cxx20_compat_utf8_string_remove_u8 : Note< "remove 'u8' prefix to avoid a change of behavior; " "Clang encodes unprefixed narrow string literals as UTF-8">; def err_array_init_different_type : Error< @@ -6438,7 +6438,7 @@ def warn_arith_conv_enum_float : Warning< "%plural{2:with|4:from|:and}0 " "%select{enumeration|floating-point}1 type %3">, InGroup, DefaultIgnore; -def warn_arith_conv_enum_float_cxx2a : Warning< +def warn_arith_conv_enum_float_cxx20 : Warning< "%sub{select_arith_conv_kind}0 " "%select{floating-point|enumeration}1 type %2 " "%plural{2:with|4:from|:and}0 " @@ -6448,27 +6448,27 @@ def warn_arith_conv_mixed_enum_types : Warning< "%sub{select_arith_conv_kind}0 " "different enumeration types%diff{ ($ and $)|}1,2">, InGroup, DefaultIgnore; -def warn_arith_conv_mixed_enum_types_cxx2a : Warning< +def warn_arith_conv_mixed_enum_types_cxx20 : Warning< "%sub{select_arith_conv_kind}0 " "different enumeration types%diff{ ($ and $)|}1,2 is deprecated">, InGroup; def warn_arith_conv_mixed_anon_enum_types : Warning< warn_arith_conv_mixed_enum_types.Text>, InGroup, DefaultIgnore; -def warn_arith_conv_mixed_anon_enum_types_cxx2a : Warning< - warn_arith_conv_mixed_enum_types_cxx2a.Text>, +def warn_arith_conv_mixed_anon_enum_types_cxx20 : Warning< + warn_arith_conv_mixed_enum_types_cxx20.Text>, InGroup; def warn_conditional_mixed_enum_types : Warning< warn_arith_conv_mixed_enum_types.Text>, InGroup, DefaultIgnore; -def warn_conditional_mixed_enum_types_cxx2a : Warning< - warn_arith_conv_mixed_enum_types_cxx2a.Text>, +def warn_conditional_mixed_enum_types_cxx20 : Warning< + warn_arith_conv_mixed_enum_types_cxx20.Text>, InGroup; def warn_comparison_mixed_enum_types : Warning< warn_arith_conv_mixed_enum_types.Text>, InGroup; -def warn_comparison_mixed_enum_types_cxx2a : Warning< - warn_arith_conv_mixed_enum_types_cxx2a.Text>, +def warn_comparison_mixed_enum_types_cxx20 : Warning< + warn_arith_conv_mixed_enum_types_cxx20.Text>, InGroup; def warn_comparison_of_mixed_enum_types_switch : Warning< "comparison of different enumeration types in switch statement" @@ -7253,7 +7253,7 @@ let CategoryName = "Lambda Issue" in { def warn_cxx17_compat_equals_this_lambda_capture : Warning< "explicit capture of 'this' with a capture default of '=' is incompatible " "with C++ standards before C++20">, InGroup, DefaultIgnore; - def ext_equals_this_lambda_capture_cxx2a : ExtWarn< + def ext_equals_this_lambda_capture_cxx20 : ExtWarn< "explicit capture of 'this' with a capture default of '=' " "is a C++20 extension">, InGroup; def warn_deprecated_this_capture : Warning< @@ -8129,7 +8129,7 @@ def ext_cxx14_attr : Extension< "use of the %0 attribute is a C++14 extension">, InGroup; def ext_cxx17_attr : Extension< "use of the %0 attribute is a C++17 extension">, InGroup; -def ext_cxx2a_attr : Extension< +def ext_cxx20_attr : Extension< "use of the %0 attribute is a C++20 extension">, InGroup; def warn_unused_comparison : Warning< diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index c9d99352f1f4..016263108602 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -3711,7 +3711,7 @@ LexNextToken: // Suggest adding a space between the '<=' and the '>' to avoid a // change in semantics if this turns up in C++ <=17 mode. if (getLangOpts().CPlusPlus && !isLexingRawMode()) { - Diag(BufferPtr, diag::warn_cxx2a_compat_spaceship) + Diag(BufferPtr, diag::warn_cxx20_compat_spaceship) << FixItHint::CreateInsertion( getSourceLocation(CurPtr + SizeTmp, SizeTmp2), " "); } diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index b29f0684df5d..961b55c9387d 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -772,7 +772,7 @@ static diag::kind getFutureCompatDiagKind(const IdentifierInfo &II, #define CXX11_KEYWORD(NAME, FLAGS) \ .Case(#NAME, diag::warn_cxx11_keyword) #define CXX20_KEYWORD(NAME, FLAGS) \ - .Case(#NAME, diag::warn_cxx2a_keyword) + .Case(#NAME, diag::warn_cxx20_keyword) #include "clang/Basic/TokenKinds.def" ; diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index a5c126188bf0..864b7b12fbab 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -3730,7 +3730,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, } else Tracker.skipToEnd(); } else { - Diag(Tok.getLocation(), diag::warn_cxx2a_compat_explicit_bool); + Diag(Tok.getLocation(), diag::warn_cxx20_compat_explicit_bool); } } isInvalid = DS.setFunctionSpecExplicit(ExplicitLoc, PrevSpec, DiagID, diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 45bea5d0474e..29c3b8d8567b 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -2840,7 +2840,7 @@ static void handleWarnUnusedResult(Sema &S, Decl *D, const ParsedAttr &AL) { const LangOptions &LO = S.getLangOpts(); if (AL.getNumArgs() == 1) { if (LO.CPlusPlus && !LO.CPlusPlus20) - S.Diag(AL.getLoc(), diag::ext_cxx2a_attr) << AL; + S.Diag(AL.getLoc(), diag::ext_cxx20_attr) << AL; // Since this this is spelled [[nodiscard]], get the optional string // literal. If in C++ mode, but not in C++2a mode, diagnose as an diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 9bb37a9b1336..e827fe3b1ace 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -2139,7 +2139,7 @@ static bool CheckConstexprFunctionBody(Sema &SemaRef, const FunctionDecl *Dcl, case Sema::CheckConstexprKind::Diagnose: SemaRef.Diag(Body->getBeginLoc(), !SemaRef.getLangOpts().CPlusPlus20 - ? diag::ext_constexpr_function_try_block_cxx2a + ? diag::ext_constexpr_function_try_block_cxx20 : diag::warn_cxx17_compat_constexpr_function_try_block) << isa(Dcl); break; @@ -2169,7 +2169,7 @@ static bool CheckConstexprFunctionBody(Sema &SemaRef, const FunctionDecl *Dcl, SemaRef.Diag(Cxx2aLoc, SemaRef.getLangOpts().CPlusPlus20 ? diag::warn_cxx17_compat_constexpr_body_invalid_stmt - : diag::ext_constexpr_body_invalid_stmt_cxx2a) + : diag::ext_constexpr_body_invalid_stmt_cxx20) << isa(Dcl); } else if (Cxx1yLoc.isValid()) { SemaRef.Diag(Cxx1yLoc, diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index b4072f04f724..5a0b67f0cd4a 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1392,7 +1392,7 @@ static void checkEnumArithmeticConversions(Sema &S, Expr *LHS, Expr *RHS, if ((!IsCompAssign && LEnum && R->isFloatingType()) || (REnum && L->isFloatingType())) { S.Diag(Loc, S.getLangOpts().CPlusPlus20 - ? diag::warn_arith_conv_enum_float_cxx2a + ? diag::warn_arith_conv_enum_float_cxx20 : diag::warn_arith_conv_enum_float) << LHS->getSourceRange() << RHS->getSourceRange() << (int)ACK << LEnum << L << R; @@ -1405,23 +1405,23 @@ static void checkEnumArithmeticConversions(Sema &S, Expr *LHS, Expr *RHS, // user cares about this, but this situation is still deprecated in // C++2a. Use a different warning group. DiagID = S.getLangOpts().CPlusPlus20 - ? diag::warn_arith_conv_mixed_anon_enum_types_cxx2a + ? diag::warn_arith_conv_mixed_anon_enum_types_cxx20 : diag::warn_arith_conv_mixed_anon_enum_types; } else if (ACK == Sema::ACK_Conditional) { // Conditional expressions are separated out because they have // historically had a different warning flag. DiagID = S.getLangOpts().CPlusPlus20 - ? diag::warn_conditional_mixed_enum_types_cxx2a + ? diag::warn_conditional_mixed_enum_types_cxx20 : diag::warn_conditional_mixed_enum_types; } else if (ACK == Sema::ACK_Comparison) { // Comparison expressions are separated out because they have // historically had a different warning flag. DiagID = S.getLangOpts().CPlusPlus20 - ? diag::warn_comparison_mixed_enum_types_cxx2a + ? diag::warn_comparison_mixed_enum_types_cxx20 : diag::warn_comparison_mixed_enum_types; } else { DiagID = S.getLangOpts().CPlusPlus20 - ? diag::warn_arith_conv_mixed_enum_types_cxx2a + ? diag::warn_arith_conv_mixed_enum_types_cxx20 : diag::warn_arith_conv_mixed_enum_types; } S.Diag(Loc, DiagID) << LHS->getSourceRange() << RHS->getSourceRange() @@ -1773,13 +1773,13 @@ Sema::ActOnStringLiteral(ArrayRef StringToks, Scope *UDLScope) { // becomes ill-formed in C++2a. if (getLangOpts().CPlusPlus && !getLangOpts().CPlusPlus20 && !getLangOpts().Char8 && Kind == StringLiteral::UTF8) { - Diag(StringTokLocs.front(), diag::warn_cxx2a_compat_utf8_string); + Diag(StringTokLocs.front(), diag::warn_cxx20_compat_utf8_string); // Create removals for all 'u8' prefixes in the string literal(s). This // ensures C++2a compatibility (but may change the program behavior when // built by non-Clang compilers for which the execution character set is // not always UTF-8). - auto RemovalDiag = PDiag(diag::note_cxx2a_compat_utf8_string_remove_u8); + auto RemovalDiag = PDiag(diag::note_cxx20_compat_utf8_string_remove_u8); SourceLocation RemovalDiagLoc; for (const Token &Tok : StringToks) { if (Tok.getKind() == tok::utf8_string_literal) { diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 1df4e81b99ec..9c6c9f103af2 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -1093,7 +1093,7 @@ void InitListChecker::CheckImplicitInitList(const InitializedEntity &Entity, auto *CXXRD = T->getAsCXXRecordDecl(); if (!VerifyOnly && CXXRD && CXXRD->hasUserDeclaredConstructor()) { SemaRef.Diag(StructuredSubobjectInitList->getBeginLoc(), - diag::warn_cxx2a_compat_aggregate_init_with_ctors) + diag::warn_cxx20_compat_aggregate_init_with_ctors) << StructuredSubobjectInitList->getSourceRange() << T; } } @@ -1236,7 +1236,7 @@ void InitListChecker::CheckExplicitInitList(const InitializedEntity &Entity, if (!HasEquivCtor) { SemaRef.Diag(IList->getBeginLoc(), - diag::warn_cxx2a_compat_aggregate_init_with_ctors) + diag::warn_cxx20_compat_aggregate_init_with_ctors) << IList->getSourceRange() << T; } } diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp index 8b3c971d079d..b4336aa430eb 100644 --- a/clang/lib/Sema/SemaLambda.cpp +++ b/clang/lib/Sema/SemaLambda.cpp @@ -1054,7 +1054,7 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, // redundant but accepted for compatibility with ISO C++14. --end note ] if (Intro.Default == LCD_ByCopy && C->Kind != LCK_StarThis) Diag(C->Loc, !getLangOpts().CPlusPlus20 - ? diag::ext_equals_this_lambda_capture_cxx2a + ? diag::ext_equals_this_lambda_capture_cxx20 : diag::warn_cxx17_compat_equals_this_lambda_capture); // C++11 [expr.prim.lambda]p12: