Skip to content

[clang][NFC] Improve locality of recently refactored enums #70943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions clang/include/clang/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4059,6 +4059,29 @@ class EnumDecl : public TagDecl {
static bool classofKind(Kind K) { return K == Enum; }
};

/// Enum that represents the different ways arguments are passed to and
/// returned from function calls. This takes into account the target-specific
/// and version-specific rules along with the rules determined by the
/// language.
enum class ArgPassingKind {
/// The argument of this type can be passed directly in registers.
CanPassInRegs,

/// The argument of this type cannot be passed directly in registers.
/// Records containing this type as a subobject are not forced to be passed
/// indirectly. This value is used only in C++. This value is required by
/// C++ because, in uncommon situations, it is possible for a class to have
/// only trivial copy/move constructors even when one of its subobjects has
/// a non-trivial copy/move constructor (if e.g. the corresponding copy/move
/// constructor in the derived class is deleted).
CannotPassInRegs,

/// The argument of this type cannot be passed directly in registers.
/// Records containing this type as a subobject are forced to be passed
/// indirectly.
CanNeverPassInRegs
};

/// Represents a struct/union/class. For example:
/// struct X; // Forward declaration, no "body".
/// union Y { int A, B; }; // Has body with members A and B (FieldDecls).
Expand Down
34 changes: 3 additions & 31 deletions clang/include/clang/AST/DeclBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -1399,37 +1399,9 @@ enum class DeductionCandidate : unsigned char {
Aggregate,
};

/// Enum that represents the different ways arguments are passed to and
/// returned from function calls. This takes into account the target-specific
/// and version-specific rules along with the rules determined by the
/// language.
enum class ArgPassingKind {
/// The argument of this type can be passed directly in registers.
CanPassInRegs,

/// The argument of this type cannot be passed directly in registers.
/// Records containing this type as a subobject are not forced to be passed
/// indirectly. This value is used only in C++. This value is required by
/// C++ because, in uncommon situations, it is possible for a class to have
/// only trivial copy/move constructors even when one of its subobjects has
/// a non-trivial copy/move constructor (if e.g. the corresponding copy/move
/// constructor in the derived class is deleted).
CannotPassInRegs,

/// The argument of this type cannot be passed directly in registers.
/// Records containing this type as a subobject are forced to be passed
/// indirectly.
CanNeverPassInRegs
};

enum class OMPDeclareReductionInitKind {
Call, // Initialized by function call.
Direct, // omp_priv(<expr>)
Copy // omp_priv = <expr>
};

enum class ObjCImplementationControl { None, Required, Optional };

enum class ArgPassingKind;
enum class OMPDeclareReductionInitKind;
enum class ObjCImplementationControl;
enum class LinkageSpecLanguageIDs;

/// DeclContext - This is used only as base class of specific decl types that
Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/AST/DeclObjC.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class ObjCProtocolList : public ObjCList<ObjCProtocolDecl> {
const SourceLocation *Locs, ASTContext &Ctx);
};

enum class ObjCImplementationControl { None, Required, Optional };

/// ObjCMethodDecl - Represents an instance or class method declaration.
/// ObjC methods can be declared within 4 contexts: class interfaces,
/// categories, protocols, and class implementations. While C++ member
Expand Down
6 changes: 6 additions & 0 deletions clang/include/clang/AST/DeclOpenMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ class OMPThreadPrivateDecl final : public OMPDeclarativeDirective<Decl> {
static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
};

enum class OMPDeclareReductionInitKind {
Call, // Initialized by function call.
Direct, // omp_priv(<expr>)
Copy // omp_priv = <expr>
};

/// This represents '#pragma omp declare reduction ...' directive.
/// For example, in the following, declared reduction 'foo' for types 'int' and
/// 'float':
Expand Down
123 changes: 63 additions & 60 deletions clang/include/clang/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -1569,66 +1569,9 @@ enum class AutoTypeKeyword {
GNUAutoType
};

