[clang] 5b9d793 - [clang][NFC] Annotate Expr-related headers with `preferred_type`

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 3 23:23:57 PDT 2023


Author: Vlad Serebrennikov
Date: 2023-11-04T09:23:50+03:00
New Revision: 5b9d793290c187aee4e63b61d4a12c3766f7cfe6

URL: https://github.com/llvm/llvm-project/commit/5b9d793290c187aee4e63b61d4a12c3766f7cfe6
DIFF: https://github.com/llvm/llvm-project/commit/5b9d793290c187aee4e63b61d4a12c3766f7cfe6.diff

LOG: [clang][NFC] Annotate Expr-related headers with `preferred_type`

Namely `Expr.h`, `ExprConcept.h`, `ExprCXX.h`, `ExprObjC.h`.

Added: 
    

Modified: 
    clang/include/clang/AST/Expr.h
    clang/include/clang/AST/ExprCXX.h
    clang/include/clang/AST/ExprConcepts.h
    clang/include/clang/AST/ExprObjC.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index 638f886edd095f1..87e80a5a37750ac 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -5114,6 +5114,7 @@ class DesignatedInitExpr final
 
   /// Whether this designated initializer used the GNU deprecated
   /// syntax rather than the C99 '=' syntax.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned GNUSyntax : 1;
 
   /// The number of designators in this initializer expression.
