Skip to content

Commit

Permalink
[clang][NFC] Annotate Expr-related headers with preferred_type
Browse files Browse the repository at this point in the history
Namely `Expr.h`, `ExprConcept.h`, `ExprCXX.h`, `ExprObjC.h`.
  • Loading branch information
Endilll committed Nov 4, 2023
1 parent c4b2d33 commit 5b9d793
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 15 deletions.
2 changes: 2 additions & 0 deletions clang/include/clang/AST/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions clang/include/clang/AST/ExprCXX.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions clang/include/clang/AST/ExprConcepts.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
41 changes: 26 additions & 15 deletions clang/include/clang/AST/ExprObjC.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand All @@ -955,25 +975,30 @@ 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
/// SelectorOrMethod.
///
/// 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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -1631,6 +1641,7 @@ class ObjCBridgedCastExpr final

SourceLocation LParenLoc;
SourceLocation BridgeKeywordLoc;
LLVM_PREFERRED_TYPE(ObjCBridgeCastKind)
unsigned Kind : 2;

public:
Expand Down

0 comments on commit 5b9d793

Please sign in to comment.