aboutsummaryrefslogtreecommitdiff
path: root/include/clang/AST/Stmt.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/AST/Stmt.h')
-rw-r--r--include/clang/AST/Stmt.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index 11023234b0..c99f0a9b2f 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -587,9 +587,8 @@ public:
SwitchLoc = SL;
}
void addSwitchCase(SwitchCase *SC) {
- if (FirstCase)
- SC->setNextSwitchCase(FirstCase);
-
+ assert(!SC->getNextSwitchCase() && "case/default already added to a switch");
+ SC->setNextSwitchCase(FirstCase);
FirstCase = SC;
}
virtual SourceRange getSourceRange() const {