@@ -2118,21 +2118,21 @@ class ParenExpr : public Expr {
2118
2118
// /
2119
2119
class UnaryOperator final
2120
2120
: public Expr,
2121
- private llvm::TrailingObjects<UnaryOperator, FPOptions > {
2121
+ private llvm::TrailingObjects<UnaryOperator, FPOptionsOverride > {
2122
2122
Stmt *Val;
2123
2123
2124
- size_t numTrailingObjects (OverloadToken<FPOptions >) const {
2124
+ size_t numTrailingObjects (OverloadToken<FPOptionsOverride >) const {
2125
2125
return UnaryOperatorBits.HasFPFeatures ? 1 : 0 ;
2126
2126
}
2127
2127
2128
- FPOptions &getTrailingFPFeatures () {
2128
+ FPOptionsOverride &getTrailingFPFeatures () {
2129
2129
assert (UnaryOperatorBits.HasFPFeatures );
2130
- return *getTrailingObjects<FPOptions >();
2130
+ return *getTrailingObjects<FPOptionsOverride >();
2131
2131
}
2132
2132
2133
- const FPOptions &getTrailingFPFeatures () const {
2133
+ const FPOptionsOverride &getTrailingFPFeatures () const {
2134
2134
assert (UnaryOperatorBits.HasFPFeatures );
2135
- return *getTrailingObjects<FPOptions >();
2135
+ return *getTrailingObjects<FPOptionsOverride >();
2136
2136
}
2137
2137
2138
2138
public:
@@ -2141,7 +2141,7 @@ class UnaryOperator final
2141
2141
protected:
2142
2142
UnaryOperator (const ASTContext &Ctx, Expr *input, Opcode opc, QualType type,
2143
2143
ExprValueKind VK, ExprObjectKind OK, SourceLocation l,
2144
- bool CanOverflow, FPOptions FPFeatures);
2144
+ bool CanOverflow, FPOptionsOverride FPFeatures);
2145
2145
2146
2146
// / Build an empty unary operator.
2147
2147
explicit UnaryOperator (bool HasFPFeatures, EmptyShell Empty)
@@ -2156,7 +2156,7 @@ class UnaryOperator final
2156
2156
static UnaryOperator *Create (const ASTContext &C, Expr *input, Opcode opc,
2157
2157
QualType type, ExprValueKind VK,
2158
2158
ExprObjectKind OK, SourceLocation l,
2159
- bool CanOverflow, FPOptions FPFeatures);
2159
+ bool CanOverflow, FPOptionsOverride FPFeatures);
2160
2160
2161
2161
Opcode getOpcode () const {
2162
2162
return static_cast <Opcode>(UnaryOperatorBits.Opc );
@@ -2182,13 +2182,13 @@ class UnaryOperator final
2182
2182
// Get the FP contractability status of this operator. Only meaningful for
2183
2183
// operations on floating point types.
2184
2184
bool isFPContractableWithinStatement (const LangOptions &LO) const {
2185
- return getFPFeatures (LO).allowFPContractWithinStatement ();
2185
+ return getFPFeaturesInEffect (LO).allowFPContractWithinStatement ();
2186
2186
}
2187
2187
2188
2188
// Get the FENV_ACCESS status of this operator. Only meaningful for
2189
2189
// operations on floating point types.
2190
2190
bool isFEnvAccessOn (const LangOptions &LO) const {
2191
- return getFPFeatures (LO).allowFEnvAccess ();
2191
+ return getFPFeaturesInEffect (LO).getAllowFEnvAccess ();
2192
2192
}
2193
2193
2194
2194
// / isPostfix - Return true if this is a postfix operation, like x++.
@@ -2263,19 +2263,26 @@ class UnaryOperator final
2263
2263
2264
2264
protected:
2265
2265
// / Get FPFeatures from trailing storage
2266
- FPOptions getStoredFPFeatures () const { return getTrailingFPFeatures (); }
2266
+ FPOptionsOverride getStoredFPFeatures () const {
2267
+ return getTrailingFPFeatures ();
2268
+ }
2267
2269
2268
2270
// / Set FPFeatures in trailing storage, used only by Serialization
2269
- void setStoredFPFeatures (FPOptions F) { getTrailingFPFeatures () = F; }
2271
+ void setStoredFPFeatures (FPOptionsOverride F) { getTrailingFPFeatures () = F; }
2270
2272
2271
2273
public:
2272
2274
// Get the FP features status of this operator. Only meaningful for
2273
2275
// operations on floating point types.
2274
- FPOptions getFPFeatures (const LangOptions &LO) const {
2276
+ FPOptions getFPFeaturesInEffect (const LangOptions &LO) const {
2275
2277
if (UnaryOperatorBits.HasFPFeatures )
2276
- return getStoredFPFeatures ();
2278
+ return getStoredFPFeatures (). applyOverrides (LO) ;
2277
2279
return FPOptions::defaultWithoutTrailingStorage (LO);
2278
2280
}
2281
+ FPOptionsOverride getFPOptionsOverride () const {
2282
+ if (UnaryOperatorBits.HasFPFeatures )
2283
+ return getStoredFPFeatures ();
2284
+ return FPOptionsOverride ();
2285
+ }
2279
2286
2280
2287
friend TrailingObjects;
2281
2288
friend class ASTReader ;
@@ -3633,22 +3640,22 @@ class BinaryOperator : public Expr {
3633
3640
size_t offsetOfTrailingStorage () const ;
3634
3641
3635
3642
// / Return a pointer to the trailing FPOptions
3636
- FPOptions *getTrailingFPFeatures () {
3643
+ FPOptionsOverride *getTrailingFPFeatures () {
3637
3644
assert (BinaryOperatorBits.HasFPFeatures );
3638
- return reinterpret_cast <FPOptions *>(reinterpret_cast < char *>( this ) +
3639
- offsetOfTrailingStorage ());
3645
+ return reinterpret_cast <FPOptionsOverride *>(
3646
+ reinterpret_cast < char *>( this ) + offsetOfTrailingStorage ());
3640
3647
}
3641
- const FPOptions *getTrailingFPFeatures () const {
3648
+ const FPOptionsOverride *getTrailingFPFeatures () const {
3642
3649
assert (BinaryOperatorBits.HasFPFeatures );
3643
- return reinterpret_cast <const FPOptions *>(
3650
+ return reinterpret_cast <const FPOptionsOverride *>(
3644
3651
reinterpret_cast <const char *>(this ) + offsetOfTrailingStorage ());
3645
3652
}
3646
3653
3647
3654
// / Build a binary operator, assuming that appropriate storage has been
3648
3655
// / allocated for the trailing objects when needed.
3649
3656
BinaryOperator (const ASTContext &Ctx, Expr *lhs, Expr *rhs, Opcode opc,
3650
3657
QualType ResTy, ExprValueKind VK, ExprObjectKind OK,
3651
- SourceLocation opLoc, FPOptions FPFeatures);
3658
+ SourceLocation opLoc, FPOptionsOverride FPFeatures);
3652
3659
3653
3660
// / Construct an empty binary operator.
3654
3661
explicit BinaryOperator (EmptyShell Empty) : Expr(BinaryOperatorClass, Empty) {
@@ -3661,7 +3668,7 @@ class BinaryOperator : public Expr {
3661
3668
static BinaryOperator *Create (const ASTContext &C, Expr *lhs, Expr *rhs,
3662
3669
Opcode opc, QualType ResTy, ExprValueKind VK,
3663
3670
ExprObjectKind OK, SourceLocation opLoc,
3664
- FPOptions FPFeatures);
3671
+ FPOptionsOverride FPFeatures);
3665
3672
SourceLocation getExprLoc () const { return getOperatorLoc (); }
3666
3673
SourceLocation getOperatorLoc () const { return BinaryOperatorBits.OpLoc ; }
3667
3674
void setOperatorLoc (SourceLocation L) { BinaryOperatorBits.OpLoc = L; }
@@ -3808,40 +3815,48 @@ class BinaryOperator : public Expr {
3808
3815
bool hasStoredFPFeatures () const { return BinaryOperatorBits.HasFPFeatures ; }
3809
3816
3810
3817
// / Get FPFeatures from trailing storage
3811
- FPOptions getStoredFPFeatures () const {
3818
+ FPOptionsOverride getStoredFPFeatures () const {
3812
3819
assert (hasStoredFPFeatures ());
3813
3820
return *getTrailingFPFeatures ();
3814
3821
}
3815
3822
// / Set FPFeatures in trailing storage, used only by Serialization
3816
- void setStoredFPFeatures (FPOptions F) {
3823
+ void setStoredFPFeatures (FPOptionsOverride F) {
3817
3824
assert (BinaryOperatorBits.HasFPFeatures );
3818
3825
*getTrailingFPFeatures () = F;
3819
3826
}
3820
3827
3821
3828
// Get the FP features status of this operator. Only meaningful for
3822
3829
// operations on floating point types.
3823
- FPOptions getFPFeatures (const LangOptions &LO) const {
3830
+ FPOptions getFPFeaturesInEffect (const LangOptions &LO) const {
3824
3831
if (BinaryOperatorBits.HasFPFeatures )
3825
- return getStoredFPFeatures ();
3832
+ return getStoredFPFeatures (). applyOverrides (LO) ;
3826
3833
return FPOptions::defaultWithoutTrailingStorage (LO);
3827
3834
}
3828
3835
3836
+ // This is used in ASTImporter
3837
+ FPOptionsOverride getFPFeatures (const LangOptions &LO) const {
3838
+ if (BinaryOperatorBits.HasFPFeatures )
3839
+ return getStoredFPFeatures ();
3840
+ return FPOptionsOverride ();
3841
+ }
3842
+
3829
3843
// Get the FP contractability status of this operator. Only meaningful for
3830
3844
// operations on floating point types.
3831
3845
bool isFPContractableWithinStatement (const LangOptions &LO) const {
3832
- return getFPFeatures (LO).allowFPContractWithinStatement ();
3846
+ return getFPFeaturesInEffect (LO).allowFPContractWithinStatement ();
3833
3847
}
3834
3848
3835
3849
// Get the FENV_ACCESS status of this operator. Only meaningful for
3836
3850
// operations on floating point types.
3837
3851
bool isFEnvAccessOn (const LangOptions &LO) const {
3838
- return getFPFeatures (LO).allowFEnvAccess ();
3852
+ return getFPFeaturesInEffect (LO).getAllowFEnvAccess ();
3839
3853
}
3840
3854
3841
3855
protected:
3842
3856
BinaryOperator (const ASTContext &Ctx, Expr *lhs, Expr *rhs, Opcode opc,
3843
3857
QualType ResTy, ExprValueKind VK, ExprObjectKind OK,
3844
- SourceLocation opLoc, FPOptions FPFeatures, bool dead2);
3858
+ SourceLocation opLoc, FPOptionsOverride FPFeatures,
3859
+ bool dead2);
3845
3860
3846
3861
// / Construct an empty BinaryOperator, SC is CompoundAssignOperator.
3847
3862
BinaryOperator (StmtClass SC, EmptyShell Empty) : Expr(SC, Empty) {
@@ -3851,7 +3866,7 @@ class BinaryOperator : public Expr {
3851
3866
// / Return the size in bytes needed for the trailing objects.
3852
3867
// / Used to allocate the right amount of storage.
3853
3868
static unsigned sizeOfTrailingObjects (bool HasFPFeatures) {
3854
- return HasFPFeatures * sizeof (FPOptions );
3869
+ return HasFPFeatures * sizeof (FPOptionsOverride );
3855
3870
}
3856
3871
};
3857
3872
@@ -3873,7 +3888,7 @@ class CompoundAssignOperator : public BinaryOperator {
3873
3888
protected:
3874
3889
CompoundAssignOperator (const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc,
3875
3890
QualType ResType, ExprValueKind VK, ExprObjectKind OK,
3876
- SourceLocation OpLoc, FPOptions FPFeatures,
3891
+ SourceLocation OpLoc, FPOptionsOverride FPFeatures,
3877
3892
QualType CompLHSType, QualType CompResultType)
3878
3893
: BinaryOperator(C, lhs, rhs, opc, ResType, VK, OK, OpLoc, FPFeatures,
3879
3894
true ),
@@ -3889,7 +3904,7 @@ class CompoundAssignOperator : public BinaryOperator {
3889
3904
static CompoundAssignOperator *
3890
3905
Create (const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy,
3891
3906
ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc,
3892
- FPOptions FPFeatures, QualType CompLHSType = QualType(),
3907
+ FPOptionsOverride FPFeatures, QualType CompLHSType = QualType(),
3893
3908
QualType CompResultType = QualType());
3894
3909
3895
3910
// The two computation types are the type the LHS is converted
0 commit comments