@@ -5745,6 +5746,7 @@ class GenericSelectionExpr final
   /// if and only if the generic selection expression is result-dependent.
   unsigned NumAssocs : 15;
   unsigned ResultIndex : 15; // NB: ResultDependentIndex is tied to this width.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned IsExprPredicate : 1;
   enum : unsigned {
     ResultDependentIndex = 0x7FFF

diff  --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h
index 798c98cfcf2d4db..020dcfd86ad67ea 100644
--- a/clang/include/clang/AST/ExprCXX.h
+++ b/clang/include/clang/AST/ExprCXX.h
@@ -1727,10 +1727,12 @@ class CXXInheritedCtorInitExpr : public Expr {
   SourceLocation Loc;
 
   /// Whether this is the construction of a virtual base.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned ConstructsVirtualBase : 1;
 
   /// Whether the constructor is inherited from a virtual base class of the
   /// class that we construct.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned InheritedFromVirtualBase : 1;
 
 public:
@@ -2610,6 +2612,7 @@ class CXXPseudoDestructorExpr : public Expr {
 
   /// Whether the operator was an arrow ('->'); otherwise, it was a
   /// period ('.').
+  LLVM_PREFERRED_TYPE(bool)
   bool IsArrow : 1;
 
   /// The location of the '.' or '->' operator.
@@ -2839,6 +2842,7 @@ class TypeTraitExpr final
 /// \endcode
 class ArrayTypeTraitExpr : public Expr {
   /// The trait. An ArrayTypeTrait enum in MSVC compat unsigned.
+  LLVM_PREFERRED_TYPE(ArrayTypeTrait)
   unsigned ATT : 2;
 
   /// The value of the type trait. Unspecified if dependent.
@@ -2909,9 +2913,11 @@ class ArrayTypeTraitExpr : public Expr {
 /// \endcode
 class ExpressionTraitExpr : public Expr {
   /// The trait. A ExpressionTrait enum in MSVC compatible unsigned.
+  LLVM_PREFERRED_TYPE(ExpressionTrait)
   unsigned ET : 31;
 
   /// The value of the type trait. Unspecified if dependent.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned Value : 1;
 
   /// The location of the type trait keyword.

diff  --git a/clang/include/clang/AST/ExprConcepts.h b/clang/include/clang/AST/ExprConcepts.h
index 4f34799bad05021..29913fd84c58b4d 100644
--- a/clang/include/clang/AST/ExprConcepts.h
+++ b/clang/include/clang/AST/ExprConcepts.h
@@ -173,8 +173,11 @@ class Requirement {
 private:
   const RequirementKind Kind;
   // FIXME: use RequirementDependence to model dependence?
+  LLVM_PREFERRED_TYPE(bool)
   bool Dependent : 1;
+  LLVM_PREFERRED_TYPE(bool)
   bool ContainsUnexpandedParameterPack : 1;
+  LLVM_PREFERRED_TYPE(bool)
   bool Satisfied : 1;
 public:
   struct SubstitutionDiagnostic {

diff  --git a/clang/include/clang/AST/ExprObjC.h b/clang/include/clang/AST/ExprObjC.h
index 55bb5fa06b8b7ab..f833916c91aa544 100644
--- a/clang/include/clang/AST/ExprObjC.h
+++ b/clang/include/clang/AST/ExprObjC.h
@@ -317,6 +317,7 @@ class ObjCDictionaryLiteral final
   /// key/value pairs, which provide the locations of the ellipses (if
   /// any) and number of elements in the expansion (if known). If
   /// there are no pack expansions, we optimize away this storage.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned HasPackExpansions : 1;
 
   SourceRange Range;
@@ -554,9 +555,11 @@ class ObjCIvarRefExpr : public Expr {
   SourceLocation OpLoc;
 
   // True if this is "X->F", false if this is "X.F".
+  LLVM_PREFERRED_TYPE(bool)
   bool IsArrow : 1;
 
   // True if ivar reference has no base (self assumed).
+  LLVM_PREFERRED_TYPE(bool)
   bool IsFreeIvar : 1;
 
 public:
@@ -940,6 +943,23 @@ class ObjCSubscriptRefExpr : public Expr {
 class ObjCMessageExpr final
     : public Expr,
       private llvm::TrailingObjects<ObjCMessageExpr, void *, SourceLocation> {
+public:
+  /// The kind of receiver this message is sending to.
+  enum ReceiverKind {
+    /// The receiver is a class.
+    Class = 0,
+
+    /// The receiver is an object instance.
+    Instance,
+
+    /// The receiver is a superclass.
+    SuperClass,
+
+    /// The receiver is the instance of the superclass object.
+    SuperInstance
+  };
+
+private:
   /// Stores either the selector that this message is sending
   /// to (when \c HasMethod is zero) or an \c ObjCMethodDecl pointer
   /// referring to the method that we type-checked against.
@@ -955,6 +975,7 @@ class ObjCMessageExpr final
   /// ReceiverKind values.
   ///
   /// We pad this out to a byte to avoid excessive masking and shifting.
+  LLVM_PREFERRED_TYPE(ReceiverKind)
   unsigned Kind : 8;
 
   /// Whether we have an actual method prototype in \c
@@ -962,18 +983,22 @@ class ObjCMessageExpr final
   ///
   /// When non-zero, we have a method declaration; otherwise, we just
   /// have a selector.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned HasMethod : 1;
 
   /// Whether this message send is a "delegate init call",
   /// i.e. a call of an init method on self from within an init method.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned IsDelegateInitCall : 1;
 
   /// Whether this message send was implicitly generated by
   /// the implementation rather than explicitly written by the user.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned IsImplicit : 1;
 
   /// Whether the locations of the selector identifiers are in a
   /// "standard" position, a enum SelectorLocationsKind.
+  LLVM_PREFERRED_TYPE(SelectorLocationsKind)
   unsigned SelLocsKind : 2;
 
   /// When the message expression is a send to 'super', this is
@@ -1082,21 +1107,6 @@ class ObjCMessageExpr final
   friend class ASTStmtWriter;
   friend TrailingObjects;
 
-  /// The kind of receiver this message is sending to.
-  enum ReceiverKind {
-    /// The receiver is a class.
-    Class = 0,
-
-    /// The receiver is an object instance.
-    Instance,
-
-    /// The receiver is a superclass.
-    SuperClass,
-
-    /// The receiver is the instance of the superclass object.
-    SuperInstance
-  };
-
   /// Create a message send to super.
   ///
   /// \param Context The ASTContext in which this expression will be created.
@@ -1631,6 +1641,7 @@ class ObjCBridgedCastExpr final
 
   SourceLocation LParenLoc;
   SourceLocation BridgeKeywordLoc;
+  LLVM_PREFERRED_TYPE(ObjCBridgeCastKind)
   unsigned Kind : 2;
 
 public:


        


More information about the cfe-commits mailing list