[AST][NFC] Pack CXXBoolLiteralExpr

Use the newly available space in Stmt.
This saves 8 bytes per CXXBoolLiteralExpr.

llvm-svn: 347062
This commit is contained in:
Bruno Ricci 2018-11-16 16:54:17 +00:00
parent fec48be329
commit df9393fbe3
2 changed files with 24 additions and 12 deletions

View File

@ -548,26 +548,25 @@ public:
/// A boolean literal, per ([C++ lex.bool] Boolean literals).
class CXXBoolLiteralExpr : public Expr {
bool Value;
SourceLocation Loc;
public:
CXXBoolLiteralExpr(bool val, QualType Ty, SourceLocation l)
CXXBoolLiteralExpr(bool Val, QualType Ty, SourceLocation Loc)
: Expr(CXXBoolLiteralExprClass, Ty, VK_RValue, OK_Ordinary, false, false,
false, false),
Value(val), Loc(l) {}
false, false) {
CXXBoolLiteralExprBits.Value = Val;
CXXBoolLiteralExprBits.Loc = Loc;
}
explicit CXXBoolLiteralExpr(EmptyShell Empty)
: Expr(CXXBoolLiteralExprClass, Empty) {}
bool getValue() const { return Value; }
void setValue(bool V) { Value = V; }
bool getValue() const { return CXXBoolLiteralExprBits.Value; }
void setValue(bool V) { CXXBoolLiteralExprBits.Value = V; }
SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
SourceLocation getBeginLoc() const { return getLocation(); }
SourceLocation getEndLoc() const { return getLocation(); }
SourceLocation getLocation() const { return Loc; }
void setLocation(SourceLocation L) { Loc = L; }
SourceLocation getLocation() const { return CXXBoolLiteralExprBits.Loc; }
void setLocation(SourceLocation L) { CXXBoolLiteralExprBits.Loc = L; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXBoolLiteralExprClass;

View File

@ -502,6 +502,18 @@ protected:
//===--- C++ Expression bitfields classes ---===//
class CXXBoolLiteralExprBitfields {
friend class CXXBoolLiteralExpr;
unsigned : NumExprBits;
/// The value of the boolean literal.
unsigned Value : 1;
/// The location of the boolean literal.
SourceLocation Loc;
};
class TypeTraitExprBitfields {
friend class ASTStmtReader;
friend class ASTStmtWriter;
@ -600,6 +612,7 @@ protected:
PseudoObjectExprBitfields PseudoObjectExprBits;
// C++ Expressions
CXXBoolLiteralExprBitfields CXXBoolLiteralExprBits;
TypeTraitExprBitfields TypeTraitExprBits;
ExprWithCleanupsBitfields ExprWithCleanupsBits;