diff options
author | Bruno Ricci <riccibrun@gmail.com> | 2018-11-16 16:56:49 +0000 |
---|---|---|
committer | Bruno Ricci <riccibrun@gmail.com> | 2018-11-16 16:56:49 +0000 |
commit | 7bc1ff9cdc351df69f324ea10345369ed49f4a60 (patch) | |
tree | 44eccc45544f00b924642181415d20408fee2f38 | |
parent | df9393fbe35a627fcd1b60a4268e969d9ee943d4 (diff) | |
download | bcm5719-llvm-7bc1ff9cdc351df69f324ea10345369ed49f4a60.tar.gz bcm5719-llvm-7bc1ff9cdc351df69f324ea10345369ed49f4a60.zip |
[AST][NFC] Pack CXXNullPtrLiteralExpr
Use the newly available space in the bit-fields of Stmt.
This saves one pointer per CXXNullPtrLiteralExpr.
llvm-svn: 347063
-rw-r--r-- | clang/include/clang/AST/ExprCXX.h | 17 | ||||
-rw-r--r-- | clang/include/clang/AST/Stmt.h | 10 |
2 files changed, 18 insertions, 9 deletions
diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h index ea070523468..1529551e336 100644 --- a/clang/include/clang/AST/ExprCXX.h +++ b/clang/include/clang/AST/ExprCXX.h @@ -582,22 +582,21 @@ public: /// /// Introduced in C++11, the only literal of type \c nullptr_t is \c nullptr. class CXXNullPtrLiteralExpr : public Expr { - SourceLocation Loc; - public: - CXXNullPtrLiteralExpr(QualType Ty, SourceLocation l) + CXXNullPtrLiteralExpr(QualType Ty, SourceLocation Loc) : Expr(CXXNullPtrLiteralExprClass, Ty, VK_RValue, OK_Ordinary, false, - false, false, false), - Loc(l) {} + false, false, false) { + CXXNullPtrLiteralExprBits.Loc = Loc; + } explicit CXXNullPtrLiteralExpr(EmptyShell Empty) : Expr(CXXNullPtrLiteralExprClass, Empty) {} - 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 CXXNullPtrLiteralExprBits.Loc; } + void setLocation(SourceLocation L) { CXXNullPtrLiteralExprBits.Loc = L; } static bool classof(const Stmt *T) { return T->getStmtClass() == CXXNullPtrLiteralExprClass; diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h index ad77c27e2ce..37616207c0e 100644 --- a/clang/include/clang/AST/Stmt.h +++ b/clang/include/clang/AST/Stmt.h @@ -514,6 +514,15 @@ protected: SourceLocation Loc; }; + class CXXNullPtrLiteralExprBitfields { + friend class CXXNullPtrLiteralExpr; + + unsigned : NumExprBits; + + /// The location of the null pointer literal. + SourceLocation Loc; + }; + class TypeTraitExprBitfields { friend class ASTStmtReader; friend class ASTStmtWriter; @@ -613,6 +622,7 @@ protected: // C++ Expressions CXXBoolLiteralExprBitfields CXXBoolLiteralExprBits; + CXXNullPtrLiteralExprBitfields CXXNullPtrLiteralExprBits; TypeTraitExprBitfields TypeTraitExprBits; ExprWithCleanupsBitfields ExprWithCleanupsBits; |