[clang] 7ec8a6f - [clang][NFC] Annotate `Stmt.h` with `preferred_type`

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 6 10:02:22 PST 2023


Author: Vlad Serebrennikov
Date: 2023-11-06T21:02:14+03:00
New Revision: 7ec8a6fd31d8ddb161b06067fb6b7f9026a460df

URL: https://github.com/llvm/llvm-project/commit/7ec8a6fd31d8ddb161b06067fb6b7f9026a460df
DIFF: https://github.com/llvm/llvm-project/commit/7ec8a6fd31d8ddb161b06067fb6b7f9026a460df.diff

LOG: [clang][NFC] Annotate `Stmt.h` with `preferred_type`

This helps debuggers to display values in bit-fields in a more helpful way.

Added: 
    

Modified: 
    clang/include/clang/AST/Stmt.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h
index 9fb49e99da1073f..da7b37ce0e1211f 100644
--- a/clang/include/clang/AST/Stmt.h
+++ b/clang/include/clang/AST/Stmt.h
@@ -13,15 +13,20 @@
 #ifndef LLVM_CLANG_AST_STMT_H
 #define LLVM_CLANG_AST_STMT_H
 
+#include "clang/AST/APValue.h"
 #include "clang/AST/DeclGroup.h"
 #include "clang/AST/DependenceFlags.h"
+#include "clang/AST/OperationKinds.h"
 #include "clang/AST/StmtIterator.h"
 #include "clang/Basic/CapturedStmt.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LLVM.h"
+#include "clang/Basic/Lambda.h"
 #include "clang/Basic/LangOptions.h"
+#include "clang/Basic/OperatorKinds.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
+#include "clang/Basic/TypeTraits.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/BitmaskEnum.h"
@@ -62,6 +67,13 @@ class SourceManager;
 class StringLiteral;
 class Token;
 class VarDecl;
+enum class CharacterLiteralKind;
+enum class ConstantResultStorageKind;
+enum class CXXConstructionKind;
+enum class CXXNewInitializationStyle;
+enum class PredefinedIdentKind;
+enum class SourceLocIdentKind;
+enum class StringLiteralKind;
 
 //===----------------------------------------------------------------------===//
 // AST classes for statements.
@@ -103,6 +115,7 @@ class alignas(void *) Stmt {
     friend class Stmt;
 
     /// The statement class.
+    LLVM_PREFERRED_TYPE(StmtClass)
     unsigned sClass : 8;
   };
   enum { NumStmtBits = 8 };