/// Capture whether this is a normal array (e.g. int X[4])
/// an array with a static size (e.g. int X[static 4]), or an array
/// with a star size (e.g. int X[*]).
/// 'static' is only allowed on function parameters.
enum class ArraySizeModifier { Normal, Static, Star };

/// The elaboration keyword that precedes a qualified type name or
/// introduces an elaborated-type-specifier.
enum class ElaboratedTypeKeyword {
/// The "struct" keyword introduces the elaborated-type-specifier.
Struct,

/// The "__interface" keyword introduces the elaborated-type-specifier.
Interface,

/// The "union" keyword introduces the elaborated-type-specifier.
Union,

/// The "class" keyword introduces the elaborated-type-specifier.
Class,

/// The "enum" keyword introduces the elaborated-type-specifier.
Enum,

/// The "typename" keyword precedes the qualified type name, e.g.,
/// \c typename T::type.
Typename,

/// No keyword precedes the qualified type name.
None
};

enum class VectorKind {
/// not a target-specific vector type
Generic,

/// is AltiVec vector
AltiVecVector,

/// is AltiVec 'vector Pixel'
AltiVecPixel,

/// is AltiVec 'vector bool ...'
AltiVecBool,

/// is ARM Neon vector
Neon,

/// is ARM Neon polynomial vector
NeonPoly,

/// is AArch64 SVE fixed-length data vector
SveFixedLengthData,

/// is AArch64 SVE fixed-length predicate vector
SveFixedLengthPredicate,

/// is RISC-V RVV fixed-length data vector
RVVFixedLengthData,
};
enum class ArraySizeModifier;
enum class ElaboratedTypeKeyword;
enum class VectorKind;

/// The base class of the type hierarchy.
///
Expand Down Expand Up @@ -3145,6 +3088,12 @@ class MemberPointerType : public Type, public llvm::FoldingSetNode {
}
};

/// Capture whether this is a normal array (e.g. int X[4])
/// an array with a static size (e.g. int X[static 4]), or an array
/// with a star size (e.g. int X[*]).
/// 'static' is only allowed on function parameters.
enum class ArraySizeModifier { Normal, Static, Star };

/// Represents an array type, per C99 6.7.5.2 - Array Declarators.
class ArrayType : public Type, public llvm::FoldingSetNode {
private:
Expand Down Expand Up @@ -3474,6 +3423,34 @@ class DependentSizedExtVectorType : public Type, public llvm::FoldingSetNode {
QualType ElementType, Expr *SizeExpr);
};

enum class VectorKind {
/// not a target-specific vector type
Generic,

/// is AltiVec vector
AltiVecVector,

/// is AltiVec 'vector Pixel'
AltiVecPixel,

/// is AltiVec 'vector bool ...'
AltiVecBool,

/// is ARM Neon vector
Neon,

/// is ARM Neon polynomial vector
NeonPoly,

/// is AArch64 SVE fixed-length data vector
SveFixedLengthData,

/// is AArch64 SVE fixed-length predicate vector
SveFixedLengthPredicate,

/// is RISC-V RVV fixed-length data vector
RVVFixedLengthData,
};

/// Represents a GCC generic vector type. This type is created using
/// __attribute__((vector_size(n)), where "n" specifies the vector size in
Expand Down Expand Up @@ -5667,6 +5644,32 @@ class InjectedClassNameType : public Type {
}
};

/// The elaboration keyword that precedes a qualified type name or
/// introduces an elaborated-type-specifier.
enum class ElaboratedTypeKeyword {
/// The "struct" keyword introduces the elaborated-type-specifier.
Struct,

/// The "__interface" keyword introduces the elaborated-type-specifier.
Interface,

/// The "union" keyword introduces the elaborated-type-specifier.
Union,

/// The "class" keyword introduces the elaborated-type-specifier.
Class,

/// The "enum" keyword introduces the elaborated-type-specifier.
Enum,

/// The "typename" keyword precedes the qualified type name, e.g.,
/// \c typename T::type.
Typename,

/// No keyword precedes the qualified type name.
None
};

/// The kind of a tag type.
enum TagTypeKind {
/// The "struct" keyword.
Expand Down