Skip to content

Commit

Permalink
[C23] Rename C2x -> C23; NFC
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AaronBallman committed Aug 11, 2023
1 parent 81300f7 commit 0ce056a
Show file tree
Hide file tree
Showing 47 changed files with 224 additions and 221 deletions.
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/index/StdLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/AST/ExprCXX.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/AST/PrettyPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
14 changes: 7 additions & 7 deletions clang/include/clang/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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.

Expand Down
34 changes: 17 additions & 17 deletions clang/include/clang/Basic/Attr.td
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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> {
Expand Down Expand Up @@ -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>;
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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];
}
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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]>;
Expand Down Expand Up @@ -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">;
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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]>;
Expand Down
8 changes: 4 additions & 4 deletions clang/include/clang/Basic/AttributeCommonInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AttributeCommonInfo {
AS_CXX11,

/// [[...]]
AS_C2x,
AS_C23,

/// __declspec(...)
AS_Declspec,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/Features.def
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/LangOptions.def
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions clang/include/clang/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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())
Expand Down
6 changes: 3 additions & 3 deletions clang/include/clang/Basic/LangStandard.h
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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; }
Expand Down
4 changes: 2 additions & 2 deletions clang/include/clang/Basic/LangStandards.def
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
8 changes: 4 additions & 4 deletions clang/include/clang/Basic/Specifiers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 0ce056a

Please sign in to comment.