summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriterStmt.cpp
diff options
context:
space:
mode:
authorBruno Ricci <riccibrun@gmail.com>2018-10-28 12:30:53 +0000
committerBruno Ricci <riccibrun@gmail.com>2018-10-28 12:30:53 +0000
commit5b30571753cef75c86c6bc11983a5a4e56d5c771 (patch)
treeee39db6bfdef844e9aef728b1b438c8af370cc6d /clang/lib/Serialization/ASTWriterStmt.cpp
parent299e9b8be09f4f4228406ff7598764e3d600fba0 (diff)
downloadbcm5719-llvm-5b30571753cef75c86c6bc11983a5a4e56d5c771.tar.gz
bcm5719-llvm-5b30571753cef75c86c6bc11983a5a4e56d5c771.zip
[AST] Don't store data for GNU range case statement if not needed
Don't store the data for case statements of the form LHS ... RHS if not needed. This cuts the size of CaseStmt by 1 pointer + 1 SourceLocation in the common case. Also use the newly available space in the bit-fields of Stmt to store the keyword location of SwitchCase and move the small accessor SwitchCase::getSubStmt to the header. Differential Revision: https://reviews.llvm.org/D53609 Reviewed By: rjmccall llvm-svn: 345472
Diffstat (limited to 'clang/lib/Serialization/ASTWriterStmt.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriterStmt.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp
index ef2e06a9411..3fce69142d3 100644
--- a/clang/lib/Serialization/ASTWriterStmt.cpp
+++ b/clang/lib/Serialization/ASTWriterStmt.cpp
@@ -96,10 +96,13 @@ void ASTStmtWriter::VisitSwitchCase(SwitchCase *S) {
void ASTStmtWriter::VisitCaseStmt(CaseStmt *S) {
VisitSwitchCase(S);
+ Record.push_back(S->caseStmtIsGNURange());
Record.AddStmt(S->getLHS());
- Record.AddStmt(S->getRHS());
Record.AddStmt(S->getSubStmt());
- Record.AddSourceLocation(S->getEllipsisLoc());
+ if (S->caseStmtIsGNURange()) {
+ Record.AddStmt(S->getRHS());
+ Record.AddSourceLocation(S->getEllipsisLoc());
+ }
Code = serialization::STMT_CASE;
}
OpenPOWER on IntegriCloud