summaryrefslogtreecommitdiffstats
path: root/include/clang/AST/Expr.h
diff options
context:
space:
mode:
authorBruno Ricci <riccibrun@gmail.com>2018-11-20 16:03:33 +0000
committerBruno Ricci <riccibrun@gmail.com>2018-11-20 16:03:33 +0000
commitb03ce7b86b90fbdfd4f08e304f3f963ce9bfbe6f (patch)
tree0c245d85f0e84ef01a68451c4ae3b4e13528424f /include/clang/AST/Expr.h
parent20e1e29affefae82cbd2fd0c0306ce904ab87c33 (diff)
[AST][NFC] Pack ArraySubscriptExpr
Use the newly available space in the bit-fields of Stmt. This saves one pointer per ArraySubscriptExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347317 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/Expr.h')
-rw-r--r--include/clang/AST/Expr.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index 004631019c..fbf8bc4cf2 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -2315,9 +2315,9 @@ public:
/// ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
class ArraySubscriptExpr : public Expr {
- enum { LHS, RHS, END_EXPR=2 };
- Stmt* SubExprs[END_EXPR];
- SourceLocation RBracketLoc;
+ enum { LHS, RHS, END_EXPR };
+ Stmt *SubExprs[END_EXPR];
+
public:
ArraySubscriptExpr(Expr *lhs, Expr *rhs, QualType t,
ExprValueKind VK, ExprObjectKind OK,
@@ -2328,10 +2328,10 @@ public:
(lhs->isInstantiationDependent() ||
rhs->isInstantiationDependent()),
(lhs->containsUnexpandedParameterPack() ||
- rhs->containsUnexpandedParameterPack())),
- RBracketLoc(rbracketloc) {
+ rhs->containsUnexpandedParameterPack())) {
SubExprs[LHS] = lhs;
SubExprs[RHS] = rhs;
+ ArraySubscriptExprBits.RBracketLoc = rbracketloc;
}
/// Create an empty array subscript expression.
@@ -2374,10 +2374,14 @@ public:
SourceLocation getBeginLoc() const LLVM_READONLY {
return getLHS()->getBeginLoc();
}
- SourceLocation getEndLoc() const LLVM_READONLY { return RBracketLoc; }
+ SourceLocation getEndLoc() const { return getRBracketLoc(); }
- SourceLocation getRBracketLoc() const { return RBracketLoc; }
- void setRBracketLoc(SourceLocation L) { RBracketLoc = L; }
+ SourceLocation getRBracketLoc() const {
+ return ArraySubscriptExprBits.RBracketLoc;
+ }
+ void setRBracketLoc(SourceLocation L) {
+ ArraySubscriptExprBits.RBracketLoc = L;
+ }
SourceLocation getExprLoc() const LLVM_READONLY {
return getBase()->getExprLoc();