diff options
author | Bruno Ricci <riccibrun@gmail.com> | 2018-10-28 12:30:53 +0000 |
---|---|---|
committer | Bruno Ricci <riccibrun@gmail.com> | 2018-10-28 12:30:53 +0000 |
commit | 5b30571753cef75c86c6bc11983a5a4e56d5c771 (patch) | |
tree | ee39db6bfdef844e9aef728b1b438c8af370cc6d /clang/lib/Sema/SemaStmt.cpp | |
parent | 299e9b8be09f4f4228406ff7598764e3d600fba0 (diff) | |
download | bcm5719-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/Sema/SemaStmt.cpp')
-rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 14218bf9473..67b5a84caf3 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -462,8 +462,8 @@ Sema::ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHSVal, return StmtError(); } - CaseStmt *CS = new (Context) - CaseStmt(LHSVal.get(), RHSVal.get(), CaseLoc, DotDotDotLoc, ColonLoc); + auto *CS = CaseStmt::Create(Context, LHSVal.get(), RHSVal.get(), + CaseLoc, DotDotDotLoc, ColonLoc); getCurFunction()->SwitchStack.back().getPointer()->addSwitchCase(CS); return CS; } @@ -472,7 +472,7 @@ Sema::ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHSVal, void Sema::ActOnCaseStmtBody(Stmt *caseStmt, Stmt *SubStmt) { DiagnoseUnusedExprResult(SubStmt); - CaseStmt *CS = static_cast<CaseStmt*>(caseStmt); + auto *CS = static_cast<CaseStmt *>(caseStmt); CS->setSubStmt(SubStmt); } |