hokein created this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. hokein edited the summary of this revision.
The stmt bit-fields is full (max 64 bits) for BinaryOperator now, adding a new bit field (error) causes an 'static_assert(sizeof(*this) <=8)' violation in Stmt constructor. This patch unpacks the FPFeautres, make available bitfields for error bit (https://reviews.llvm.org/D65591). Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D75443 Files: clang/include/clang/AST/Expr.h clang/include/clang/AST/Stmt.h Index: clang/include/clang/AST/Stmt.h =================================================================== --- clang/include/clang/AST/Stmt.h +++ clang/include/clang/AST/Stmt.h @@ -531,10 +531,6 @@ unsigned Opc : 6; - /// This is only meaningful for operations on floating point - /// types and 0 otherwise. - unsigned FPFeatures : 8; - SourceLocation OpLoc; }; Index: clang/include/clang/AST/Expr.h =================================================================== --- clang/include/clang/AST/Expr.h +++ clang/include/clang/AST/Expr.h @@ -3439,7 +3439,9 @@ class BinaryOperator : public Expr { enum { LHS, RHS, END_EXPR }; Stmt *SubExprs[END_EXPR]; - + /// This is only meaningful for operations on floating point + /// types and 0 otherwise. + FPOptions FPFeatures; public: typedef BinaryOperatorKind Opcode; @@ -3452,9 +3454,9 @@ (lhs->isInstantiationDependent() || rhs->isInstantiationDependent()), (lhs->containsUnexpandedParameterPack() || - rhs->containsUnexpandedParameterPack())) { + rhs->containsUnexpandedParameterPack())), + FPFeatures(FPFeatures) { BinaryOperatorBits.Opc = opc; - BinaryOperatorBits.FPFeatures = FPFeatures.getInt(); BinaryOperatorBits.OpLoc = opLoc; SubExprs[LHS] = lhs; SubExprs[RHS] = rhs; @@ -3610,11 +3612,11 @@ // Set the FP contractability status of this operator. Only meaningful for // operations on floating point types. void setFPFeatures(FPOptions F) { - BinaryOperatorBits.FPFeatures = F.getInt(); + FPFeatures = F; } FPOptions getFPFeatures() const { - return FPOptions(BinaryOperatorBits.FPFeatures); + return FPFeatures; } // Get the FP contractability status of this operator. Only meaningful for @@ -3637,9 +3639,9 @@ (lhs->isInstantiationDependent() || rhs->isInstantiationDependent()), (lhs->containsUnexpandedParameterPack() || - rhs->containsUnexpandedParameterPack())) { + rhs->containsUnexpandedParameterPack())), + FPFeatures(FPFeatures) { BinaryOperatorBits.Opc = opc; - BinaryOperatorBits.FPFeatures = FPFeatures.getInt(); BinaryOperatorBits.OpLoc = opLoc; SubExprs[LHS] = lhs; SubExprs[RHS] = rhs;
Index: clang/include/clang/AST/Stmt.h =================================================================== --- clang/include/clang/AST/Stmt.h +++ clang/include/clang/AST/Stmt.h @@ -531,10 +531,6 @@ unsigned Opc : 6; - /// This is only meaningful for operations on floating point - /// types and 0 otherwise. - unsigned FPFeatures : 8; - SourceLocation OpLoc; }; Index: clang/include/clang/AST/Expr.h =================================================================== --- clang/include/clang/AST/Expr.h +++ clang/include/clang/AST/Expr.h @@ -3439,7 +3439,9 @@ class BinaryOperator : public Expr { enum { LHS, RHS, END_EXPR }; Stmt *SubExprs[END_EXPR]; - + /// This is only meaningful for operations on floating point + /// types and 0 otherwise. + FPOptions FPFeatures; public: typedef BinaryOperatorKind Opcode; @@ -3452,9 +3454,9 @@ (lhs->isInstantiationDependent() || rhs->isInstantiationDependent()), (lhs->containsUnexpandedParameterPack() || - rhs->containsUnexpandedParameterPack())) { + rhs->containsUnexpandedParameterPack())), + FPFeatures(FPFeatures) { BinaryOperatorBits.Opc = opc; - BinaryOperatorBits.FPFeatures = FPFeatures.getInt(); BinaryOperatorBits.OpLoc = opLoc; SubExprs[LHS] = lhs; SubExprs[RHS] = rhs; @@ -3610,11 +3612,11 @@ // Set the FP contractability status of this operator. Only meaningful for // operations on floating point types. void setFPFeatures(FPOptions F) { - BinaryOperatorBits.FPFeatures = F.getInt(); + FPFeatures = F; } FPOptions getFPFeatures() const { - return FPOptions(BinaryOperatorBits.FPFeatures); + return FPFeatures; } // Get the FP contractability status of this operator. Only meaningful for @@ -3637,9 +3639,9 @@ (lhs->isInstantiationDependent() || rhs->isInstantiationDependent()), (lhs->containsUnexpandedParameterPack() || - rhs->containsUnexpandedParameterPack())) { + rhs->containsUnexpandedParameterPack())), + FPFeatures(FPFeatures) { BinaryOperatorBits.Opc = opc; - BinaryOperatorBits.FPFeatures = FPFeatures.getInt(); BinaryOperatorBits.OpLoc = opLoc; SubExprs[LHS] = lhs; SubExprs[RHS] = rhs;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits