[clang-tools-extra] 0ce056a - [C23] Rename C2x -> C23; NFC
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 11 04:43:59 PDT 2023
Author: Aaron Ballman
Date: 2023-08-11T07:43:43-04:00
New Revision: 0ce056a814f8dbfd8d9b7720ce1df489c6ba5ddb
URL: https://github.com/llvm/llvm-project/commit/0ce056a814f8dbfd8d9b7720ce1df489c6ba5ddb
DIFF: https://github.com/llvm/llvm-project/commit/0ce056a814f8dbfd8d9b7720ce1df489c6ba5ddb.diff
LOG: [C23] Rename C2x -> C23; NFC
This does the rename for most internal uses of C2x, but does not rename
or reword diagnostics (those will be done in a follow-up).
I also updated standards references and citations to the final wording
in the standard.
Added:
Modified:
clang-tools-extra/clangd/index/StdLib.cpp
clang/include/clang/AST/ASTContext.h
clang/include/clang/AST/ExprCXX.h
clang/include/clang/AST/PrettyPrinter.h
clang/include/clang/AST/Type.h
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttributeCommonInfo.h
clang/include/clang/Basic/Features.def
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Basic/LangOptions.h
clang/include/clang/Basic/LangStandard.h
clang/include/clang/Basic/LangStandards.def
clang/include/clang/Basic/Specifiers.h
clang/include/clang/Basic/TokenKinds.def
clang/include/clang/Driver/Options.td
clang/include/clang/Lex/LiteralSupport.h
clang/include/clang/Parse/Parser.h
clang/lib/AST/CommentSema.cpp
clang/lib/AST/Expr.cpp
clang/lib/Basic/Attributes.cpp
clang/lib/Basic/IdentifierTable.cpp
clang/lib/Basic/LangOptions.cpp
clang/lib/Frontend/InitPreprocessor.cpp
clang/lib/Headers/limits.h
clang/lib/Headers/stdint.h
clang/lib/Headers/stdnoreturn.h
clang/lib/Lex/Lexer.cpp
clang/lib/Lex/LiteralSupport.cpp
clang/lib/Lex/PPDirectives.cpp
clang/lib/Lex/PPExpressions.cpp
clang/lib/Lex/PPMacroExpansion.cpp
clang/lib/Parse/ParseDecl.cpp
clang/lib/Parse/ParseDeclCXX.cpp
clang/lib/Parse/ParseExpr.cpp
clang/lib/Parse/ParseInit.cpp
clang/lib/Parse/ParseStmt.cpp
clang/lib/Parse/Parser.cpp
clang/lib/Sema/AnalysisBasedWarnings.cpp
clang/lib/Sema/SemaCast.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaCodeComplete.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaInit.cpp
clang/lib/Sema/SemaType.cpp
clang/utils/TableGen/ClangAttrEmitter.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/index/StdLib.cpp b/clang-tools-extra/clangd/index/StdLib.cpp
index f12b246255c9f1..477a5d1ebe523f 100644
--- a/clang-tools-extra/clangd/index/StdLib.cpp
+++ b/clang-tools-extra/clangd/index/StdLib.cpp
@@ -59,7 +59,7 @@ LangStandard::Kind standardFromOpts(const LangOptions &LO) {
return LangStandard::lang_cxx11;
return LangStandard::lang_cxx98;
}
- if (LO.C2x)
+ if (LO.C23)
return LangStandard::lang_c23;
// C17 has no new features, so treat {C11,C17} as C17.
if (LO.C11)
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index 40cadd93158c68..181b3362f7d649 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -1693,7 +1693,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
/// Return a ObjCObjectPointerType type for the given ObjCObjectType.
QualType getObjCObjectPointerType(QualType OIT) const;
- /// C2x feature and GCC extension.
+ /// C23 feature and GCC extension.
QualType getTypeOfExprType(Expr *E, TypeOfKind Kind) const;
QualType getTypeOfType(QualType QT, TypeOfKind Kind) const;
diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h
index f5e805257ce5a5..02fa997d674c8c 100644
--- a/clang/include/clang/AST/ExprCXX.h
+++ b/clang/include/clang/AST/ExprCXX.h
@@ -760,7 +760,7 @@ class CXXBoolLiteralExpr : public Expr {
/// The null pointer literal (C++11 [lex.nullptr])
///
/// Introduced in C++11, the only literal of type \c nullptr_t is \c nullptr.
-/// This also implements the null pointer literal in C2x (C2x 6.4.1) which is
+/// This also implements the null pointer literal in C23 (C23 6.4.1) which is
/// intended to have the same semantics as the feature in C++.
class CXXNullPtrLiteralExpr : public Expr {
public:
diff --git a/clang/include/clang/AST/PrettyPrinter.h b/clang/include/clang/AST/PrettyPrinter.h
index 8a0bc6dfb57b8c..cee3cce7729c30 100644
--- a/clang/include/clang/AST/PrettyPrinter.h
+++ b/clang/include/clang/AST/PrettyPrinter.h
@@ -66,7 +66,7 @@ struct PrintingPolicy {
SuppressLifetimeQualifiers(false),
SuppressTemplateArgsInCXXConstructors(false),
SuppressDefaultTemplateArgs(true), Bool(LO.Bool),
- Nullptr(LO.CPlusPlus11 || LO.C2x), NullptrTypeInNamespace(LO.CPlusPlus),
+ Nullptr(LO.CPlusPlus11 || LO.C23), NullptrTypeInNamespace(LO.CPlusPlus),
Restrict(LO.C99), Alignof(LO.CPlusPlus11), UnderscoreAlignof(LO.C11),
UseVoidForZeroParams(!LO.CPlusPlus),
SplitTemplateClosers(!LO.CPlusPlus11), TerseOutput(false),
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 79badb47d181e5..82a68e332765e8 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -1011,7 +1011,7 @@ class QualType {
/// type. To strip qualifiers even from within a sugared array type, use
/// ASTContext::getUnqualifiedArrayType.
///
- /// Note: In C, the _Atomic qualifier is special (see C2x 6.2.5p29 for
+ /// Note: In C, the _Atomic qualifier is special (see C23 6.2.5p32 for
/// details), and it is not stripped by this function. Use
/// getAtomicUnqualifiedType() to strip qualifiers including _Atomic.
inline QualType getUnqualifiedType() const;
@@ -2264,7 +2264,7 @@ class alignas(8) Type : public ExtQualsTypeCommonBase {
bool isCARCBridgableType() const;
bool isTemplateTypeParmType() const; // C++ template type parameter
bool isNullPtrType() const; // C++11 std::nullptr_t or
- // C2x nullptr_t
+ // C23 nullptr_t
bool isNothrowT() const; // C++ std::nothrow_t
bool isAlignValT() const; // C++17 std::align_val_t
bool isStdByteType() const; // C++17 std::byte
@@ -3618,7 +3618,7 @@ class MatrixType : public Type, public llvm::FoldingSetNode {
QualType getElementType() const { return ElementType; }
/// Valid elements types are the following:
- /// * an integer type (as in C2x 6.2.5p19), but excluding enumerated types
+ /// * an integer type (as in C23 6.2.5p22), but excluding enumerated types
/// and _Bool
/// * the standard floating types float or double
/// * a half-precision floating point type, if one is supported on the target
@@ -4695,8 +4695,8 @@ class MacroQualifiedType : public Type {
}
};
-/// Represents a `typeof` (or __typeof__) expression (a C2x feature and GCC
-/// extension) or a `typeof_unqual` expression (a C2x feature).
+/// Represents a `typeof` (or __typeof__) expression (a C23 feature and GCC
+/// extension) or a `typeof_unqual` expression (a C23 feature).
class TypeOfExprType : public Type {
Expr *TOExpr;
@@ -4746,8 +4746,8 @@ class DependentTypeOfExprType
Expr *E, bool IsUnqual);
};
-/// Represents `typeof(type)`, a C2x feature and GCC extension, or
-/// `typeof_unqual(type), a C2x feature.
+/// Represents `typeof(type)`, a C23 feature and GCC extension, or
+/// `typeof_unqual(type), a C23 feature.
class TypeOfType : public Type {
friend class ASTContext; // ASTContext creates these.
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td
index 84528660677750..8623bf1bb87b77 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -306,8 +306,8 @@ class CXX11<string namespace, string name, int version = 1>
: Spelling<name, "CXX11", version> {
string Namespace = namespace;
}
-class C2x<string namespace, string name, int version = 1>
- : Spelling<name, "C2x", version> {
+class C23<string namespace, string name, int version = 1>
+ : Spelling<name, "C23", version> {
string Namespace = namespace;
}
@@ -330,14 +330,14 @@ class Pragma<string namespace, string name> : Spelling<name, "Pragma"> {
}
// The GCC spelling implies GNU<name>, CXX11<"gnu", name>, and optionally,
-// C2x<"gnu", name>. This spelling should be used for any GCC-compatible
+// C23<"gnu", name>. This spelling should be used for any GCC-compatible
// attributes.
class GCC<string name, bit allowInC = 1> : Spelling<name, "GCC"> {
bit AllowInC = allowInC;
}
// The Clang spelling implies GNU<name>, CXX11<"clang", name>, and optionally,
-// C2x<"clang", name>. This spelling should be used for any Clang-specific
+// C23<"clang", name>. This spelling should be used for any Clang-specific
// attributes.
class Clang<string name, bit allowInC = 1, int version = 1>
: Spelling<name, "Clang", version> {
@@ -707,7 +707,7 @@ def Alias : Attr {
def BuiltinAlias : Attr {
let Spellings = [CXX11<"clang", "builtin_alias">,
- C2x<"clang", "builtin_alias">,
+ C23<"clang", "builtin_alias">,
GNU<"clang_builtin_alias">];
let Args = [IdentifierArgument<"BuiltinName">];
let Subjects = SubjectList<[Function], ErrorDiag>;
@@ -769,9 +769,9 @@ def AlignNatural : InheritableAttr {
def AlwaysInline : DeclOrStmtAttr {
let Spellings = [GCC<"always_inline">, CXX11<"clang", "always_inline">,
- C2x<"clang", "always_inline">, CustomKeyword<"__forceinline">];
+ C23<"clang", "always_inline">, CustomKeyword<"__forceinline">];
let Accessors = [Accessor<"isClangAlwaysInline", [CXX11<"clang", "always_inline">,
- C2x<"clang", "always_inline">]>];
+ C23<"clang", "always_inline">]>];
let Subjects = SubjectList<[Function, Stmt], WarnDiag,
"functions and statements">;
let Documentation = [AlwaysInlineDocs];
@@ -857,7 +857,7 @@ def Annotate : InheritableParamAttr {
}
def AnnotateType : TypeAttr {
- let Spellings = [CXX11<"clang", "annotate_type">, C2x<"clang", "annotate_type">];
+ let Spellings = [CXX11<"clang", "annotate_type">, C23<"clang", "annotate_type">];
let Args = [StringArgument<"Annotation">, VariadicExprArgument<"Args">];
let HasCustomParsing = 1;
let AcceptsExprPack = 1;
@@ -1297,7 +1297,7 @@ def C11NoReturn : InheritableAttr {
def CXX11NoReturn : InheritableAttr {
let Spellings = [CXX11<"", "noreturn", 200809>,
- C2x<"", "noreturn", 202202>, C2x<"", "_Noreturn", 202202>];
+ C23<"", "noreturn", 202202>, C23<"", "_Noreturn", 202202>];
let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [CXX11NoReturnDocs];
}
@@ -1401,7 +1401,7 @@ def RenderScriptKernel : Attr {
def Deprecated : InheritableAttr {
let Spellings = [GCC<"deprecated">, Declspec<"deprecated">,
CXX11<"","deprecated", 201309>,
- C2x<"", "deprecated", 201904>];
+ C23<"", "deprecated", 201904>];
let Args = [StringArgument<"Message", 1>,
// An optional string argument that enables us to provide a
// Fix-It.
@@ -1459,7 +1459,7 @@ def ExtVectorType : Attr {
def FallThrough : StmtAttr {
let Spellings = [CXX11<"", "fallthrough", 201603>,
- C2x<"", "fallthrough", 201910>,
+ C23<"", "fallthrough", 201910>,
CXX11<"clang", "fallthrough">, GCC<"fallthrough">];
// The attribute only applies to a NullStmt, but we have special fix-it
// behavior if applied to a case label.
@@ -1469,12 +1469,12 @@ def FallThrough : StmtAttr {
}
def Likely : StmtAttr {
- let Spellings = [CXX11<"", "likely", 201803>, C2x<"clang", "likely">];
+ let Spellings = [CXX11<"", "likely", 201803>, C23<"clang", "likely">];
let Documentation = [LikelihoodDocs];
}
def Unlikely : StmtAttr {
- let Spellings = [CXX11<"", "unlikely", 201803>, C2x<"clang", "unlikely">];
+ let Spellings = [CXX11<"", "unlikely", 201803>, C23<"clang", "unlikely">];
let Documentation = [LikelihoodDocs];
}
def : MutualExclusions<[Likely, Unlikely]>;
@@ -1853,10 +1853,10 @@ def Convergent : InheritableAttr {
def NoInline : DeclOrStmtAttr {
let Spellings = [CustomKeyword<"__noinline__">, GCC<"noinline">,
- CXX11<"clang", "noinline">, C2x<"clang", "noinline">,
+ CXX11<"clang", "noinline">, C23<"clang", "noinline">,
Declspec<"noinline">];
let Accessors = [Accessor<"isClangNoInline", [CXX11<"clang", "noinline">,
- C2x<"clang", "noinline">]>];
+ C23<"clang", "noinline">]>];
let Documentation = [NoInlineDocs];
let Subjects = SubjectList<[Function, Stmt], WarnDiag,
"functions and statements">;
@@ -2970,7 +2970,7 @@ def ObjCRequiresPropertyDefs : InheritableAttr {
def Unused : InheritableAttr {
let Spellings = [CXX11<"", "maybe_unused", 201603>, GCC<"unused">,
- C2x<"", "maybe_unused", 202106>];
+ C23<"", "maybe_unused", 202106>];
let Subjects = SubjectList<[Var, ObjCIvar, Type, Enum, EnumConstant, Label,
Field, ObjCMethod, FunctionLike]>;
let Documentation = [WarnMaybeUnusedDocs];
@@ -3064,7 +3064,7 @@ def WarnUnused : InheritableAttr {
def WarnUnusedResult : InheritableAttr {
let Spellings = [CXX11<"", "nodiscard", 201907>,
- C2x<"", "nodiscard", 202003>,
+ C23<"", "nodiscard", 202003>,
CXX11<"clang", "warn_unused_result">,
GCC<"warn_unused_result">];
let Subjects = SubjectList<[ObjCMethod, Enum, Record, FunctionLike, TypedefName]>;
diff --git a/clang/include/clang/Basic/AttributeCommonInfo.h b/clang/include/clang/Basic/AttributeCommonInfo.h
index 6396c0dc6ef029..e57adc4bf5b99a 100644
--- a/clang/include/clang/Basic/AttributeCommonInfo.h
+++ b/clang/include/clang/Basic/AttributeCommonInfo.h
@@ -31,7 +31,7 @@ class AttributeCommonInfo {
AS_CXX11,
/// [[...]]
- AS_C2x,
+ AS_C23,
/// __declspec(...)
AS_Declspec,
@@ -104,7 +104,7 @@ class AttributeCommonInfo {
static Form GNU() { return AS_GNU; }
static Form CXX11() { return AS_CXX11; }
- static Form C2x() { return AS_C2x; }
+ static Form C23() { return AS_C23; }
static Form Declspec() { return AS_Declspec; }
static Form Microsoft() { return AS_Microsoft; }
static Form Keyword(bool IsAlignas, bool IsRegularKeywordAttribute) {
@@ -188,12 +188,12 @@ class AttributeCommonInfo {
bool isCXX11Attribute() const { return SyntaxUsed == AS_CXX11 || IsAlignas; }
- bool isC2xAttribute() const { return SyntaxUsed == AS_C2x; }
+ bool isC23Attribute() const { return SyntaxUsed == AS_C23; }
/// The attribute is spelled [[]] in either C or C++ mode, including standard
/// attributes spelled with a keyword, like alignas.
bool isStandardAttributeSyntax() const {
- return isCXX11Attribute() || isC2xAttribute();
+ return isCXX11Attribute() || isC23Attribute();
}
bool isGNUAttribute() const { return SyntaxUsed == AS_GNU; }
diff --git a/clang/include/clang/Basic/Features.def b/clang/include/clang/Basic/Features.def
index e05ac46258272c..cbeb92fbe4fdd1 100644
--- a/clang/include/clang/Basic/Features.def
+++ b/clang/include/clang/Basic/Features.def
@@ -245,7 +245,7 @@ EXTENSION(c_generic_selections, true)
EXTENSION(c_generic_selection_with_controlling_type, true)
EXTENSION(c_static_assert, true)
EXTENSION(c_thread_local, PP.getTargetInfo().isTLSSupported())
-// C2x features supported by other languages as extensions
+// C23 features supported by other languages as extensions
EXTENSION(c_attributes, true)
// C++11 features supported by other languages as extensions.
EXTENSION(cxx_atomic, LangOpts.CPlusPlus)
diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def
index b6bb5e969e130c..102209ce899d70 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -86,7 +86,7 @@
LANGOPT(C99 , 1, 0, "C99")
LANGOPT(C11 , 1, 0, "C11")
LANGOPT(C17 , 1, 0, "C17")
-LANGOPT(C2x , 1, 0, "C2x")
+LANGOPT(C23 , 1, 0, "C23")
LANGOPT(MSVCCompat , 1, 0, "Microsoft Visual C++ full compatibility mode")
LANGOPT(Kernel , 1, 0, "Kernel mode")
LANGOPT(MicrosoftExt , 1, 0, "Microsoft C++ extensions")
diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h
index 3ef68ca8af6685..2adf4751444726 100644
--- a/clang/include/clang/Basic/LangOptions.h
+++ b/clang/include/clang/Basic/LangOptions.h
@@ -577,7 +577,7 @@ class LangOptions : public LangOptionsBase {
/// Returns true if functions without prototypes or functions with an
/// identifier list (aka K&R C functions) are not allowed.
bool requiresStrictPrototypes() const {
- return CPlusPlus || C2x || DisableKNRFunctions;
+ return CPlusPlus || C23 || DisableKNRFunctions;
}
/// Returns true if implicit function declarations are allowed in the current
@@ -590,7 +590,7 @@ class LangOptions : public LangOptionsBase {
bool isImplicitIntRequired() const { return !CPlusPlus && !C99; }
/// Returns true if implicit int is supported at all.
- bool isImplicitIntAllowed() const { return !CPlusPlus && !C2x; }
+ bool isImplicitIntAllowed() const { return !CPlusPlus && !C23; }
/// Check if return address signing is enabled.
bool hasSignReturnAddress() const {
@@ -746,7 +746,7 @@ class FPOptions {
RoundingMode getRoundingMode() const {
RoundingMode RM = getConstRoundingMode();
if (RM == RoundingMode::Dynamic) {
- // C2x: 7.6.2p3 If the FE_DYNAMIC mode is specified and FENV_ACCESS is
+ // C23: 7.6.2p3 If the FE_DYNAMIC mode is specified and FENV_ACCESS is
// "off", the translator may assume that the default rounding mode is in
// effect.
if (!getAllowFEnvAccess() && !getRoundingMath())
diff --git a/clang/include/clang/Basic/LangStandard.h b/clang/include/clang/Basic/LangStandard.h
index fd949bcd68555c..6356f16acc811e 100644
--- a/clang/include/clang/Basic/LangStandard.h
+++ b/clang/include/clang/Basic/LangStandard.h
@@ -49,7 +49,7 @@ enum LangFeatures {
C99 = (1 << 1),
C11 = (1 << 2),
C17 = (1 << 3),
- C2x = (1 << 4),
+ C23 = (1 << 4),
CPlusPlus = (1 << 5),
CPlusPlus11 = (1 << 6),
CPlusPlus14 = (1 << 7),
@@ -101,8 +101,8 @@ struct LangStandard {
/// isC17 - Language is a superset of C17.
bool isC17() const { return Flags & C17; }
- /// isC2x - Language is a superset of C2x.
- bool isC2x() const { return Flags & C2x; }
+ /// isC23 - Language is a superset of C23.
+ bool isC23() const { return Flags & C23; }
/// isCPlusPlus - Language is a C++ variant.
bool isCPlusPlus() const { return Flags & CPlusPlus; }
diff --git a/clang/include/clang/Basic/LangStandards.def b/clang/include/clang/Basic/LangStandards.def
index 90e279ffb790c8..b6192e48efc11f 100644
--- a/clang/include/clang/Basic/LangStandards.def
+++ b/clang/include/clang/Basic/LangStandards.def
@@ -90,11 +90,11 @@ LANGSTANDARD_ALIAS(gnu17, "gnu18")
// C23 modes
LANGSTANDARD(c23, "c23",
C, "Working Draft for ISO C23",
- LineComment | C99 | C11 | C17 | C2x | Digraphs | HexFloat)
+ LineComment | C99 | C11 | C17 | C23 | Digraphs | HexFloat)
LANGSTANDARD_ALIAS_DEPR(c23, "c2x")
LANGSTANDARD(gnu23, "gnu23",
C, "Working Draft for ISO C23 with GNU extensions",
- LineComment | C99 | C11 | C17 | C2x | Digraphs | GNUMode | HexFloat)
+ LineComment | C99 | C11 | C17 | C23 | Digraphs | GNUMode | HexFloat)
LANGSTANDARD_ALIAS_DEPR(gnu23, "gnu2x")
// FIXME: Add the alias for iso9899:202* once we know the year ISO publishes
// the document (expected to be 2024).
diff --git a/clang/include/clang/Basic/Specifiers.h b/clang/include/clang/Basic/Specifiers.h
index 06279a016a5078..6ae56703eca412 100644
--- a/clang/include/clang/Basic/Specifiers.h
+++ b/clang/include/clang/Basic/Specifiers.h
@@ -82,10 +82,10 @@ namespace clang {
TST_class, // C++ class type
TST_interface, // C++ (Microsoft-specific) __interface type
TST_typename, // Typedef, C++ class-name or enum name, etc.
- TST_typeofType, // C2x (and GNU extension) typeof(type-name)
- TST_typeofExpr, // C2x (and GNU extension) typeof(expression)
- TST_typeof_unqualType, // C2x typeof_unqual(type-name)
- TST_typeof_unqualExpr, // C2x typeof_unqual(expression)
+ TST_typeofType, // C23 (and GNU extension) typeof(type-name)
+ TST_typeofExpr, // C23 (and GNU extension) typeof(expression)
+ TST_typeof_unqualType, // C23 typeof_unqual(type-name)
+ TST_typeof_unqualExpr, // C23 typeof_unqual(expression)
TST_decltype, // C++11 decltype
#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) TST_##Trait,
#include "clang/Basic/TransformTypeTraits.def"
diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def
index ef0dad0f2dcd96..45ebc200b16898 100644
--- a/clang/include/clang/Basic/TokenKinds.def
+++ b/clang/include/clang/Basic/TokenKinds.def
@@ -31,8 +31,8 @@
#ifndef C99_KEYWORD
#define C99_KEYWORD(X,Y) KEYWORD(X,KEYC99|(Y))
#endif
-#ifndef C2X_KEYWORD
-#define C2X_KEYWORD(X,Y) KEYWORD(X,KEYC2X|(Y))
+#ifndef C23_KEYWORD
+#define C23_KEYWORD(X,Y) KEYWORD(X,KEYC23|(Y))
#endif
#ifndef COROUTINES_KEYWORD
#define COROUTINES_KEYWORD(X) CXX20_KEYWORD(X,KEYCOROUTINES)
@@ -259,7 +259,7 @@ PUNCTUATOR(caretcaret, "^^")
// always be treated as a keyword
// KEYC99 - This is a keyword introduced to C in C99
// KEYC11 - This is a keyword introduced to C in C11
-// KEYC2X - This is a keyword introduced to C in C2x
+// KEYC23 - This is a keyword introduced to C in C23
// KEYCXX - This is a C++ keyword, or a C++-specific keyword in the
// implementation namespace
// KEYNOCXX - This is a keyword in every non-C++ dialect.
@@ -336,7 +336,7 @@ KEYWORD(__objc_no , KEYALL)
// C++ 2.11p1: Keywords.
KEYWORD(asm , KEYCXX|KEYGNU)
-KEYWORD(bool , BOOLSUPPORT|KEYC2X)
+KEYWORD(bool , BOOLSUPPORT|KEYC23)
KEYWORD(catch , KEYCXX)
KEYWORD(class , KEYCXX)
KEYWORD(const_cast , KEYCXX)
@@ -344,7 +344,7 @@ KEYWORD(delete , KEYCXX)
KEYWORD(dynamic_cast , KEYCXX)
KEYWORD(explicit , KEYCXX)
KEYWORD(export , KEYCXX)
-KEYWORD(false , BOOLSUPPORT|KEYC2X)
+KEYWORD(false , BOOLSUPPORT|KEYC23)
KEYWORD(friend , KEYCXX)
KEYWORD(mutable , KEYCXX)
KEYWORD(namespace , KEYCXX)
@@ -358,7 +358,7 @@ KEYWORD(static_cast , KEYCXX)
KEYWORD(template , KEYCXX)
KEYWORD(this , KEYCXX)
KEYWORD(throw , KEYCXX)
-KEYWORD(true , BOOLSUPPORT|KEYC2X)
+KEYWORD(true , BOOLSUPPORT|KEYC23)
KEYWORD(try , KEYCXX)
KEYWORD(typename , KEYCXX)
KEYWORD(typeid , KEYCXX)
@@ -385,17 +385,17 @@ C99_KEYWORD(inline , KEYCXX|KEYGNU)
// C++11 keywords
-CXX11_KEYWORD(alignas , KEYC2X)
+CXX11_KEYWORD(alignas , KEYC23)
// alignof and _Alignof return the required ABI alignment
-CXX11_UNARY_EXPR_OR_TYPE_TRAIT(alignof, AlignOf, KEYC2X)
+CXX11_UNARY_EXPR_OR_TYPE_TRAIT(alignof, AlignOf, KEYC23)
CXX11_KEYWORD(char16_t , KEYNOMS18)
CXX11_KEYWORD(char32_t , KEYNOMS18)
CXX11_KEYWORD(constexpr , 0)
CXX11_KEYWORD(decltype , 0)
CXX11_KEYWORD(noexcept , 0)
-CXX11_KEYWORD(nullptr , KEYC2X)
-CXX11_KEYWORD(static_assert , KEYMSCOMPAT|KEYC2X)
-CXX11_KEYWORD(thread_local , KEYC2X)
+CXX11_KEYWORD(nullptr , KEYC23)
+CXX11_KEYWORD(static_assert , KEYMSCOMPAT|KEYC23)
+CXX11_KEYWORD(thread_local , KEYC23)
// C++20 / coroutines keywords
COROUTINES_KEYWORD(co_await)
@@ -418,9 +418,9 @@ KEYWORD(char8_t , CHAR8SUPPORT)
// C11 Extension
KEYWORD(_Float16 , KEYALL)
-// C2x keywords
-C2X_KEYWORD(typeof , KEYGNU)
-C2X_KEYWORD(typeof_unqual , 0)
+// C23 keywords
+C23_KEYWORD(typeof , KEYGNU)
+C23_KEYWORD(typeof_unqual , 0)
// ISO/IEC JTC1 SC22 WG14 N1169 Extension
KEYWORD(_Accum , KEYNOCXX)
@@ -987,5 +987,5 @@ ANNOTATION(repl_input_end)
#undef PUNCTUATOR
#undef TOK
#undef C99_KEYWORD
-#undef C2X_KEYWORD
+#undef C23_KEYWORD
#undef INTERESTING_IDENTIFIER
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index bf2163ed7d9754..8af5a110605846 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -553,7 +553,7 @@ defvar cpp11 = LangOpts<"CPlusPlus11">;
defvar cpp17 = LangOpts<"CPlusPlus17">;
defvar cpp20 = LangOpts<"CPlusPlus20">;
defvar c99 = LangOpts<"C99">;
-defvar c2x = LangOpts<"C2x">;
+defvar c23 = LangOpts<"C23">;
defvar lang_std = LangOpts<"LangStd">;
defvar open_cl = LangOpts<"OpenCL">;
defvar cuda = LangOpts<"CUDA">;
diff --git a/clang/include/clang/Lex/LiteralSupport.h b/clang/include/clang/Lex/LiteralSupport.h
index 8926577be764d0..643ddbdad8c87d 100644
--- a/clang/include/clang/Lex/LiteralSupport.h
+++ b/clang/include/clang/Lex/LiteralSupport.h
@@ -80,7 +80,7 @@ class NumericLiteralParser {
bool isFloat128 : 1; // 1.0q
bool isFract : 1; // 1.0hr/r/lr/uhr/ur/ulr
bool isAccum : 1; // 1.0hk/k/lk/uhk/uk/ulk
- bool isBitInt : 1; // 1wb, 1uwb (C2x)
+ bool isBitInt : 1; // 1wb, 1uwb (C23)
uint8_t MicrosoftInteger; // Microsoft suffix extension i8, i16, i32, or i64.
diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h
index b58041477c9ec9..6312318d0ba983 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -1091,9 +1091,9 @@ class Parser : public CodeCompletionHandler {
StmtExprBegin,
/// A '}' ')' ending a statement-expression.
StmtExprEnd,
- /// A '[' '[' beginning a C++11 or C2x attribute.
+ /// A '[' '[' beginning a C++11 or C23 attribute.
AttrBegin,
- /// A ']' ']' ending a C++11 or C2x attribute.
+ /// A ']' ']' ending a C++11 or C23 attribute.
AttrEnd,
/// A '::' '*' forming a C++ pointer-to-member declaration.
MemberPtr,
@@ -2766,7 +2766,7 @@ class Parser : public CodeCompletionHandler {
void DiagnoseProhibitedAttributes(const ParsedAttributesView &Attrs,
SourceLocation FixItLoc);
- // Forbid C++11 and C2x attributes that appear on certain syntactic locations
+ // Forbid C++11 and C23 attributes that appear on certain syntactic locations
// which standard permits but we don't supported yet, for example, attributes
// appertain to decl specifiers.
// For the most cases we don't want to warn on unknown type attributes, but
@@ -2777,16 +2777,16 @@ class Parser : public CodeCompletionHandler {
bool DiagnoseEmptyAttrs = false,
bool WarnOnUnknownAttrs = false);
- /// Skip C++11 and C2x attributes and return the end location of the
+ /// Skip C++11 and C23 attributes and return the end location of the
/// last one.
/// \returns SourceLocation() if there are no attributes.
SourceLocation SkipCXX11Attributes();
- /// Diagnose and skip C++11 and C2x attributes that appear in syntactic
+ /// Diagnose and skip C++11 and C23 attributes that appear in syntactic
/// locations where attributes are not allowed.
void DiagnoseAndSkipCXX11Attributes();
- /// Emit warnings for C++11 and C2x attributes that are in a position that
+ /// Emit warnings for C++11 and C23 attributes that are in a position that
/// clang accepts as an extension.
void DiagnoseCXX11AttributeExtension(ParsedAttributes &Attrs);
@@ -2908,7 +2908,7 @@ class Parser : public CodeCompletionHandler {
ReplayOpenMPAttributeTokens(OpenMPTokens);
}
void ParseCXX11Attributes(ParsedAttributes &attrs);
- /// Parses a C++11 (or C2x)-style attribute argument list. Returns true
+ /// Parses a C++11 (or C23)-style attribute argument list. Returns true
/// if this results in adding an attribute to the ParsedAttributes list.
bool ParseCXX11AttributeArgs(IdentifierInfo *AttrName,
SourceLocation AttrNameLoc,
diff --git a/clang/lib/AST/CommentSema.cpp b/clang/lib/AST/CommentSema.cpp
index a4250c0b7cbb42..66660512d6af5c 100644
--- a/clang/lib/AST/CommentSema.cpp
+++ b/clang/lib/AST/CommentSema.cpp
@@ -664,12 +664,12 @@ void Sema::checkDeprecatedCommand(const BlockCommandComment *Command) {
return;
const LangOptions &LO = FD->getLangOpts();
- const bool DoubleSquareBracket = LO.CPlusPlus14 || LO.C2x;
+ const bool DoubleSquareBracket = LO.CPlusPlus14 || LO.C23;
StringRef AttributeSpelling =
DoubleSquareBracket ? "[[deprecated]]" : "__attribute__((deprecated))";
if (PP) {
// Try to find a replacement macro:
- // - In C2x/C++14 we prefer [[deprecated]].
+ // - In C23/C++14 we prefer [[deprecated]].
// - If not found or an older C/C++ look for __attribute__((deprecated)).
StringRef MacroName;
if (DoubleSquareBracket) {
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 6164a419d213fd..4f3837371b3fc5 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -3982,7 +3982,7 @@ Expr::isNullPointerConstant(ASTContext &Ctx,
if (getType().isNull())
return NPCK_NotNull;
- // C++11/C2x nullptr_t is always a null pointer constant.
+ // C++11/C23 nullptr_t is always a null pointer constant.
if (getType()->isNullPtrType())
return NPCK_CXX11_nullptr;
diff --git a/clang/lib/Basic/Attributes.cpp b/clang/lib/Basic/Attributes.cpp
index 6c0cc87430eede..1308e2d72f25f5 100644
--- a/clang/lib/Basic/Attributes.cpp
+++ b/clang/lib/Basic/Attributes.cpp
@@ -68,7 +68,7 @@ normalizeAttrScopeName(const IdentifierInfo *Scope,
// to be "clang".
StringRef ScopeName = Scope->getName();
if (SyntaxUsed == AttributeCommonInfo::AS_CXX11 ||
- SyntaxUsed == AttributeCommonInfo::AS_C2x) {
+ SyntaxUsed == AttributeCommonInfo::AS_C23) {
if (ScopeName == "__gnu__")
ScopeName = "gnu";
else if (ScopeName == "_Clang")
@@ -85,7 +85,7 @@ static StringRef normalizeAttrName(const IdentifierInfo *Name,
bool ShouldNormalize =
SyntaxUsed == AttributeCommonInfo::AS_GNU ||
((SyntaxUsed == AttributeCommonInfo::AS_CXX11 ||
- SyntaxUsed == AttributeCommonInfo::AS_C2x) &&
+ SyntaxUsed == AttributeCommonInfo::AS_C23) &&
(NormalizedScopeName.empty() || NormalizedScopeName == "gnu" ||
NormalizedScopeName == "clang"));
StringRef AttrName = Name->getName();
@@ -115,7 +115,7 @@ static SmallString<64> normalizeName(const IdentifierInfo *Name,
SmallString<64> FullName = ScopeName;
if (!ScopeName.empty()) {
assert(SyntaxUsed == AttributeCommonInfo::AS_CXX11 ||
- SyntaxUsed == AttributeCommonInfo::AS_C2x);
+ SyntaxUsed == AttributeCommonInfo::AS_C23);
FullName += "::";
}
FullName += AttrName;
diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp
index 0065a6173c2003..57767fd2a1f152 100644
--- a/clang/lib/Basic/IdentifierTable.cpp
+++ b/clang/lib/Basic/IdentifierTable.cpp
@@ -94,7 +94,7 @@ namespace {
KEYNOCXX = 0x80,
KEYBORLAND = 0x100,
KEYOPENCLC = 0x200,
- KEYC2X = 0x400,
+ KEYC23 = 0x400,
KEYNOMS18 = 0x800,
KEYNOOPENCL = 0x1000,
WCHARSUPPORT = 0x2000,
@@ -145,8 +145,8 @@ static KeywordStatus getKeywordStatusHelper(const LangOptions &LangOpts,
if (LangOpts.C99)
return KS_Enabled;
return !LangOpts.CPlusPlus ? KS_Future : KS_Unknown;
- case KEYC2X:
- if (LangOpts.C2x)
+ case KEYC23:
+ if (LangOpts.C23)
return KS_Enabled;
return !LangOpts.CPlusPlus ? KS_Future : KS_Unknown;
case KEYCXX:
@@ -914,7 +914,7 @@ IdentifierTable::getFutureCompatDiagKind(const IdentifierInfo &II,
} else {
if ((Flags & KEYC99) == KEYC99)
return diag::warn_c99_keyword;
- if ((Flags & KEYC2X) == KEYC2X)
+ if ((Flags & KEYC23) == KEYC23)
return diag::warn_c2x_keyword;
}
diff --git a/clang/lib/Basic/LangOptions.cpp b/clang/lib/Basic/LangOptions.cpp
index b44c71f572bee6..a0adfbf61840e3 100644
--- a/clang/lib/Basic/LangOptions.cpp
+++ b/clang/lib/Basic/LangOptions.cpp
@@ -111,7 +111,7 @@ void LangOptions::setLangDefaults(LangOptions &Opts, Language Lang,
Opts.C99 = Std.isC99();
Opts.C11 = Std.isC11();
Opts.C17 = Std.isC17();
- Opts.C2x = Std.isC2x();
+ Opts.C23 = Std.isC23();
Opts.CPlusPlus = Std.isCPlusPlus();
Opts.CPlusPlus11 = Std.isCPlusPlus11();
Opts.CPlusPlus14 = Std.isCPlusPlus14();
@@ -201,8 +201,8 @@ void LangOptions::setLangDefaults(LangOptions &Opts, Language Lang,
Opts.RenderScript = Lang == Language::RenderScript;
- // OpenCL, C++ and C2x have bool, true, false keywords.
- Opts.Bool = Opts.OpenCL || Opts.CPlusPlus || Opts.C2x;
+ // OpenCL, C++ and C23 have bool, true, false keywords.
+ Opts.Bool = Opts.OpenCL || Opts.CPlusPlus || Opts.C23;
// OpenCL and HLSL have half keyword
Opts.Half = Opts.OpenCL || Opts.HLSL;
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 0f5077712dd04a..e5db8a654e6707 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -438,7 +438,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
// value is, are implementation-defined.
// (Removed in C++20.)
if (!LangOpts.CPlusPlus) {
- if (LangOpts.C2x)
+ if (LangOpts.C23)
Builder.defineMacro("__STDC_VERSION__", "202311L");
else if (LangOpts.C17)
Builder.defineMacro("__STDC_VERSION__", "201710L");
diff --git a/clang/lib/Headers/limits.h b/clang/lib/Headers/limits.h
index eaebd494571fbb..15e6bbe0abcf7d 100644
--- a/clang/lib/Headers/limits.h
+++ b/clang/lib/Headers/limits.h
@@ -66,7 +66,7 @@
#define CHAR_BIT __CHAR_BIT__
-/* C2x 5.2.4.2.1 */
+/* C23 5.2.4.2.1 */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
#define BOOL_WIDTH __BOOL_WIDTH__
#define CHAR_WIDTH CHAR_BIT
diff --git a/clang/lib/Headers/stdint.h b/clang/lib/Headers/stdint.h
index 93af9a9c2c2c52..b6699b6ca3d4bb 100644
--- a/clang/lib/Headers/stdint.h
+++ b/clang/lib/Headers/stdint.h
@@ -884,7 +884,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
#define PTRDIFF_MAX __PTRDIFF_MAX__
#define SIZE_MAX __SIZE_MAX__
-/* C2x 7.20.2.4 Width of integer types capable of holding object pointers. */
+/* C23 7.22.2.4 Width of integer types capable of holding object pointers. */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
/* NB: The C standard requires that these be the same value, but the compiler
exposes separate internal width macros. */
@@ -903,7 +903,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
#define INTMAX_MAX __INTMAX_MAX__
#define UINTMAX_MAX __UINTMAX_MAX__
-/* C2x 7.20.2.5 Width of greatest-width integer types. */
+/* C23 7.22.2.5 Width of greatest-width integer types. */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
/* NB: The C standard requires that these be the same value, but the compiler
exposes separate internal width macros. */
@@ -937,7 +937,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
#define INTMAX_C(v) __int_c(v, __INTMAX_C_SUFFIX__)
#define UINTMAX_C(v) __int_c(v, __UINTMAX_C_SUFFIX__)
-/* C2x 7.20.3.x Width of other integer types. */
+/* C23 7.22.3.x Width of other integer types. */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
#define PTRDIFF_WIDTH __PTRDIFF_WIDTH__
#define SIG_ATOMIC_WIDTH __SIG_ATOMIC_WIDTH__
diff --git a/clang/lib/Headers/stdnoreturn.h b/clang/lib/Headers/stdnoreturn.h
index 967be947627a02..c90bf77e840e16 100644
--- a/clang/lib/Headers/stdnoreturn.h
+++ b/clang/lib/Headers/stdnoreturn.h
@@ -15,8 +15,8 @@
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ > 201710L) && \
!defined(_CLANG_DISABLE_CRT_DEPRECATION_WARNINGS)
-/* The noreturn macro is deprecated in C2x. We do not mark it as such because
- including the header file in C2x is also deprecated and we do not want to
+/* The noreturn macro is deprecated in C23. We do not mark it as such because
+ including the header file in C23 is also deprecated and we do not want to
issue a confusing diagnostic for code which includes <stdnoreturn.h>
followed by code that writes [[noreturn]]. The issue with such code is not
with the attribute, or the use of 'noreturn', but the inclusion of the
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index 3637f842046223..15b78ca7eb0879 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/lib/Lex/Lexer.cpp
@@ -1492,7 +1492,7 @@ static bool isAllowedIDChar(uint32_t C, const LangOptions &LangOpts,
return false;
} else if (LangOpts.DollarIdents && '$' == C) {
return true;
- } else if (LangOpts.CPlusPlus || LangOpts.C2x) {
+ } else if (LangOpts.CPlusPlus || LangOpts.C23) {
// A non-leading codepoint must have the XID_Continue property.
// XIDContinueRanges doesn't contains characters also in XIDStartRanges,
// so we need to check both tables.
@@ -1521,7 +1521,7 @@ static bool isAllowedInitiallyIDChar(uint32_t C, const LangOptions &LangOpts,
if (LangOpts.AsmPreprocessor) {
return false;
}
- if (LangOpts.CPlusPlus || LangOpts.C2x) {
+ if (LangOpts.CPlusPlus || LangOpts.C23) {
static const llvm::sys::UnicodeCharSet XIDStartChars(XIDStartRanges);
if (XIDStartChars.contains(C))
return true;
@@ -1952,7 +1952,7 @@ bool Lexer::LexNumericConstant(Token &Result, const char *CurPtr) {
}
// If we have a digit separator, continue.
- if (C == '\'' && (LangOpts.CPlusPlus14 || LangOpts.C2x)) {
+ if (C == '\'' && (LangOpts.CPlusPlus14 || LangOpts.C23)) {
unsigned NextSize;
char Next = getCharAndSizeNoWarn(CurPtr + Size, NextSize, LangOpts);
if (isAsciiIdentifierContinue(Next)) {
@@ -3484,7 +3484,7 @@ uint32_t Lexer::tryReadUCN(const char *&StartPtr, const char *SlashLoc,
if (LangOpts.AsmPreprocessor)
return CodePoint;
- // C2x 6.4.3p2: A universal character name shall not designate a code point
+ // C23 6.4.3p2: A universal character name shall not designate a code point
// where the hexadecimal value is:
// - in the range D800 through DFFF inclusive; or
// - greater than 10FFFF.
@@ -3730,7 +3730,7 @@ bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
return LexNumericConstant(Result, CurPtr);
// Identifier (e.g., uber), or
- // UTF-8 (C2x/C++17) or UTF-16 (C11/C++11) character literal, or
+ // UTF-8 (C23/C++17) or UTF-16 (C11/C++11) character literal, or
// UTF-8 or UTF-16 string literal (C11/C++11).
case 'u':
// Notify MIOpt that we read a non-whitespace/non-comment token.
@@ -3766,7 +3766,7 @@ bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
SizeTmp2, Result),
tok::utf8_string_literal);
- if (Char2 == '\'' && (LangOpts.CPlusPlus17 || LangOpts.C2x))
+ if (Char2 == '\'' && (LangOpts.CPlusPlus17 || LangOpts.C23))
return LexCharConstant(
Result, ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result),
SizeTmp2, Result),
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp
index 888ea772ee6011..22a417b9aa1fe1 100644
--- a/clang/lib/Lex/LiteralSupport.cpp
+++ b/clang/lib/Lex/LiteralSupport.cpp
@@ -675,13 +675,13 @@ static bool ProcessUCNEscape(const char *ThisTokBegin, const char *&ThisTokBuf,
return false;
}
- // C2x and C++11 allow UCNs that refer to control characters
+ // C23 and C++11 allow UCNs that refer to control characters
// and basic source characters inside character and string literals
if (UcnVal < 0xa0 &&
// $, @, ` are allowed in all language modes
(UcnVal != 0x24 && UcnVal != 0x40 && UcnVal != 0x60)) {
bool IsError =
- (!(Features.CPlusPlus11 || Features.C2x) || !in_char_string_literal);
+ (!(Features.CPlusPlus11 || Features.C23) || !in_char_string_literal);
if (Diags) {
char BasicSCSChar = UcnVal;
if (UcnVal >= 0x20 && UcnVal < 0x7f)
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index f133a50dd2ab65..a130ff15d2fed4 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -449,7 +449,7 @@ void Preprocessor::SuggestTypoedDirective(const Token &Tok,
std::vector<StringRef> Candidates = {
"if", "ifdef", "ifndef", "elif", "else", "endif"
};
- if (LangOpts.C2x || LangOpts.CPlusPlus23)
+ if (LangOpts.C23 || LangOpts.CPlusPlus23)
Candidates.insert(Candidates.end(), {"elifdef", "elifndef"});
if (std::optional<StringRef> Sugg = findSimilarStr(Directive, Candidates)) {
@@ -760,14 +760,14 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation HashTokenLoc,
if (!CondInfo.WasSkipping)
SkippingRangeState.endLexPass(Hashptr);
- // Warn if using `#elifdef` & `#elifndef` in not C2x & C++23 mode even
+ // Warn if using `#elifdef` & `#elifndef` in not C23 & C++23 mode even
// if this branch is in a skipping block.
unsigned DiagID;
if (LangOpts.CPlusPlus)
DiagID = LangOpts.CPlusPlus23 ? diag::warn_cxx23_compat_pp_directive
: diag::ext_cxx23_pp_directive;
else
- DiagID = LangOpts.C2x ? diag::warn_c2x_compat_pp_directive
+ DiagID = LangOpts.C23 ? diag::warn_c2x_compat_pp_directive
: diag::ext_c2x_pp_directive;
Diag(Tok, DiagID) << (IsElifDef ? PED_Elifdef : PED_Elifndef);
@@ -1277,9 +1277,9 @@ void Preprocessor::HandleDirective(Token &Result) {
: diag::ext_pp_warning_directive)
<< /*C++23*/ 1;
else
- Diag(Result, LangOpts.C2x ? diag::warn_c2x_compat_warning_directive
+ Diag(Result, LangOpts.C23 ? diag::warn_c2x_compat_warning_directive
: diag::ext_pp_warning_directive)
- << /*C2x*/ 0;
+ << /*C23*/ 0;
return HandleUserDiagnosticDirective(Result, true);
case tok::pp_ident:
@@ -3444,7 +3444,7 @@ void Preprocessor::HandleElifFamilyDirective(Token &ElifToken,
: PED_Elifndef;
++NumElse;
- // Warn if using `#elifdef` & `#elifndef` in not C2x & C++23 mode.
+ // Warn if using `#elifdef` & `#elifndef` in not C23 & C++23 mode.
switch (DirKind) {
case PED_Elifdef:
case PED_Elifndef:
@@ -3453,7 +3453,7 @@ void Preprocessor::HandleElifFamilyDirective(Token &ElifToken,
DiagID = LangOpts.CPlusPlus23 ? diag::warn_cxx23_compat_pp_directive
: diag::ext_cxx23_pp_directive;
else
- DiagID = LangOpts.C2x ? diag::warn_c2x_compat_pp_directive
+ DiagID = LangOpts.C23 ? diag::warn_c2x_compat_pp_directive
: diag::ext_c2x_pp_directive;
Diag(ElifToken, DiagID) << DirKind;
break;
diff --git a/clang/lib/Lex/PPExpressions.cpp b/clang/lib/Lex/PPExpressions.cpp
index 7c41dd510d2dba..7468313c7b9778 100644
--- a/clang/lib/Lex/PPExpressions.cpp
+++ b/clang/lib/Lex/PPExpressions.cpp
@@ -331,11 +331,11 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT,
: 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
+ // 'wb/uwb' literals are a C23 feature. We explicitly do not support the
// suffix in C++ as an extension because a library-based UDL that resolves
// to a library type may be more appropriate there.
if (Literal.isBitInt)
- PP.Diag(PeekTok, PP.getLangOpts().C2x
+ PP.Diag(PeekTok, PP.getLangOpts().C23
? diag::warn_c2x_compat_bitint_suffix
: diag::ext_c2x_bitint_suffix);
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 71d38e59707aa1..775cbfafa99960 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -1781,7 +1781,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
AttributeCommonInfo::Syntax Syntax =
IsCXX ? AttributeCommonInfo::Syntax::AS_CXX11
- : AttributeCommonInfo::Syntax::AS_C2x;
+ : AttributeCommonInfo::Syntax::AS_C23;
return II ? hasAttribute(Syntax, ScopeII, II, getTargetInfo(),
getLangOpts())
: 0;
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 0ca504a28ea168..48a7f7db758b78 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -1761,7 +1761,7 @@ void Parser::ProhibitCXX11Attributes(ParsedAttributes &Attrs,
AL.setInvalid();
continue;
}
- if (!AL.isCXX11Attribute() && !AL.isC2xAttribute())
+ if (!AL.isStandardAttributeSyntax())
continue;
if (AL.getKind() == ParsedAttr::UnknownAttribute) {
if (WarnOnUnknownAttrs)
@@ -1776,8 +1776,7 @@ void Parser::ProhibitCXX11Attributes(ParsedAttributes &Attrs,
void Parser::DiagnoseCXX11AttributeExtension(ParsedAttributes &Attrs) {
for (const ParsedAttr &PA : Attrs) {
- if (PA.isCXX11Attribute() || PA.isC2xAttribute() ||
- PA.isRegularKeywordAttribute())
+ if (PA.isStandardAttributeSyntax() || PA.isRegularKeywordAttribute())
Diag(PA.getLoc(), diag::ext_cxx11_attr_placement)
<< PA << PA.isRegularKeywordAttribute() << PA.getRange();
}
@@ -3330,9 +3329,9 @@ void Parser::ParseDeclarationSpecifiers(
if (!AttrsLastTime)
ProhibitAttributes(attrs);
else {
- // Reject C++11 / C2x attributes that aren't type attributes.
+ // Reject C++11 / C23 attributes that aren't type attributes.
for (const ParsedAttr &PA : attrs) {
- if (!PA.isCXX11Attribute() && !PA.isC2xAttribute() &&
+ if (!PA.isCXX11Attribute() && !PA.isC23Attribute() &&
!PA.isRegularKeywordAttribute())
continue;
if (PA.getKind() == ParsedAttr::UnknownAttribute)
@@ -3348,7 +3347,7 @@ void Parser::ParseDeclarationSpecifiers(
}
// We reject AT_LifetimeBound and AT_AnyX86NoCfCheck, even though they
// are type attributes, because we historically haven't allowed these
- // to be used as type attributes in C++11 / C2x syntax.
+ // to be used as type attributes in C++11 / C23 syntax.
if (PA.isTypeAttr() && PA.getKind() != ParsedAttr::AT_LifetimeBound &&
PA.getKind() != ParsedAttr::AT_AnyX86NoCfCheck)
continue;
@@ -4000,7 +3999,7 @@ void Parser::ParseDeclarationSpecifiers(
isStorageClass = true;
break;
case tok::kw_thread_local:
- if (getLangOpts().C2x)
+ if (getLangOpts().C23)
Diag(Tok, diag::warn_c2x_compat_keyword) << Tok.getName();
isInvalid = DS.SetStorageClassSpecThread(DeclSpec::TSCS_thread_local, Loc,
PrevSpec, DiagID);
@@ -4237,7 +4236,7 @@ void Parser::ParseDeclarationSpecifiers(
DiagID, Policy);
break;
case tok::kw_bool:
- if (getLangOpts().C2x)
+ if (getLangOpts().C23)
Diag(Tok, diag::warn_c2x_compat_keyword) << Tok.getName();
[[fallthrough]];
case tok::kw__Bool:
@@ -4361,7 +4360,7 @@ void Parser::ParseDeclarationSpecifiers(
continue;
break;
- // C2x/GNU typeof support.
+ // C23/GNU typeof support.
case tok::kw_typeof:
case tok::kw_typeof_unqual:
ParseTypeofSpecifier(DS);
@@ -4508,7 +4507,7 @@ void Parser::ParseDeclarationSpecifiers(
/// not to the declaration of a struct.
///
/// struct-declaration:
-/// [C2x] attributes-specifier-seq[opt]
+/// [C23] attributes-specifier-seq[opt]
/// specifier-qualifier-list struct-declarator-list
/// [GNU] __extension__ struct-declaration
/// [GNU] specifier-qualifier-list
@@ -4543,7 +4542,7 @@ void Parser::ParseStructDeclaration(
// If there are no declarators, this is a free-standing declaration
// specifier. Let the actions module cope with it.
if (Tok.is(tok::semi)) {
- // C2x 6.7.2.1p9 : "The optional attribute specifier sequence in a
+ // C23 6.7.2.1p9 : "The optional attribute specifier sequence in a
// member declaration appertains to each of the members declared by the
// member declarator list; it shall not appear if the optional member
// declarator list is omitted."
@@ -5381,7 +5380,7 @@ bool Parser::isTypeSpecifierQualifier() {
// GNU attributes support.
case tok::kw___attribute:
- // C2x/GNU typeof support.
+ // C23/GNU typeof support.
case tok::kw_typeof:
case tok::kw_typeof_unqual:
@@ -5657,7 +5656,7 @@ bool Parser::isDeclarationSpecifier(
case tok::kw_static_assert:
case tok::kw__Static_assert:
- // C2x/GNU typeof support.
+ // C23/GNU typeof support.
case tok::kw_typeof:
case tok::kw_typeof_unqual:
@@ -7019,7 +7018,7 @@ void Parser::ParseFunctionDeclarator(Declarator &D,
Diag(Tok, diag::err_argument_required_after_attribute);
// OpenCL disallows functions without a prototype, but it doesn't enforce
- // strict prototypes as in C2x because it allows a function definition to
+ // strict prototypes as in C23 because it allows a function definition to
// have an identifier list. See OpenCL 3.0 6.11/g for more details.
HasProto = ParamInfo.size() || getLangOpts().requiresStrictPrototypes() ||
getLangOpts().OpenCL;
@@ -7202,9 +7201,9 @@ bool Parser::isFunctionDeclaratorIdentifierList() {
void Parser::ParseFunctionDeclaratorIdentifierList(
Declarator &D,
SmallVectorImpl<DeclaratorChunk::ParamInfo> &ParamInfo) {
- // We should never reach this point in C2x or C++.
+ // We should never reach this point in C23 or C++.
assert(!getLangOpts().requiresStrictPrototypes() &&
- "Cannot parse an identifier list in C2x or C++");
+ "Cannot parse an identifier list in C23 or C++");
// If there was no identifier specified for the declarator, either we are in
// an abstract-declarator, or we are in a parameter declarator which was found
@@ -7738,7 +7737,7 @@ void Parser::ParseMisplacedBracketDeclarator(Declarator &D) {
/// typeof ( expressions )
/// typeof ( type-name )
/// [GNU/C++] typeof unary-expression
-/// [C2x] typeof-specifier:
+/// [C23] typeof-specifier:
/// typeof '(' typeof-specifier-argument ')'
/// typeof_unqual '(' typeof-specifier-argument ')'
///
@@ -7752,7 +7751,7 @@ void Parser::ParseTypeofSpecifier(DeclSpec &DS) {
bool IsUnqual = Tok.is(tok::kw_typeof_unqual);
const IdentifierInfo *II = Tok.getIdentifierInfo();
- if (getLangOpts().C2x && !II->getName().startswith("__"))
+ if (getLangOpts().C23 && !II->getName().startswith("__"))
Diag(Tok.getLocation(), diag::warn_c2x_compat_keyword) << Tok.getName();
Token OpTok = Tok;
@@ -7950,9 +7949,9 @@ void Parser::DiagnoseBitIntUse(const Token &Tok) {
Diag(Loc, diag::warn_ext_int_deprecated)
<< FixItHint::CreateReplacement(Loc, "_BitInt");
} else {
- // In C2x mode, diagnose that the use is not compatible with pre-C2x modes.
+ // In C23 mode, diagnose that the use is not compatible with pre-C23 modes.
// Otherwise, diagnose that the use is a Clang extension.
- if (getLangOpts().C2x)
+ if (getLangOpts().C23)
Diag(Loc, diag::warn_c2x_compat_keyword) << Tok.getName();
else
Diag(Loc, diag::ext_bit_int) << getLangOpts().CPlusPlus;
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index 39873bf8bd6b7b..7db7a416ea433f 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -972,7 +972,7 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd) {
Diag(Tok, diag::ext_c11_feature) << Tok.getName();
if (Tok.is(tok::kw_static_assert)) {
if (!getLangOpts().CPlusPlus) {
- if (getLangOpts().C2x)
+ if (getLangOpts().C23)
Diag(Tok, diag::warn_c2x_compat_keyword) << Tok.getName();
else
Diag(Tok, diag::ext_ms_static_assert) << FixItHint::CreateReplacement(
@@ -1005,7 +1005,7 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd) {
DiagVal = diag::warn_cxx14_compat_static_assert_no_message;
else if (getLangOpts().CPlusPlus)
DiagVal = diag::ext_cxx_static_assert_no_message;
- else if (getLangOpts().C2x)
+ else if (getLangOpts().C23)
DiagVal = diag::warn_c17_compat_static_assert_no_message;
else
DiagVal = diag::ext_c_static_assert_no_message;
@@ -4241,7 +4241,7 @@ Parser::TryParseCXX11AttributeIdentifier(SourceLocation &Loc,
case tok::code_completion:
cutOffParsing();
Actions.CodeCompleteAttribute(getLangOpts().CPlusPlus ? ParsedAttr::AS_CXX11
- : ParsedAttr::AS_C2x,
+ : ParsedAttr::AS_C23,
Completion, Scope);
return nullptr;
@@ -4399,7 +4399,7 @@ bool Parser::ParseCXX11AttributeArgs(
SourceLocation LParenLoc = Tok.getLocation();
const LangOptions &LO = getLangOpts();
ParsedAttr::Form Form =
- LO.CPlusPlus ? ParsedAttr::Form::CXX11() : ParsedAttr::Form::C2x();
+ LO.CPlusPlus ? ParsedAttr::Form::CXX11() : ParsedAttr::Form::C23();
// Try parsing microsoft attributes
if (getLangOpts().MicrosoftExt || getLangOpts().HLSL) {
@@ -4412,7 +4412,7 @@ bool Parser::ParseCXX11AttributeArgs(
// arguments.
if (Form.getSyntax() != ParsedAttr::AS_Microsoft &&
!hasAttribute(LO.CPlusPlus ? AttributeCommonInfo::Syntax::AS_CXX11
- : AttributeCommonInfo::Syntax::AS_C2x,
+ : AttributeCommonInfo::Syntax::AS_C23,
ScopeName, AttrName, getTargetInfo(), getLangOpts())) {
if (getLangOpts().MicrosoftExt || getLangOpts().HLSL) {
}
@@ -4476,7 +4476,7 @@ bool Parser::ParseCXX11AttributeArgs(
return true;
}
-/// Parse a C++11 or C2x attribute-specifier.
+/// Parse a C++11 or C23 attribute-specifier.
///
/// [C++11] attribute-specifier:
/// '[' '[' attribute-list ']' ']'
@@ -4504,7 +4504,7 @@ void Parser::ParseCXX11AttributeSpecifierInternal(ParsedAttributes &Attrs,
CachedTokens &OpenMPTokens,
SourceLocation *EndLoc) {
if (Tok.is(tok::kw_alignas)) {
- if (getLangOpts().C2x)
+ if (getLangOpts().C23)
Diag(Tok, diag::warn_c2x_compat_keyword) << Tok.getName();
else
Diag(Tok.getLocation(), diag::warn_cxx98_compat_alignas);
@@ -4528,7 +4528,7 @@ void Parser::ParseCXX11AttributeSpecifierInternal(ParsedAttributes &Attrs,
Diag(OpenLoc, getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_attribute
: diag::warn_ext_cxx11_attributes);
} else {
- Diag(OpenLoc, getLangOpts().C2x ? diag::warn_pre_c2x_compat_attributes
+ Diag(OpenLoc, getLangOpts().C23 ? diag::warn_pre_c2x_compat_attributes
: diag::warn_ext_c2x_attributes);
}
@@ -4614,7 +4614,7 @@ void Parser::ParseCXX11AttributeSpecifierInternal(ParsedAttributes &Attrs,
SourceRange(ScopeLoc.isValid() ? ScopeLoc : AttrLoc, AttrLoc),
ScopeName, ScopeLoc, nullptr, 0,
getLangOpts().CPlusPlus ? ParsedAttr::Form::CXX11()
- : ParsedAttr::Form::C2x());
+ : ParsedAttr::Form::C23());
AttrParsed = true;
}
@@ -4640,7 +4640,7 @@ void Parser::ParseCXX11AttributeSpecifierInternal(ParsedAttributes &Attrs,
SkipUntil(tok::r_square);
}
-/// ParseCXX11Attributes - Parse a C++11 or C2x attribute-specifier-seq.
+/// ParseCXX11Attributes - Parse a C++11 or C23 attribute-specifier-seq.
///
/// attribute-specifier-seq:
/// attribute-specifier-seq[opt] attribute-specifier
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 1e6f9c8810444d..a62144060d1255 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -1011,7 +1011,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
if (getLangOpts().CPlusPlus)
Diag(Tok, diag::warn_cxx98_compat_nullptr);
else
- Diag(Tok, getLangOpts().C2x ? diag::warn_c2x_compat_keyword
+ Diag(Tok, getLangOpts().C23 ? diag::warn_c2x_compat_keyword
: diag::ext_c_nullptr) << Tok.getName();
Res = Actions.ActOnCXXNullPtrLiteral(ConsumeToken());
@@ -2304,7 +2304,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
/// typeof ( expressions )
/// typeof ( type-name )
/// [GNU/C++] typeof unary-expression
-/// [C2x] typeof-specifier:
+/// [C23] typeof-specifier:
/// typeof '(' typeof-specifier-argument ')'
/// typeof_unqual '(' typeof-specifier-argument ')'
///
@@ -2501,7 +2501,7 @@ ExprResult Parser::ParseUnaryExprOrTypeTraitExpression() {
if (getLangOpts().CPlusPlus &&
OpTok.isOneOf(tok::kw_alignof, tok::kw__Alignof))
Diag(OpTok, diag::warn_cxx98_compat_alignof);
- else if (getLangOpts().C2x && OpTok.is(tok::kw_alignof))
+ else if (getLangOpts().C23 && OpTok.is(tok::kw_alignof))
Diag(OpTok, diag::warn_c2x_compat_keyword) << OpTok.getName();
EnterExpressionEvaluationContext Unevaluated(
diff --git a/clang/lib/Parse/ParseInit.cpp b/clang/lib/Parse/ParseInit.cpp
index f52c04ba2c4d7c..6794cb6a4f05fb 100644
--- a/clang/lib/Parse/ParseInit.cpp
+++ b/clang/lib/Parse/ParseInit.cpp
@@ -431,7 +431,7 @@ ExprResult Parser::ParseInitializerWithPotentialDesignator(
/// initializer: [C99 6.7.8]
/// '{' initializer-list '}'
/// '{' initializer-list ',' '}'
-/// [C2x] '{' '}'
+/// [C23] '{' '}'
///
/// initializer-list:
/// designation[opt] initializer ...[opt]
@@ -449,9 +449,9 @@ ExprResult Parser::ParseBraceInitializer() {
ExprVector InitExprs;
if (Tok.is(tok::r_brace)) {
- // Empty initializers are a C++ feature and a GNU extension to C before C2x.
+ // Empty initializers are a C++ feature and a GNU extension to C before C23.
if (!getLangOpts().CPlusPlus) {
- Diag(LBraceLoc, getLangOpts().C2x
+ Diag(LBraceLoc, getLangOpts().C23
? diag::warn_c2x_compat_empty_initializer
: diag::ext_c_empty_initializer);
}
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index bf295b8a0cb8a2..e6f8260dcd9fdf 100644
--- a/clang/lib/Parse/ParseStmt.cpp
+++ b/clang/lib/Parse/ParseStmt.cpp
@@ -1075,7 +1075,7 @@ void Parser::DiagnoseLabelAtEndOfCompoundStatement() {
? diag::warn_cxx20_compat_label_end_of_compound_statement
: diag::ext_cxx_label_end_of_compound_statement);
} else {
- Diag(Tok, getLangOpts().C2x
+ Diag(Tok, getLangOpts().C23
? diag::warn_c2x_compat_label_end_of_compound_statement
: diag::ext_c_label_end_of_compound_statement);
}
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index e1429cc31a7236..9a8c9e3497de9d 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -2111,7 +2111,7 @@ bool Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(
}
if (!getLangOpts().CPlusPlus) {
- // If we're in C, the only place we can have :: tokens is C2x
+ // If we're in C, the only place we can have :: tokens is C23
// attribute which is parsed elsewhere. If the identifier is not a type,
// then it can't be scope either, just early exit.
return false;
diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp
index a2eb7707a19ba0..d047df257b1042 100644
--- a/clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -1247,7 +1247,7 @@ static StringRef getFallthroughAttrSpelling(Preprocessor &PP,
tok::r_square, tok::r_square
};
- bool PreferClangAttr = !PP.getLangOpts().CPlusPlus17 && !PP.getLangOpts().C2x;
+ bool PreferClangAttr = !PP.getLangOpts().CPlusPlus17 && !PP.getLangOpts().C23;
StringRef MacroName;
if (PreferClangAttr)
diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp
index b338d601db7397..d4648b2d16eaac 100644
--- a/clang/lib/Sema/SemaCast.cpp
+++ b/clang/lib/Sema/SemaCast.cpp
@@ -66,7 +66,7 @@ namespace {
// If a pr-value initially has the type cv-T, where T is a
// cv-unqualified non-class, non-array type, the type of the
// expression is adjusted to T prior to any further analysis.
- // C2x 6.5.4p6:
+ // C23 6.5.4p6:
// Preceding an expression by a parenthesized type name converts the
// value of the expression to the unqualified, non-atomic version of
// the named type.
@@ -3061,7 +3061,7 @@ void CastOperation::CheckCStyleCast() {
return;
}
- // C2x 6.5.4p4:
+ // C23 6.5.4p4:
// The type nullptr_t shall not be converted to any type other than void,
// bool, or a pointer type. No type other than nullptr_t shall be converted
// to nullptr_t.
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 281f1883d269c2..a73d8770779860 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -8206,9 +8206,9 @@ bool Sema::SemaBuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall) {
if (checkVAStartABI(*this, BuiltinID, Fn))
return true;
- // In C2x mode, va_start only needs one argument. However, the builtin still
+ // In C23 mode, va_start only needs one argument. However, the builtin still
// requires two arguments (which matches the behavior of the GCC builtin),
- // <stdarg.h> passes `0` as the second argument in C2x mode.
+ // <stdarg.h> passes `0` as the second argument in C23 mode.
if (checkArgCount(*this, TheCall, 2))
return true;
@@ -8222,14 +8222,14 @@ bool Sema::SemaBuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall) {
return true;
// Verify that the second argument to the builtin is the last argument of the
- // current function or method. In C2x mode, if the second argument is an
+ // current function or method. In C23 mode, if the second argument is an
// integer constant expression with value 0, then we don't bother with this
// check.
bool SecondArgIsLastNamedArgument = false;
const Expr *Arg = TheCall->getArg(1)->IgnoreParenCasts();
if (std::optional<llvm::APSInt> Val =
TheCall->getArg(1)->getIntegerConstantExpr(Context);
- Val && LangOpts.C2x && *Val == 0)
+ Val && LangOpts.C23 && *Val == 0)
return false;
// These are valid if SecondArgIsLastNamedArgument is false after the next
@@ -16746,7 +16746,7 @@ bool Sema::CheckParmsForFunctionDef(ArrayRef<ParmVarDecl *> Parameters,
if (CheckParameterNames && Param->getIdentifier() == nullptr &&
!Param->isImplicit() && !getLangOpts().CPlusPlus) {
// Diagnose this as an extension in C17 and earlier.
- if (!getLangOpts().C2x)
+ if (!getLangOpts().C23)
Diag(Param->getLocation(), diag::ext_parameter_name_omitted_c2x);
}
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 476baad734f70e..b9760e8e74452d 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -2673,7 +2673,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, Scope *S,
Results.AddResult(Result(Builder.TakeString()));
}
- if (SemaRef.getLangOpts().C2x) {
+ if (SemaRef.getLangOpts().C23) {
// nullptr
Builder.AddResultTypeChunk("nullptr_t");
Builder.AddTypedTextChunk("nullptr");
@@ -4533,7 +4533,7 @@ void Sema::CodeCompleteAttribute(AttributeCommonInfo::Syntax Syntax,
}
bool SyntaxSupportsGuards = Syntax == AttributeCommonInfo::AS_GNU ||
Syntax == AttributeCommonInfo::AS_CXX11 ||
- Syntax == AttributeCommonInfo::AS_C2x;
+ Syntax == AttributeCommonInfo::AS_C23;
llvm::DenseSet<llvm::StringRef> FoundScopes;
auto AddCompletions = [&](const ParsedAttrInfo &A) {
@@ -4547,7 +4547,7 @@ void Sema::CodeCompleteAttribute(AttributeCommonInfo::Syntax Syntax,
llvm::StringRef Name = S.NormalizedFullName;
llvm::StringRef Scope;
if ((Syntax == AttributeCommonInfo::AS_CXX11 ||
- Syntax == AttributeCommonInfo::AS_C2x)) {
+ Syntax == AttributeCommonInfo::AS_C23)) {
std::tie(Scope, Name) = Name.split("::");
if (Name.empty()) // oops, unscoped
std::swap(Name, Scope);
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 1d2a14e87323ca..c4bb9b15269f76 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -4155,7 +4155,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, Scope *S,
// If we are merging two functions where only one of them has a prototype,
// we may have enough information to decide to issue a diagnostic that the
- // function without a protoype will change behavior in C2x. This handles
+ // function without a protoype will change behavior in C23. This handles
// cases like:
// void i(); void i(int j);
// void i(int j); void i();
@@ -4176,7 +4176,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, Scope *S,
if (WithProto->getNumParams() != 0) {
if (WithoutProto->getBuiltinID() == 0 && !WithoutProto->isImplicit()) {
- // The one without the prototype will be changing behavior in C2x, so
+ // The one without the prototype will be changing behavior in C23, so
// warn about that one so long as it's a user-visible declaration.
bool IsWithoutProtoADef = false, IsWithProtoADef = false;
if (WithoutProto == New)
@@ -4194,7 +4194,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, Scope *S,
// when the new declaration is a definition without a prototype, the
// old declaration with a prototype is not the cause of the issue,
// and that does not need to be noted because the one with a
- // prototype will not change behavior in C2x.
+ // prototype will not change behavior in C23.
if (WithProto->getBuiltinID() == 0 && !WithProto->isImplicit() &&
!IsWithoutProtoADef)
Diag(WithProto->getLocation(), diag::note_conflicting_prototype);
@@ -15837,7 +15837,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
(void)FindPossiblePrototype(FD, PossiblePrototype);
// If the function being defined does not have a prototype, then we may
- // need to diagnose it as changing behavior in C2x because we now know
+ // need to diagnose it as changing behavior in C23 because we now know
// whether the function accepts arguments or not. This only handles the
// case where the definition has no prototype but does have parameters
// and either there is no previous potential prototype, or the previous
@@ -15852,7 +15852,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
(!PossiblePrototype || (!PossiblePrototype->hasWrittenPrototype() &&
!PossiblePrototype->isImplicit()))) {
// The function definition has parameters, so this will change behavior
- // in C2x. If there is a possible prototype, it comes before the
+ // in C23. If there is a possible prototype, it comes before the
// function definition.
// FIXME: The declaration may have already been diagnosed as being
// deprecated in GetFullTypeForDeclarator() if it had no arguments, but
@@ -15869,14 +15869,14 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
// warn about it being deprecated (because the diagnostic is not
// enabled), warn now that it is deprecated and changes behavior.
- // This K&R C function definition definitely changes behavior in C2x,
+ // This K&R C function definition definitely changes behavior in C23,
// so diagnose it.
Diag(FD->getLocation(), diag::warn_non_prototype_changes_behavior)
- << /*definition*/ 1 << /* not supported in C2x */ 0;
+ << /*definition*/ 1 << /* not supported in C23 */ 0;
// If we have a possible prototype for the function which is a user-
// visible declaration, we already tested that it has no prototype.
- // This will change behavior in C2x. This gets a warning rather than a
+ // This will change behavior in C23. This gets a warning rather than a
// note because it's the same behavior-changing problem as with the
// definition.
if (PossiblePrototype)
@@ -16104,7 +16104,7 @@ void Sema::ActOnFinishDelayedAttribute(Scope *S, Decl *D,
/// call, forming a call to an implicitly defined function (per C99 6.5.1p2).
NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc,
IdentifierInfo &II, Scope *S) {
- // It is not valid to implicitly define a function in C2x.
+ // It is not valid to implicitly define a function in C23.
assert(LangOpts.implicitFunctionsAllowed() &&
"Implicit function declarations aren't allowed in this language mode");
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index d0c293b65b7f74..115db2b9a985e9 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -2197,13 +2197,13 @@ static void handleNoReturnAttr(Sema &S, Decl *D, const ParsedAttr &Attrs) {
}
static void handleStandardNoReturnAttr(Sema &S, Decl *D, const ParsedAttr &A) {
- // The [[_Noreturn]] spelling is deprecated in C2x, so if that was used,
+ // The [[_Noreturn]] spelling is deprecated in C23, so if that was used,
// issue an appropriate diagnostic. However, don't issue a diagnostic if the
// attribute name comes from a macro expansion. We don't want to punish users
// who write [[noreturn]] after including <stdnoreturn.h> (where 'noreturn'
// is defined as a macro which expands to '_Noreturn').
if (!S.getLangOpts().CPlusPlus &&
- A.getSemanticSpelling() == CXX11NoReturnAttr::C2x_Noreturn &&
+ A.getSemanticSpelling() == CXX11NoReturnAttr::C23_Noreturn &&
!(A.getLoc().isMacroID() &&
S.getSourceManager().isInSystemMacro(A.getLoc())))
S.Diag(A.getLoc(), diag::warn_deprecated_noreturn_spelling) << A.getRange();
@@ -3162,18 +3162,18 @@ static void handleWarnUnusedResult(Sema &S, Decl *D, const ParsedAttr &AL) {
// If this is spelled as the standard C++17 attribute, but not in C++17,
// warn about using it as an extension. If there are attribute arguments,
- // then claim it's a C++2a extension instead.
+ // then claim it's a C++20 extension instead.
// FIXME: If WG14 does not seem likely to adopt the same feature, add an
- // extension warning for C2x mode.
+ // extension warning for C23 mode.
const LangOptions &LO = S.getLangOpts();
if (AL.getNumArgs() == 1) {
if (LO.CPlusPlus && !LO.CPlusPlus20)
S.Diag(AL.getLoc(), diag::ext_cxx20_attr) << AL;
// Since this is spelled [[nodiscard]], get the optional string
- // literal. If in C++ mode, but not in C++2a mode, diagnose as an
+ // literal. If in C++ mode, but not in C++20 mode, diagnose as an
// extension.
- // FIXME: C2x should support this feature as well, even as an extension.
+ // FIXME: C23 should support this feature as well, even as an extension.
if (!S.checkStringLiteralArgumentAttr(AL, 0, Str, nullptr))
return;
} else if (LO.CPlusPlus && !LO.CPlusPlus17)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index a39cdecd7686e0..d413b8109c8b04 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -104,7 +104,7 @@ static void DiagnoseUnusedOfDecl(Sema &S, NamedDecl *D, SourceLocation Loc) {
// [[maybe_unused]] should not diagnose uses, but __attribute__((unused))
// should diagnose them.
if (A->getSemanticSpelling() != UnusedAttr::CXX11_maybe_unused &&
- A->getSemanticSpelling() != UnusedAttr::C2x_maybe_unused) {
+ A->getSemanticSpelling() != UnusedAttr::C23_maybe_unused) {
const Decl *DC = cast_or_null<Decl>(S.getCurObjCLexicalContext());
if (DC && !DC->hasAttr<UnusedAttr>())
S.Diag(Loc, diag::warn_used_but_marked_unused) << D;
@@ -3788,8 +3788,8 @@ ExprResult Sema::ActOnCharacterConstant(const Token &Tok, Scope *UDLScope) {
QualType Ty;
if (Literal.isWide())
Ty = Context.WideCharTy; // L'x' -> wchar_t in C and C++.
- else if (Literal.isUTF8() && getLangOpts().C2x)
- Ty = Context.UnsignedCharTy; // u8'x' -> unsigned char in C2x
+ else if (Literal.isUTF8() && getLangOpts().C23)
+ Ty = Context.UnsignedCharTy; // u8'x' -> unsigned char in C23
else if (Literal.isUTF8() && getLangOpts().Char8)
Ty = Context.Char8Ty; // u8'x' -> char8_t when it exists.
else if (Literal.isUTF16())
@@ -4115,12 +4115,12 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
: 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++,
+ // 'wb/uwb' literals are a C23 feature. We support _BitInt as a type in C++,
// but we do not currently support the suffix in C++ mode because it's not
// entirely clear whether WG21 will prefer this suffix to return a library
// type such as std::bit_int instead of returning a _BitInt.
if (Literal.isBitInt && !getLangOpts().CPlusPlus)
- PP.Diag(Tok.getLocation(), getLangOpts().C2x
+ PP.Diag(Tok.getLocation(), getLangOpts().C23
? diag::warn_c2x_compat_bitint_suffix
: diag::ext_c2x_bitint_suffix);
@@ -7712,7 +7712,7 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo,
SourceRange(LParenLoc, LiteralExpr->getSourceRange().getEnd())))
return ExprError();
if (literalType->isVariableArrayType()) {
- // C2x 6.7.9p4: An entity of variable length array type shall not be
+ // C23 6.7.10p4: An entity of variable length array type shall not be
// initialized except by an empty initializer.
//
// The C extension warnings are issued from ParseBraceInitializer() and
@@ -9245,7 +9245,7 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS,
return ResTy;
}
- // C2x 6.5.15p7:
+ // C23 6.5.15p7:
// ... if both the second and third operands have nullptr_t type, the
// result also has that type.
if (LHSTy->isNullPtrType() && Context.hasSameType(LHSTy, RHSTy))
@@ -10375,8 +10375,8 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS,
return Incompatible;
}
- // Conversion to nullptr_t (C2x only)
- if (getLangOpts().C2x && LHSType->isNullPtrType() &&
+ // Conversion to nullptr_t (C23 only)
+ if (getLangOpts().C23 && LHSType->isNullPtrType() &&
RHS.get()->isNullPointerConstant(Context,
Expr::NPC_ValueDependentIsNull)) {
// null -> nullptr_t
@@ -10601,11 +10601,11 @@ Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &CallerRHS,
QualType LHSTypeAfterConversion = LHSType.getAtomicUnqualifiedType();
// C99 6.5.16.1p1: the left operand is a pointer and the right is
- // a null pointer constant <C2x>or its type is nullptr_t;</C2x>.
+ // a null pointer constant <C23>or its type is nullptr_t;</C23>.
if ((LHSTypeAfterConversion->isPointerType() ||
LHSTypeAfterConversion->isObjCObjectPointerType() ||
LHSTypeAfterConversion->isBlockPointerType()) &&
- ((getLangOpts().C2x && RHS.get()->getType()->isNullPtrType()) ||
+ ((getLangOpts().C23 && RHS.get()->getType()->isNullPtrType()) ||
RHS.get()->isNullPointerConstant(Context,
Expr::NPC_ValueDependentIsNull))) {
if (Diagnose || ConvertRHS) {
@@ -10618,10 +10618,10 @@ Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &CallerRHS,
}
return Compatible;
}
- // C2x 6.5.16.1p1: the left operand has type atomic, qualified, or
+ // C23 6.5.16.1p1: the left operand has type atomic, qualified, or
// unqualified bool, and the right operand is a pointer or its type is
// nullptr_t.
- if (getLangOpts().C2x && LHSType->isBooleanType() &&
+ if (getLangOpts().C23 && LHSType->isBooleanType() &&
RHS.get()->getType()->isNullPtrType()) {
// NB: T* -> _Bool is handled in CheckAssignmentConstraints, this only
// only handles nullptr -> _Bool due to needing an extra conversion
@@ -13244,9 +13244,10 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
// Two operands of type std::nullptr_t or one operand of type
// std::nullptr_t and the other a null pointer constant compare
// equal.
- // C2x 6.5.9p5:
+ // C23 6.5.9p5:
// If both operands have type nullptr_t or one operand has type nullptr_t
- // and the other is a null pointer constant, they compare equal.
+ // and the other is a null pointer constant, they compare equal if the
+ // former is a null pointer.
if (!IsOrdered && LHSIsNull && RHSIsNull) {
if (LHSType->isNullPtrType()) {
RHS = ImpCastExprToType(RHS.get(), LHSType, CK_NullToPointer);
@@ -13259,10 +13260,10 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
}
if (!getLangOpts().CPlusPlus && !IsOrdered && (LHSIsNull || RHSIsNull)) {
- // C2x 6.5.9p6:
+ // C23 6.5.9p6:
// Otherwise, at least one operand is a pointer. If one is a pointer and
- // the other is a null pointer constant, the null pointer constant is
- // converted to the type of the pointer.
+ // the other is a null pointer constant or has type nullptr_t, they
+ // compare equal
if (LHSIsNull && RHSType->isPointerType()) {
LHS = ImpCastExprToType(LHS.get(), RHSType, CK_NullToPointer);
return computeResultTy();
@@ -16991,7 +16992,7 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
if (Param->getIdentifier() == nullptr && !Param->isImplicit() &&
!Param->isInvalidDecl() && !getLangOpts().CPlusPlus) {
// Diagnose this as an extension in C17 and earlier.
- if (!getLangOpts().C2x)
+ if (!getLangOpts().C23)
Diag(Param->getLocation(), diag::ext_parameter_name_omitted_c2x);
}
Params.push_back(Param);
@@ -17341,17 +17342,20 @@ ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc,
if (Context.isPromotableIntegerType(TInfo->getType())) {
PromoteType = Context.getPromotedIntegerType(TInfo->getType());
// [cstdarg.syn]p1 defers the C++ behavior to what the C standard says,
- // and C2x 7.16.1.1p2 says, in part:
+ // and C23 7.16.1.1p2 says, in part:
// If type is not compatible with the type of the actual next argument
// (as promoted according to the default argument promotions), the
// behavior is undefined, except for the following cases:
// - both types are pointers to qualified or unqualified versions of
// compatible types;
- // - one type is a signed integer type, the other type is the
- // corresponding unsigned integer type, and the value is
- // representable in both types;
+ // - one type is compatible with a signed integer type, the other
+ // type is compatible with the corresponding unsigned integer type,
+ // and the value is representable in both types;
// - one type is pointer to qualified or unqualified void and the
- // other is a pointer to a qualified or unqualified character type.
+ // other is a pointer to a qualified or unqualified character type;
+ // - or, the type of the next argument is nullptr_t and type is a
+ // pointer type that has the same representation and alignment
+ // requirements as a pointer to a character type.
// Given that type compatibility is the primary requirement (ignoring
// qualifications), you would think we could call typesAreCompatible()
// directly to test this. However, in C++, that checks for *same type*,
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index a847790d981e76..ab68029fb35e96 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -1980,7 +1980,7 @@ void InitListChecker::CheckArrayType(const InitializedEntity &Entity,
// them in all sorts of strange places).
bool HasErr = IList->getNumInits() != 0 || SemaRef.getLangOpts().CPlusPlus;
if (!VerifyOnly) {
- // C2x 6.7.9p4: An entity of variable length array type shall not be
+ // C23 6.7.10p4: An entity of variable length array type shall not be
// initialized except by an empty initializer.
//
// The C extension warnings are issued from ParseBraceInitializer() and
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 2ccad19e066d39..623c2c50770a30 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -5431,7 +5431,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
getCCForDeclaratorChunk(S, D, DeclType.getAttrs(), FTI, chunkIndex));
// OpenCL disallows functions without a prototype, but it doesn't enforce
- // strict prototypes as in C2x because it allows a function definition to
+ // strict prototypes as in C23 because it allows a function definition to
// have an identifier list. See OpenCL 3.0 6.11/g for more details.
if (!FTI.NumParams && !FTI.isVariadic &&
!LangOpts.requiresStrictPrototypes() && !LangOpts.OpenCL) {
@@ -5440,9 +5440,9 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
} else {
// We allow a zero-parameter variadic function in C if the
// function is marked with the "overloadable" attribute. Scan
- // for this attribute now. We also allow it in C2x per WG14 N2975.
+ // for this attribute now. We also allow it in C23 per WG14 N2975.
if (!FTI.NumParams && FTI.isVariadic && !LangOpts.CPlusPlus) {
- if (LangOpts.C2x)
+ if (LangOpts.C23)
S.Diag(FTI.getEllipsisLoc(),
diag::warn_c17_compat_ellipsis_only_parameter);
else if (!D.getDeclarationAttributes().hasAttribute(
@@ -5750,7 +5750,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
// of that function specifies that no information about the number or types
// of the parameters is supplied.
// See ActOnFinishFunctionBody() and MergeFunctionDecl() for handling of
- // function declarations whose behavior changes in C2x.
+ // function declarations whose behavior changes in C23.
if (!LangOpts.requiresStrictPrototypes()) {
bool IsBlock = false;
for (const DeclaratorChunk &DeclType : D.type_objects()) {
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index 8ef728f86c6b85..3dda407fad84af 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -65,7 +65,7 @@ class FlattenedSpelling {
OriginalSpelling(Spelling) {
assert(V != "GCC" && V != "Clang" &&
"Given a GCC spelling, which means this hasn't been flattened!");
- if (V == "CXX11" || V == "C2x" || V == "Pragma")
+ if (V == "CXX11" || V == "C23" || V == "Pragma")
NS = std::string(Spelling.getValueAsString("Namespace"));
}
@@ -90,12 +90,12 @@ GetFlattenedSpellings(const Record &Attr) {
Ret.emplace_back("GNU", std::string(Name), "", true, *Spelling);
Ret.emplace_back("CXX11", std::string(Name), "gnu", true, *Spelling);
if (Spelling->getValueAsBit("AllowInC"))
- Ret.emplace_back("C2x", std::string(Name), "gnu", true, *Spelling);
+ Ret.emplace_back("C23", std::string(Name), "gnu", true, *Spelling);
} else if (Variety == "Clang") {
Ret.emplace_back("GNU", std::string(Name), "", false, *Spelling);
Ret.emplace_back("CXX11", std::string(Name), "clang", false, *Spelling);
if (Spelling->getValueAsBit("AllowInC"))
- Ret.emplace_back("C2x", std::string(Name), "clang", false, *Spelling);
+ Ret.emplace_back("C23", std::string(Name), "clang", false, *Spelling);
} else
Ret.push_back(FlattenedSpelling(*Spelling));
}
@@ -1531,7 +1531,7 @@ writePrettyPrintFunction(const Record &R,
if (Variety == "GNU") {
Prefix = " __attribute__((";
Suffix = "))";
- } else if (Variety == "CXX11" || Variety == "C2x") {
+ } else if (Variety == "CXX11" || Variety == "C23") {
Prefix = " [[";
Suffix = "]]";
std::string Namespace = Spellings[I].nameSpace();
@@ -3354,7 +3354,7 @@ static void GenerateHasAttrSpellingStringSwitch(
// document, which can be found at:
// https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
//
- // C2x-style attributes have the same kind of version information
+ // C23-style attributes have the same kind of version information
// associated with them. The unscoped attribute version information should
// be taken from the specification of the attribute in the C Standard.
//
@@ -3371,11 +3371,11 @@ static void GenerateHasAttrSpellingStringSwitch(
(Spelling.nameSpace().empty() || Scope == Spelling.nameSpace())) {
Version = static_cast<int>(
Spelling.getSpellingRecord().getValueAsInt("Version"));
- // Verify that explicitly specified CXX11 and C2x spellings (i.e.
+ // Verify that explicitly specified CXX11 and C23 spellings (i.e.
// not inferred from Clang/GCC spellings) have a version that's
//
diff erent than the default (1).
bool RequiresValidVersion =
- (Variety == "CXX11" || Variety == "C2x") &&
+ (Variety == "CXX11" || Variety == "C23") &&
Spelling.getSpellingRecord().getValueAsString("Variety") == Variety;
if (RequiresValidVersion && Scope.empty() && Version == 1)
PrintError(Spelling.getSpellingRecord().getLoc(),
@@ -3438,7 +3438,7 @@ void EmitClangAttrHasAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
// and declspecs. Then generate a big switch statement for each of them.
std::vector<Record *> Attrs = Records.getAllDerivedDefinitions("Attr");
std::vector<Record *> Declspec, Microsoft, GNU, Pragma, HLSLSemantic;
- std::map<std::string, std::vector<Record *>> CXX, C2x;
+ std::map<std::string, std::vector<Record *>> CXX, C23;
// Walk over the list of all attributes, and split them out based on the
// spelling variety.
@@ -3454,8 +3454,8 @@ void EmitClangAttrHasAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
Microsoft.push_back(R);
else if (Variety == "CXX11")
CXX[SI.nameSpace()].push_back(R);
- else if (Variety == "C2x")
- C2x[SI.nameSpace()].push_back(R);
+ else if (Variety == "C23")
+ C23[SI.nameSpace()].push_back(R);
else if (Variety == "Pragma")
Pragma.push_back(R);
else if (Variety == "HLSLSemantic")
@@ -3498,7 +3498,7 @@ void EmitClangAttrHasAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
OS << "\n} break;\n";
};
fn("CXX11", CXX);
- fn("C2x", C2x);
+ fn("C23", C23);
OS << "case AttributeCommonInfo::Syntax::AS_Keyword:\n";
OS << "case AttributeCommonInfo::Syntax::AS_ContextSensitiveKeyword:\n";
OS << " llvm_unreachable(\"hasAttribute not supported for keyword\");\n";
@@ -4442,7 +4442,7 @@ void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS) {
std::vector<Record *> Attrs = Records.getAllDerivedDefinitions("Attr");
std::vector<StringMatcher::StringPair> GNU, Declspec, Microsoft, CXX11,
- Keywords, Pragma, C2x, HLSLSemantic;
+ Keywords, Pragma, C23, HLSLSemantic;
std::set<std::string> Seen;
for (const auto *A : Attrs) {
const Record &Attr = *A;
@@ -4479,8 +4479,8 @@ void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS) {
Matches = &CXX11;
if (!S.nameSpace().empty())
Spelling += S.nameSpace() + "::";
- } else if (Variety == "C2x") {
- Matches = &C2x;
+ } else if (Variety == "C23") {
+ Matches = &C23;
if (!S.nameSpace().empty())
Spelling += S.nameSpace() + "::";
} else if (Variety == "GNU")
@@ -4523,8 +4523,8 @@ void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS) {
StringMatcher("Name", Microsoft, OS).Emit();
OS << " } else if (AttributeCommonInfo::AS_CXX11 == Syntax) {\n";
StringMatcher("Name", CXX11, OS).Emit();
- OS << " } else if (AttributeCommonInfo::AS_C2x == Syntax) {\n";
- StringMatcher("Name", C2x, OS).Emit();
+ OS << " } else if (AttributeCommonInfo::AS_C23 == Syntax) {\n";
+ StringMatcher("Name", C23, OS).Emit();
OS << " } else if (AttributeCommonInfo::AS_Keyword == Syntax || ";
OS << "AttributeCommonInfo::AS_ContextSensitiveKeyword == Syntax) {\n";
StringMatcher("Name", Keywords, OS).Emit();
@@ -4644,7 +4644,7 @@ void EmitClangAttrDocTable(RecordKeeper &Records, raw_ostream &OS) {
enum class SpellingKind : size_t {
GNU,
CXX11,
- C2x,
+ C23,
Declspec,
Microsoft,
Keyword,
@@ -4666,7 +4666,7 @@ class SpellingList {
SpellingKind Kind = StringSwitch<SpellingKind>(Spelling.variety())
.Case("GNU", SpellingKind::GNU)
.Case("CXX11", SpellingKind::CXX11)
- .Case("C2x", SpellingKind::C2x)
+ .Case("C23", SpellingKind::C23)
.Case("Declspec", SpellingKind::Declspec)
.Case("Microsoft", SpellingKind::Microsoft)
.Case("Keyword", SpellingKind::Keyword)
@@ -4676,7 +4676,7 @@ class SpellingList {
if (!Spelling.nameSpace().empty()) {
switch (Kind) {
case SpellingKind::CXX11:
- case SpellingKind::C2x:
+ case SpellingKind::C23:
Name = Spelling.nameSpace() + "::";
break;
case SpellingKind::Pragma:
@@ -4779,7 +4779,7 @@ static void WriteDocumentation(RecordKeeper &Records,
// Note: "#pragma clang attribute" is handled outside the spelling kinds loop
// so it must be last.
OS << ".. csv-table:: Supported Syntaxes\n";
- OS << " :header: \"GNU\", \"C++11\", \"C2x\", \"``__declspec``\",";
+ OS << " :header: \"GNU\", \"C++11\", \"C23\", \"``__declspec``\",";
OS << " \"Keyword\", \"``#pragma``\", \"HLSL Semantic\", \"``#pragma clang ";
OS << "attribute``\"\n\n \"";
for (size_t Kind = 0; Kind != NumSpellingKinds; ++Kind) {
More information about the cfe-commits
mailing list