Skip to content

Commit

Permalink
[clang][NFC] Annotate Decl.h with preferred_type
Browse files Browse the repository at this point in the history
  • Loading branch information
Endilll committed Nov 6, 2023
1 parent dda8e3d commit ad27848
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions clang/include/clang/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class TemplateParameterList;
class TypeAliasTemplateDecl;
class UnresolvedSetImpl;
class VarTemplateDecl;
enum class ImplicitParamKind;

/// The top declaration context.
class TranslationUnitDecl : public Decl,
Expand Down Expand Up @@ -969,12 +970,16 @@ class VarDecl : public DeclaratorDecl, public Redeclarable<VarDecl> {
friend class ASTDeclReader;
friend class VarDecl;

LLVM_PREFERRED_TYPE(StorageClass)
unsigned SClass : 3;
LLVM_PREFERRED_TYPE(ThreadStorageClassSpecifier)
unsigned TSCSpec : 2;
LLVM_PREFERRED_TYPE(InitializationStyle)
unsigned InitStyle : 2;

/// Whether this variable is an ARC pseudo-__strong variable; see
/// isARCPseudoStrong() for details.
LLVM_PREFERRED_TYPE(bool)
unsigned ARCPseudoStrong : 1;
};
enum { NumVarDeclBits = 8 };
Expand All @@ -995,22 +1000,27 @@ class VarDecl : public DeclaratorDecl, public Redeclarable<VarDecl> {
friend class ASTDeclReader;
friend class ParmVarDecl;

LLVM_PREFERRED_TYPE(VarDeclBitfields)
unsigned : NumVarDeclBits;

/// Whether this parameter inherits a default argument from a
/// prior declaration.
LLVM_PREFERRED_TYPE(bool)
unsigned HasInheritedDefaultArg : 1;

/// Describes the kind of default argument for this parameter. By default
/// this is none. If this is normal, then the default argument is stored in
/// the \c VarDecl initializer expression unless we were unable to parse
/// (even an invalid) expression for the default argument.
LLVM_PREFERRED_TYPE(DefaultArgKind)
unsigned DefaultArgKind : 2;

/// Whether this parameter undergoes K&R argument promotion.
LLVM_PREFERRED_TYPE(bool)
unsigned IsKNRPromoted : 1;

/// Whether this parameter is an ObjC method parameter or not.
LLVM_PREFERRED_TYPE(bool)
unsigned IsObjCMethodParam : 1;

/// If IsObjCMethodParam, a Decl::ObjCDeclQualifier.
Expand All @@ -1029,51 +1039,64 @@ class VarDecl : public DeclaratorDecl, public Redeclarable<VarDecl> {
friend class ImplicitParamDecl;
friend class VarDecl;

LLVM_PREFERRED_TYPE(VarDeclBitfields)
unsigned : NumVarDeclBits;

// FIXME: We need something similar to CXXRecordDecl::DefinitionData.
/// Whether this variable is a definition which was demoted due to
/// module merge.
LLVM_PREFERRED_TYPE(bool)
unsigned IsThisDeclarationADemotedDefinition : 1;

/// Whether this variable is the exception variable in a C++ catch
/// or an Objective-C @catch statement.
LLVM_PREFERRED_TYPE(bool)
unsigned ExceptionVar : 1;

/// Whether this local variable could be allocated in the return
/// slot of its function, enabling the named return value optimization
/// (NRVO).
LLVM_PREFERRED_TYPE(bool)
unsigned NRVOVariable : 1;

/// Whether this variable is the for-range-declaration in a C++0x
/// for-range statement.
LLVM_PREFERRED_TYPE(bool)
unsigned CXXForRangeDecl : 1;

/// Whether this variable is the for-in loop declaration in Objective-C.
LLVM_PREFERRED_TYPE(bool)
unsigned ObjCForDecl : 1;

/// Whether this variable is (C++1z) inline.
LLVM_PREFERRED_TYPE(bool)
unsigned IsInline : 1;

/// Whether this variable has (C++1z) inline explicitly specified.
LLVM_PREFERRED_TYPE(bool)
unsigned IsInlineSpecified : 1;

/// Whether this variable is (C++0x) constexpr.
LLVM_PREFERRED_TYPE(bool)
unsigned IsConstexpr : 1;

/// Whether this variable is the implicit variable for a lambda
/// init-capture.
LLVM_PREFERRED_TYPE(bool)
unsigned IsInitCapture : 1;

/// Whether this local extern variable's previous declaration was
/// declared in the same block scope. This controls whether we should merge
/// the type of this declaration with its previous declaration.
LLVM_PREFERRED_TYPE(bool)
unsigned PreviousDeclInSameBlockScope : 1;

/// Defines kind of the ImplicitParamDecl: 'this', 'self', 'vtt', '_cmd' or
/// something else.
LLVM_PREFERRED_TYPE(ImplicitParamKind)
unsigned ImplicitParamKind : 3;

LLVM_PREFERRED_TYPE(bool)
unsigned EscapingByref : 1;
};

Expand Down Expand Up @@ -3013,8 +3036,11 @@ class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
ISK_CapturedVLAType,
};

LLVM_PREFERRED_TYPE(bool)
unsigned BitField : 1;
LLVM_PREFERRED_TYPE(bool)
unsigned Mutable : 1;
LLVM_PREFERRED_TYPE(InitStorageKind)
unsigned StorageKind : 2;
mutable unsigned CachedFieldIndex : 28;

Expand Down

0 comments on commit ad27848

Please sign in to comment.