@@ -3187,20 +3187,11 @@ class CStyleCastExpr final
3187
3187
// / "+" resolves to an overloaded operator, CXXOperatorCallExpr will
3188
3188
// / be used to express the computation.
3189
3189
class BinaryOperator : public Expr {
3190
- public:
3191
- typedef BinaryOperatorKind Opcode;
3192
-
3193
- private:
3194
- unsigned Opc : 6 ;
3195
-
3196
- // This is only meaningful for operations on floating point types and 0
3197
- // otherwise.
3198
- unsigned FPFeatures : 3 ;
3199
- SourceLocation OpLoc;
3200
-
3201
3190
enum { LHS, RHS, END_EXPR };
3202
- Stmt* SubExprs[END_EXPR];
3191
+ Stmt *SubExprs[END_EXPR];
3192
+
3203
3193
public:
3194
+ typedef BinaryOperatorKind Opcode;
3204
3195
3205
3196
BinaryOperator (Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy,
3206
3197
ExprValueKind VK, ExprObjectKind OK,
@@ -3211,24 +3202,29 @@ class BinaryOperator : public Expr {
3211
3202
(lhs->isInstantiationDependent () ||
3212
3203
rhs->isInstantiationDependent()),
3213
3204
(lhs->containsUnexpandedParameterPack () ||
3214
- rhs->containsUnexpandedParameterPack())),
3215
- Opc(opc), FPFeatures(FPFeatures.getInt()), OpLoc(opLoc) {
3205
+ rhs->containsUnexpandedParameterPack())) {
3206
+ BinaryOperatorBits.Opc = opc;
3207
+ BinaryOperatorBits.FPFeatures = FPFeatures.getInt ();
3208
+ BinaryOperatorBits.OpLoc = opLoc;
3216
3209
SubExprs[LHS] = lhs;
3217
3210
SubExprs[RHS] = rhs;
3218
3211
assert (!isCompoundAssignmentOp () &&
3219
3212
" Use CompoundAssignOperator for compound assignments" );
3220
3213
}
3221
3214
3222
3215
// / Construct an empty binary operator.
3223
- explicit BinaryOperator (EmptyShell Empty)
3224
- : Expr(BinaryOperatorClass, Empty), Opc(BO_Comma) { }
3216
+ explicit BinaryOperator (EmptyShell Empty) : Expr(BinaryOperatorClass, Empty) {
3217
+ BinaryOperatorBits.Opc = BO_Comma;
3218
+ }
3225
3219
3226
- SourceLocation getExprLoc () const LLVM_READONLY { return OpLoc ; }
3227
- SourceLocation getOperatorLoc () const { return OpLoc; }
3228
- void setOperatorLoc (SourceLocation L) { OpLoc = L; }
3220
+ SourceLocation getExprLoc () const { return getOperatorLoc () ; }
3221
+ SourceLocation getOperatorLoc () const { return BinaryOperatorBits. OpLoc ; }
3222
+ void setOperatorLoc (SourceLocation L) { BinaryOperatorBits. OpLoc = L; }
3229
3223
3230
- Opcode getOpcode () const { return static_cast <Opcode>(Opc); }
3231
- void setOpcode (Opcode O) { Opc = O; }
3224
+ Opcode getOpcode () const {
3225
+ return static_cast <Opcode>(BinaryOperatorBits.Opc );
3226
+ }
3227
+ void setOpcode (Opcode Opc) { BinaryOperatorBits.Opc = Opc; }
3232
3228
3233
3229
Expr *getLHS () const { return cast<Expr>(SubExprs[LHS]); }
3234
3230
void setLHS (Expr *E) { SubExprs[LHS] = E; }
@@ -3257,7 +3253,11 @@ class BinaryOperator : public Expr {
3257
3253
static OverloadedOperatorKind getOverloadedOperator (Opcode Opc);
3258
3254
3259
3255
// / predicates to categorize the respective opcodes.
3260
- bool isPtrMemOp () const { return Opc == BO_PtrMemD || Opc == BO_PtrMemI; }
3256
+ static bool isPtrMemOp (Opcode Opc) {
3257
+ return Opc == BO_PtrMemD || Opc == BO_PtrMemI;
3258
+ }
3259
+ bool isPtrMemOp () const { return isPtrMemOp (getOpcode ()); }
3260
+
3261
3261
static bool isMultiplicativeOp (Opcode Opc) {
3262
3262
return Opc >= BO_Mul && Opc <= BO_Rem;
3263
3263
}
@@ -3356,21 +3356,23 @@ class BinaryOperator : public Expr {
3356
3356
3357
3357
// Set the FP contractability status of this operator. Only meaningful for
3358
3358
// operations on floating point types.
3359
- void setFPFeatures (FPOptions F) { FPFeatures = F.getInt (); }
3359
+ void setFPFeatures (FPOptions F) {
3360
+ BinaryOperatorBits.FPFeatures = F.getInt ();
3361
+ }
3360
3362
3361
- FPOptions getFPFeatures () const { return FPOptions (FPFeatures); }
3363
+ FPOptions getFPFeatures () const {
3364
+ return FPOptions (BinaryOperatorBits.FPFeatures );
3365
+ }
3362
3366
3363
3367
// Get the FP contractability status of this operator. Only meaningful for
3364
3368
// operations on floating point types.
3365
3369
bool isFPContractableWithinStatement () const {
3366
- return FPOptions (FPFeatures ).allowFPContractWithinStatement ();
3370
+ return getFPFeatures ( ).allowFPContractWithinStatement ();
3367
3371
}
3368
3372
3369
3373
// Get the FENV_ACCESS status of this operator. Only meaningful for
3370
3374
// operations on floating point types.
3371
- bool isFEnvAccessOn () const {
3372
- return FPOptions (FPFeatures).allowFEnvAccess ();
3373
- }
3375
+ bool isFEnvAccessOn () const { return getFPFeatures ().allowFEnvAccess (); }
3374
3376
3375
3377
protected:
3376
3378
BinaryOperator (Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy,
@@ -3382,14 +3384,17 @@ class BinaryOperator : public Expr {
3382
3384
(lhs->isInstantiationDependent () ||
3383
3385
rhs->isInstantiationDependent()),
3384
3386
(lhs->containsUnexpandedParameterPack () ||
3385
- rhs->containsUnexpandedParameterPack())),
3386
- Opc(opc), FPFeatures(FPFeatures.getInt()), OpLoc(opLoc) {
3387
+ rhs->containsUnexpandedParameterPack())) {
3388
+ BinaryOperatorBits.Opc = opc;
3389
+ BinaryOperatorBits.FPFeatures = FPFeatures.getInt ();
3390
+ BinaryOperatorBits.OpLoc = opLoc;
3387
3391
SubExprs[LHS] = lhs;
3388
3392
SubExprs[RHS] = rhs;
3389
3393
}
3390
3394
3391
- BinaryOperator (StmtClass SC, EmptyShell Empty)
3392
- : Expr(SC, Empty), Opc(BO_MulAssign) { }
3395
+ BinaryOperator (StmtClass SC, EmptyShell Empty) : Expr(SC, Empty) {
3396
+ BinaryOperatorBits.Opc = BO_MulAssign;
3397
+ }
3393
3398
};
3394
3399
3395
3400
// / CompoundAssignOperator - For compound assignments (e.g. +=), we keep
0 commit comments