@@ -112,6 +125,7 @@ class alignas(void *) Stmt {
     friend class ASTStmtWriter;
     friend class NullStmt;
 
+    LLVM_PREFERRED_TYPE(StmtBitfields)
     unsigned : NumStmtBits;
 
     /// True if the null statement was preceded by an empty macro, e.g:
@@ -119,6 +133,7 @@ class alignas(void *) Stmt {
     ///   #define CALL(x)
     ///   CALL(0);
     /// @endcode
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasLeadingEmptyMacro : 1;
 
     /// The location of the semi-colon.
@@ -129,10 +144,12 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class CompoundStmt;
 
+    LLVM_PREFERRED_TYPE(StmtBitfields)
     unsigned : NumStmtBits;
 
     /// True if the compound statement has one or more pragmas that set some
     /// floating-point features.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasFPFeatures : 1;
 
     unsigned NumStmts;
@@ -141,6 +158,7 @@ class alignas(void *) Stmt {
   class LabelStmtBitfields {
     friend class LabelStmt;
 
+    LLVM_PREFERRED_TYPE(StmtBitfields)
     unsigned : NumStmtBits;
 
     SourceLocation IdentLoc;
@@ -150,6 +168,7 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class AttributedStmt;
 
+    LLVM_PREFERRED_TYPE(StmtBitfields)
     unsigned : NumStmtBits;
 
     /// Number of attributes.
@@ -163,18 +182,23 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class IfStmt;
 
+    LLVM_PREFERRED_TYPE(StmtBitfields)
     unsigned : NumStmtBits;
 
     /// Whether this is a constexpr if, or a consteval if, or neither.
+    LLVM_PREFERRED_TYPE(IfStatementKind)
     unsigned Kind : 3;
 
     /// True if this if statement has storage for an else statement.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasElse : 1;
 
     /// True if this if statement has storage for a variable declaration.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasVar : 1;
 
     /// True if this if statement has storage for an init statement.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasInit : 1;
 
     /// The location of the "if".
@@ -184,17 +208,21 @@ class alignas(void *) Stmt {
   class SwitchStmtBitfields {
     friend class SwitchStmt;
 
+    LLVM_PREFERRED_TYPE(StmtBitfields)
     unsigned : NumStmtBits;
 
     /// True if the SwitchStmt has storage for an init statement.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasInit : 1;
 
     /// True if the SwitchStmt has storage for a condition variable.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasVar : 1;
 
     /// If the SwitchStmt is a switch on an enum value, records whether all
     /// the enum values were covered by CaseStmts.  The coverage information
     /// value is meant to be a hint for possible clients.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned AllEnumCasesCovered : 1;
 
     /// The location of the "switch".
@@ -205,9 +233,11 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class WhileStmt;
 
+    LLVM_PREFERRED_TYPE(StmtBitfields)
     unsigned : NumStmtBits;
 
     /// True if the WhileStmt has storage for a condition variable.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasVar : 1;
 
     /// The location of the "while".
@@ -217,6 +247,7 @@ class alignas(void *) Stmt {
   class DoStmtBitfields {
     friend class DoStmt;
 
+    LLVM_PREFERRED_TYPE(StmtBitfields)
     unsigned : NumStmtBits;
 
     /// The location of the "do".
@@ -226,6 +257,7 @@ class alignas(void *) Stmt {
   class ForStmtBitfields {
     friend class ForStmt;
 
+    LLVM_PREFERRED_TYPE(StmtBitfields)
     unsigned : NumStmtBits;
 
     /// The location of the "for".
@@ -236,6 +268,7 @@ class alignas(void *) Stmt {
     friend class GotoStmt;
     friend class IndirectGotoStmt;
 
+    LLVM_PREFERRED_TYPE(StmtBitfields)
     unsigned : NumStmtBits;
 
     /// The location of the "goto".
@@ -245,6 +278,7 @@ class alignas(void *) Stmt {
   class ContinueStmtBitfields {
     friend class ContinueStmt;
 
+    LLVM_PREFERRED_TYPE(StmtBitfields)
     unsigned : NumStmtBits;
 
     /// The location of the "continue".
@@ -254,6 +288,7 @@ class alignas(void *) Stmt {
   class BreakStmtBitfields {
     friend class BreakStmt;
 
+    LLVM_PREFERRED_TYPE(StmtBitfields)
     unsigned : NumStmtBits;
 
     /// The location of the "break".
@@ -263,9 +298,11 @@ class alignas(void *) Stmt {
   class ReturnStmtBitfields {
     friend class ReturnStmt;
 
+    LLVM_PREFERRED_TYPE(StmtBitfields)
     unsigned : NumStmtBits;
 
     /// True if this ReturnStmt has storage for an NRVO candidate.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasNRVOCandidate : 1;
 
     /// The location of the "return".
@@ -276,10 +313,12 @@ class alignas(void *) Stmt {
     friend class SwitchCase;
     friend class CaseStmt;
 
+    LLVM_PREFERRED_TYPE(StmtBitfields)
     unsigned : NumStmtBits;
 
     /// Used by CaseStmt to store whether it is a case statement
     /// of the form case LHS ... RHS (a GNU extension).
+    LLVM_PREFERRED_TYPE(bool)
     unsigned CaseStmtIsGNURange : 1;
 
     /// The location of the "case" or "default" keyword.
@@ -312,11 +351,15 @@ class alignas(void *) Stmt {
     friend class PseudoObjectExpr; // ctor
     friend class ShuffleVectorExpr; // ctor
 
+    LLVM_PREFERRED_TYPE(StmtBitfields)
     unsigned : NumStmtBits;
 
+    LLVM_PREFERRED_TYPE(ExprValueKind)
     unsigned ValueKind : 2;
+    LLVM_PREFERRED_TYPE(ExprObjectKind)
     unsigned ObjectKind : 3;
-    unsigned /*ExprDependence*/ Dependent : llvm::BitWidth<ExprDependence>;
+    LLVM_PREFERRED_TYPE(ExprDependence)
+    unsigned Dependent : llvm::BitWidth<ExprDependence>;
   };
   enum { NumExprBits = NumStmtBits + 5 + llvm::BitWidth<ExprDependence> };
 
@@ -325,16 +368,20 @@ class alignas(void *) Stmt {
     friend class ASTStmtWriter;
     friend class ConstantExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// The kind of result that is tail-allocated.
+    LLVM_PREFERRED_TYPE(ConstantResultStorageKind)
     unsigned ResultKind : 2;
 
-    /// The kind of Result as defined by APValue::Kind.
+    /// The kind of Result as defined by APValue::ValueKind.
+    LLVM_PREFERRED_TYPE(APValue::ValueKind)
     unsigned APValueKind : 4;
 
     /// When ResultKind == ConstantResultStorageKind::Int64, true if the
     /// tail-allocated integer is unsigned.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsUnsigned : 1;
 
     /// When ResultKind == ConstantResultStorageKind::Int64. the BitWidth of the
@@ -345,9 +392,11 @@ class alignas(void *) Stmt {
 
     /// When ResultKind == ConstantResultStorageKind::APValue, true if the
     /// ASTContext will cleanup the tail-allocated APValue.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasCleanup : 1;
 
     /// True if this ConstantExpr was created for immediate invocation.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsImmediateInvocation : 1;
   };
 
@@ -355,18 +404,20 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class PredefinedExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
-    /// The kind of this PredefinedExpr. One of the enumeration values
-    /// in PredefinedExpr::IdentKind.
+    LLVM_PREFERRED_TYPE(PredefinedIdentKind)
     unsigned Kind : 4;
 
     /// True if this PredefinedExpr has a trailing "StringLiteral *"
     /// for the predefined identifier.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasFunctionName : 1;
 
     /// True if this PredefinedExpr should be treated as a StringLiteral (for
     /// MSVC compatibility).
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsTransparent : 1;
 
     /// The location of this PredefinedExpr.
@@ -377,15 +428,24 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader; // deserialization
     friend class DeclRefExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasQualifier : 1;
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasTemplateKWAndArgsInfo : 1;
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasFoundDecl : 1;
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HadMultipleCandidates : 1;
+    LLVM_PREFERRED_TYPE(bool)
     unsigned RefersToEnclosingVariableOrCapture : 1;
+    LLVM_PREFERRED_TYPE(bool)
     unsigned CapturedByCopyInLambdaWithExplicitObjectParameter : 1;
+    LLVM_PREFERRED_TYPE(NonOdrUseReason)
     unsigned NonOdrUseReason : 2;
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsImmediateEscalating : 1;
 
     /// The location of the declaration name itself.
@@ -396,12 +456,15 @@ class alignas(void *) Stmt {
   class FloatingLiteralBitfields {
     friend class FloatingLiteral;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     static_assert(
         llvm::APFloat::S_MaxSemantics < 16,
         "Too many Semantics enum values to fit in bitfield of size 4");
+    LLVM_PREFERRED_TYPE(llvm::APFloat::Semantics)
     unsigned Semantics : 4; // Provides semantics for APFloat construction
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsExact : 1;
   };
 
@@ -409,10 +472,12 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class StringLiteral;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// The kind of this string literal.
     /// One of the enumeration values of StringLiteral::StringKind.
+    LLVM_PREFERRED_TYPE(StringLiteralKind)
     unsigned Kind : 3;
 
     /// The width of a single character in bytes. Only values of 1, 2,
@@ -420,6 +485,7 @@ class alignas(void *) Stmt {
     /// the target + string kind to the appropriate CharByteWidth.
     unsigned CharByteWidth : 3;
 
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsPascal : 1;
 
     /// The number of concatenated token this string is made of.
@@ -430,22 +496,28 @@ class alignas(void *) Stmt {
   class CharacterLiteralBitfields {
     friend class CharacterLiteral;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
+    LLVM_PREFERRED_TYPE(CharacterLiteralKind)
     unsigned Kind : 3;
   };
 
   class UnaryOperatorBitfields {
     friend class UnaryOperator;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
+    LLVM_PREFERRED_TYPE(UnaryOperatorKind)
     unsigned Opc : 5;
+    LLVM_PREFERRED_TYPE(bool)
     unsigned CanOverflow : 1;
     //
     /// This is only meaningful for operations on floating point
     /// types when additional values need to be in trailing storage.
     /// It is 0 otherwise.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasFPFeatures : 1;
 
     SourceLocation Loc;
@@ -454,9 +526,12 @@ class alignas(void *) Stmt {
   class UnaryExprOrTypeTraitExprBitfields {
     friend class UnaryExprOrTypeTraitExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
+    LLVM_PREFERRED_TYPE(UnaryExprOrTypeTrait)
     unsigned Kind : 3;
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsType : 1; // true if operand is a type, false if an expression.
   };
 
@@ -464,6 +539,7 @@ class alignas(void *) Stmt {
     friend class ArraySubscriptExpr;
     friend class MatrixSubscriptExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     SourceLocation RBracketLoc;
@@ -472,14 +548,17 @@ class alignas(void *) Stmt {
   class CallExprBitfields {
     friend class CallExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     unsigned NumPreArgs : 1;
 
     /// True if the callee of the call expression was found using ADL.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned UsesADL : 1;
 
     /// True if the call expression has some floating-point features.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasFPFeatures : 1;
 
     /// Padding used to align OffsetToTrailingObjects to a byte multiple.
@@ -496,15 +575,18 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class MemberExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// IsArrow - True if this is "X->F", false if this is "X.F".
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsArrow : 1;
 
     /// True if this member expression used a nested-name-specifier to
     /// refer to the member, e.g., "x->Base::f", or found its member via
     /// a using declaration.  When true, a MemberExprNameQualifier
     /// structure is allocated immediately after the MemberExpr.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasQualifierOrFoundDecl : 1;
 
     /// True if this member expression specified a template keyword
@@ -512,15 +594,18 @@ class alignas(void *) Stmt {
     /// x->template f, x->template f<int>.
     /// When true, an ASTTemplateKWAndArgsInfo structure and its
     /// TemplateArguments (if any) are present.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasTemplateKWAndArgsInfo : 1;
 
     /// True if this member expression refers to a method that
     /// was resolved from an overloaded set having size greater than 1.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HadMultipleCandidates : 1;
 
     /// Value of type NonOdrUseReason indicating why this MemberExpr does
     /// not constitute an odr-use of the named declaration. Meaningful only
     /// when naming a static member.
+    LLVM_PREFERRED_TYPE(NonOdrUseReason)
     unsigned NonOdrUseReason : 2;
 
     /// This is the location of the -> or . in the expression.
@@ -531,12 +616,16 @@ class alignas(void *) Stmt {
     friend class CastExpr;
     friend class ImplicitCastExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
+    LLVM_PREFERRED_TYPE(CastKind)
     unsigned Kind : 7;
+    LLVM_PREFERRED_TYPE(bool)
     unsigned PartOfExplicitCast : 1; // Only set for ImplicitCastExpr.
 
     /// True if the call expression has some floating-point features.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasFPFeatures : 1;
 
     /// The number of CXXBaseSpecifiers in the cast. 14 bits would be enough
@@ -547,13 +636,16 @@ class alignas(void *) Stmt {
   class BinaryOperatorBitfields {
     friend class BinaryOperator;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
+    LLVM_PREFERRED_TYPE(BinaryOperatorKind)
     unsigned Opc : 6;
 
     /// This is only meaningful for operations on floating point
     /// types when additional values need to be in trailing storage.
     /// It is 0 otherwise.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasFPFeatures : 1;
 
     SourceLocation OpLoc;
@@ -562,10 +654,12 @@ class alignas(void *) Stmt {
   class InitListExprBitfields {
     friend class InitListExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// Whether this initializer list originally had a GNU array-range
     /// designator in it. This is a temporary marker used by CodeGen.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HadArrayRangeDesignator : 1;
   };
 
@@ -573,6 +667,7 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class ParenListExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// The number of expressions in the paren list.
@@ -583,6 +678,7 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class GenericSelectionExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// The location of the "_Generic".
@@ -593,6 +689,7 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader; // deserialization
     friend class PseudoObjectExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     unsigned NumSubExprs : 16;
@@ -603,10 +700,12 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class SourceLocExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// The kind of source location builtin represented by the SourceLocExpr.
     /// Ex. __builtin_LINE, __builtin_FUNCTION, etc.
+    LLVM_PREFERRED_TYPE(SourceLocIdentKind)
     unsigned Kind : 3;
   };
 
@@ -614,6 +713,7 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class StmtExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// The number of levels of template parameters enclosing this statement
@@ -628,10 +728,12 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class CXXOperatorCallExpr;
 
+    LLVM_PREFERRED_TYPE(CallExprBitfields)
     unsigned : NumCallExprBits;
 
     /// The kind of this overloaded operator. One of the enumerator
     /// value of OverloadedOperatorKind.
+    LLVM_PREFERRED_TYPE(OverloadedOperatorKind)
     unsigned OperatorKind : 6;
   };
 
@@ -639,17 +741,21 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class CXXRewrittenBinaryOperator;
 
+    LLVM_PREFERRED_TYPE(CallExprBitfields)
     unsigned : NumCallExprBits;
 
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsReversed : 1;
   };
 
   class CXXBoolLiteralExprBitfields {
     friend class CXXBoolLiteralExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// The value of the boolean literal.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned Value : 1;
 
     /// The location of the boolean literal.
@@ -659,6 +765,7 @@ class alignas(void *) Stmt {
   class CXXNullPtrLiteralExprBitfields {
     friend class CXXNullPtrLiteralExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// The location of the null pointer literal.
@@ -668,9 +775,11 @@ class alignas(void *) Stmt {
   class CXXThisExprBitfields {
     friend class CXXThisExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// Whether this is an implicit "this".
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsImplicit : 1;
 
     /// The location of the "this".
@@ -681,9 +790,11 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class CXXThrowExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// Whether the thrown variable (if any) is in scope.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsThrownVariableInScope : 1;
 
     /// The location of the "throw".
@@ -694,9 +805,11 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class CXXDefaultArgExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// Whether this CXXDefaultArgExpr rewrote its argument and stores a copy.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasRewrittenInit : 1;
 
     /// The location where the default argument expression was used.
@@ -707,10 +820,12 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class CXXDefaultInitExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// Whether this CXXDefaultInitExprBitfields rewrote its argument and stores
     /// a copy.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasRewrittenInit : 1;
 
     /// The location where the default initializer expression was used.
@@ -721,6 +836,7 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class CXXScalarValueInitExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     SourceLocation RParenLoc;
@@ -731,28 +847,35 @@ class alignas(void *) Stmt {
     friend class ASTStmtWriter;
     friend class CXXNewExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// Was the usage ::new, i.e. is the global new to be used?
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsGlobalNew : 1;
 
     /// Do we allocate an array? If so, the first trailing "Stmt *" is the
     /// size expression.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsArray : 1;
 
     /// Should the alignment be passed to the allocation function?
+    LLVM_PREFERRED_TYPE(bool)
     unsigned ShouldPassAlignment : 1;
 
     /// If this is an array allocation, does the usual deallocation
     /// function for the allocated type want to know the allocated size?
+    LLVM_PREFERRED_TYPE(bool)
     unsigned UsualArrayDeleteWantsSize : 1;
 
     /// What kind of initializer do we have? Could be none, parens, or braces.
     /// In storage, we distinguish between "none, and no initializer expr", and
     /// "none, but an implicit initializer expr".
+    LLVM_PREFERRED_TYPE(CXXNewInitializationStyle)
     unsigned StoredInitializationStyle : 2;
 
     /// True if the allocated type was expressed as a parenthesized type-id.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsParenTypeId : 1;
 
     /// The number of placement new arguments.
@@ -763,21 +886,26 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class CXXDeleteExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// Is this a forced global delete, i.e. "::delete"?
+    LLVM_PREFERRED_TYPE(bool)
     unsigned GlobalDelete : 1;
 
     /// Is this the array form of delete, i.e. "delete[]"?
+    LLVM_PREFERRED_TYPE(bool)
     unsigned ArrayForm : 1;
 
     /// ArrayFormAsWritten can be 
diff erent from ArrayForm if 'delete' is
     /// applied to pointer-to-array type (ArrayFormAsWritten will be false
     /// while ArrayForm will be true).
+    LLVM_PREFERRED_TYPE(bool)
     unsigned ArrayFormAsWritten : 1;
 
     /// Does the usual deallocation function for the element type require
     /// a size_t argument?
+    LLVM_PREFERRED_TYPE(bool)
     unsigned UsualArrayDeleteWantsSize : 1;
 
     /// Location of the expression.
@@ -789,13 +917,16 @@ class alignas(void *) Stmt {
     friend class ASTStmtWriter;
     friend class TypeTraitExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// The kind of type trait, which is a value of a TypeTrait enumerator.
+    LLVM_PREFERRED_TYPE(TypeTrait)
     unsigned Kind : 8;
 
     /// If this expression is not value-dependent, this indicates whether
     /// the trait evaluated true or false.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned Value : 1;
 
     /// The number of arguments to this type trait. According to [implimits]
@@ -809,10 +940,12 @@ class alignas(void *) Stmt {
     friend class ASTStmtWriter;
     friend class DependentScopeDeclRefExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// Whether the name includes info for explicit template
     /// keyword and arguments.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasTemplateKWAndArgsInfo : 1;
   };
 
@@ -820,14 +953,22 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class CXXConstructExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
+    LLVM_PREFERRED_TYPE(bool)
     unsigned Elidable : 1;
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HadMultipleCandidates : 1;
+    LLVM_PREFERRED_TYPE(bool)
     unsigned ListInitialization : 1;
+    LLVM_PREFERRED_TYPE(bool)
     unsigned StdInitListInitialization : 1;
+    LLVM_PREFERRED_TYPE(bool)
     unsigned ZeroInitialization : 1;
+    LLVM_PREFERRED_TYPE(CXXConstructionKind)
     unsigned ConstructionKind : 3;
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsImmediateEscalating : 1;
 
     SourceLocation Loc;
@@ -837,9 +978,11 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader; // deserialization
     friend class ExprWithCleanups;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     // When false, it must not have side effects.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned CleanupsHaveSideEffects : 1;
 
     unsigned NumObjects : 32 - 1 - NumExprBits;
@@ -849,6 +992,7 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class CXXUnresolvedConstructExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// The number of arguments used to construct the type.
@@ -859,18 +1003,22 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class CXXDependentScopeMemberExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// Whether this member expression used the '->' operator or
     /// the '.' operator.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsArrow : 1;
 
     /// Whether this member expression has info for explicit template
     /// keyword and arguments.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasTemplateKWAndArgsInfo : 1;
 
     /// See getFirstQualifierFoundInScope() and the comment listing
     /// the trailing objects.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasFirstQualifierFoundInScope : 1;
 
     /// The location of the '->' or '.' operator.
@@ -881,10 +1029,12 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class OverloadExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// Whether the name includes info for explicit template
     /// keyword and arguments.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasTemplateKWAndArgsInfo : 1;
 
     /// Padding used by the derived classes to store various bits. If you
@@ -901,14 +1051,17 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class UnresolvedLookupExpr;
 
+    LLVM_PREFERRED_TYPE(OverloadExprBitfields)
     unsigned : NumOverloadExprBits;
 
     /// True if these lookup results should be extended by
     /// argument-dependent lookup if this is the operand of a function call.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned RequiresADL : 1;
 
     /// True if these lookup results are overloaded.  This is pretty trivially
     /// rederivable if we urgently need to kill this field.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned Overloaded : 1;
   };
   static_assert(sizeof(UnresolvedLookupExprBitfields) <= 4,
@@ -919,13 +1072,16 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class UnresolvedMemberExpr;
 
+    LLVM_PREFERRED_TYPE(OverloadExprBitfields)
     unsigned : NumOverloadExprBits;
 
     /// Whether this member expression used the '->' operator or
     /// the '.' operator.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsArrow : 1;
 
     /// Whether the lookup results contain an unresolved using declaration.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned HasUnresolvedUsing : 1;
   };
   static_assert(sizeof(UnresolvedMemberExprBitfields) <= 4,
@@ -936,8 +1092,10 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class CXXNoexceptExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
+    LLVM_PREFERRED_TYPE(bool)
     unsigned Value : 1;
   };
 
@@ -945,6 +1103,7 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class SubstNonTypeTemplateParmExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// The location of the non-type template parameter reference.
@@ -956,17 +1115,21 @@ class alignas(void *) Stmt {
     friend class ASTStmtWriter;
     friend class LambdaExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// The default capture kind, which is a value of type
     /// LambdaCaptureDefault.
+    LLVM_PREFERRED_TYPE(LambdaCaptureDefault)
     unsigned CaptureDefault : 2;
 
     /// Whether this lambda had an explicit parameter list vs. an
     /// implicit (and empty) parameter list.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned ExplicitParams : 1;
 
     /// Whether this lambda had the result type explicitly specified.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned ExplicitResultType : 1;
 
     /// The number of captures.
@@ -978,8 +1141,10 @@ class alignas(void *) Stmt {
     friend class ASTStmtWriter;
     friend class RequiresExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsSatisfied : 1;
     SourceLocation RequiresKWLoc;
   };
@@ -989,8 +1154,10 @@ class alignas(void *) Stmt {
   class CoawaitExprBitfields {
     friend class CoawaitExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsImplicit : 1;
   };
 
@@ -999,8 +1166,10 @@ class alignas(void *) Stmt {
   class ObjCIndirectCopyRestoreExprBitfields {
     friend class ObjCIndirectCopyRestoreExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
+    LLVM_PREFERRED_TYPE(bool)
     unsigned ShouldCopy : 1;
   };
 
@@ -1010,10 +1179,12 @@ class alignas(void *) Stmt {
     friend class ASTStmtReader;
     friend class OpaqueValueExpr;
 
+    LLVM_PREFERRED_TYPE(ExprBitfields)
     unsigned : NumExprBits;
 
     /// The OVE is a unique semantic reference to its source expression if this
     /// bit is set to true.
+    LLVM_PREFERRED_TYPE(bool)
     unsigned IsUnique : 1;
 
     SourceLocation Loc;


        


More information about the cfe-commits mailing list