summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTDumper.cpp
diff options
context:
space:
mode:
authorBruno Ricci <riccibrun@gmail.com>2018-10-29 16:12:37 +0000
committerBruno Ricci <riccibrun@gmail.com>2018-10-29 16:12:37 +0000
commite2806f857b772d2f15b39e95685a1c99bdb8aaa7 (patch)
treea5a238a0c54b7ebf90eb52a514b0780a270f6000 /clang/lib/AST/ASTDumper.cpp
parente92567601b4b457d7f68a31ee21d2c2769c8de3b (diff)
downloadbcm5719-llvm-e2806f857b772d2f15b39e95685a1c99bdb8aaa7.tar.gz
bcm5719-llvm-e2806f857b772d2f15b39e95685a1c99bdb8aaa7.zip
[AST] Only store the needed data in SwitchStmt
Don't store the data for the init statement and condition variable if not needed. This cuts the size of SwitchStmt by up to 2 pointers. The order of the children is intentionally kept the same. Also use the newly available space in the bit-fields of Stmt to store the bit representing whether all enums have been covered instead of using a PointerIntPair. Differential Revision: https://reviews.llvm.org/D53714 Reviewed By: rjmccall llvm-svn: 345510
Diffstat (limited to 'clang/lib/AST/ASTDumper.cpp')
-rw-r--r--clang/lib/AST/ASTDumper.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp
index 3c4a9ea398b..99524e88937 100644
--- a/clang/lib/AST/ASTDumper.cpp
+++ b/clang/lib/AST/ASTDumper.cpp
@@ -512,6 +512,7 @@ namespace {
void VisitDeclStmt(const DeclStmt *Node);
void VisitAttributedStmt(const AttributedStmt *Node);
void VisitIfStmt(const IfStmt *Node);
+ void VisitSwitchStmt(const SwitchStmt *Node);
void VisitLabelStmt(const LabelStmt *Node);
void VisitGotoStmt(const GotoStmt *Node);
void VisitCXXCatchStmt(const CXXCatchStmt *Node);
@@ -2032,6 +2033,14 @@ void ASTDumper::VisitIfStmt(const IfStmt *Node) {
OS << " has_else";
}
+void ASTDumper::VisitSwitchStmt(const SwitchStmt *Node) {
+ VisitStmt(Node);
+ if (Node->hasInitStorage())
+ OS << " has_init";
+ if (Node->hasVarStorage())
+ OS << " has_var";
+}
+
void ASTDumper::VisitLabelStmt(const LabelStmt *Node) {
VisitStmt(Node);
OS << " '" << Node->getName() << "'";
OpenPOWER on IntegriCloud