Cleaned up ref counting destructor visitor
Change-Id: Ib796dc6d6093b62b2420eeca21dbb80f35ed2c00
diff --git a/slang_rs_object_ref_count.cpp b/slang_rs_object_ref_count.cpp
index 200b616..e911395 100644
--- a/slang_rs_object_ref_count.cpp
+++ b/slang_rs_object_ref_count.cpp
@@ -248,17 +248,12 @@
}
void VisitStmt(clang::Stmt *S);
- void VisitCompoundStmt(clang::CompoundStmt *CS);
void VisitBreakStmt(clang::BreakStmt *BS);
- void VisitCaseStmt(clang::CaseStmt *CS);
void VisitContinueStmt(clang::ContinueStmt *CS);
- void VisitDefaultStmt(clang::DefaultStmt *DS);
void VisitDoStmt(clang::DoStmt *DS);
void VisitForStmt(clang::ForStmt *FS);
- void VisitIfStmt(clang::IfStmt *IS);
void VisitReturnStmt(clang::ReturnStmt *RS);
- void VisitSwitchCase(clang::SwitchCase *SC);
void VisitSwitchStmt(clang::SwitchStmt *SS);
void VisitWhileStmt(clang::WhileStmt *WS);
};
@@ -276,19 +271,13 @@
}
void DestructorVisitor::VisitStmt(clang::Stmt *S) {
- for (clang::Stmt::child_iterator I = S->child_begin(), E = S->child_end();
- I != E;
- I++) {
- if (clang::Stmt *Child = *I) {
+ for (clang::Stmt* Child : S->children()) {
+ if (Child) {
Visit(Child);
}
}
}
-void DestructorVisitor::VisitCompoundStmt(clang::CompoundStmt *CS) {
- VisitStmt(CS);
-}
-
void DestructorVisitor::VisitBreakStmt(clang::BreakStmt *BS) {
VisitStmt(BS);
if ((mLoopDepth == 0) && (mSwitchDepth == 0)) {
@@ -296,10 +285,6 @@
}
}
-void DestructorVisitor::VisitCaseStmt(clang::CaseStmt *CS) {
- VisitStmt(CS);
-}
-
void DestructorVisitor::VisitContinueStmt(clang::ContinueStmt *CS) {
VisitStmt(CS);
if (mLoopDepth == 0) {
@@ -308,10 +293,6 @@
}
}
-void DestructorVisitor::VisitDefaultStmt(clang::DefaultStmt *DS) {
- VisitStmt(DS);
-}
-
void DestructorVisitor::VisitDoStmt(clang::DoStmt *DS) {
mLoopDepth++;
VisitStmt(DS);
@@ -324,19 +305,10 @@
mLoopDepth--;
}
-void DestructorVisitor::VisitIfStmt(clang::IfStmt *IS) {
- VisitStmt(IS);
-}
-
void DestructorVisitor::VisitReturnStmt(clang::ReturnStmt *RS) {
mReplaceStmtStack.push(RS);
}
-void DestructorVisitor::VisitSwitchCase(clang::SwitchCase *SC) {
- slangAssert(false && "Both case and default have specialized handlers");
- VisitStmt(SC);
-}
-
void DestructorVisitor::VisitSwitchStmt(clang::SwitchStmt *SS) {
mSwitchDepth++;
VisitStmt(SS);