aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Stmt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST/Stmt.cpp')
-rw-r--r--lib/AST/Stmt.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index 668f7ef57f..a0ef5a6428 100644
--- a/lib/AST/Stmt.cpp
+++ b/lib/AST/Stmt.cpp
@@ -43,7 +43,7 @@ static StmtClassNameTable &getStmtInfoTableEntry(Stmt::StmtClass E) {
}
const char *Stmt::getStmtClassName() const {
- return getStmtInfoTableEntry(sClass).Name;
+ return getStmtInfoTableEntry((StmtClass)sClass).Name;
}
void Stmt::DestroyChildren(ASTContext &C) {
@@ -104,6 +104,20 @@ BreakStmt* BreakStmt::Clone(ASTContext &C) const {
return new (C) BreakStmt(BreakLoc);
}
+void SwitchStmt::DoDestroy(ASTContext &Ctx) {
+ // Destroy the SwitchCase statements in this switch. In the normal
+ // case, this loop will merely decrement the reference counts from
+ // the Retain() calls in addSwitchCase();
+ SwitchCase *SC = FirstCase;
+ while (SC) {
+ SwitchCase *Next = SC->getNextSwitchCase();
+ SC->Destroy(Ctx);
+ SC = Next;
+ }
+
+ Stmt::DoDestroy(Ctx);
+}
+
void CompoundStmt::setStmts(ASTContext &C, Stmt **Stmts, unsigned NumStmts) {
if (this->Body)
C.Deallocate(Body);