Author: kremenek
Date: Mon Aug 2 17:46:57 2010
New Revision: 110071
URL: http://llvm.org/viewvc/llvm-project?rev=110071&view=rev
Log:
Fix another case (this time in JumpScopeChecker) where walking deeply nested
CaseStmts can blow out the stack. Fixes <rdar://problem/8125165>.
Modified:
cfe/trunk/lib/Sema/JumpDiagnostics.cpp
Modified: cfe/trunk/lib/Sema/JumpDiagnostics.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/JumpDiagnostics.cpp?rev=110071&r1=110070&r2=110071&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/JumpDiagnostics.cpp (original)
+++ cfe/trunk/lib/Sema/JumpDiagnostics.cpp Mon Aug 2 17:46:57 2010
@@ -182,9 +182,19 @@
switch (S->getStmtClass()) {
case Stmt::LabelStmtClass:
case Stmt::DefaultStmtClass:
- case Stmt::CaseStmtClass:
LabelAndGotoScopes[S] = ParentScope;
break;
+ case Stmt::CaseStmtClass: {
+ // Specially handle CaseStmts since they can nest each other in the
+ // AST and blow out the stack when we walk them.
+ CaseStmt *CS = cast<CaseStmt>(S);
+ do {
+ LabelAndGotoScopes[CS] = ParentScope;
+ S = CS; // 'CS' is the new current statement (if it isn't already).
+ CS = dyn_cast<CaseStmt>(CS->getSubStmt());
+ } while (CS);
+ break;
+ }
case Stmt::AddrLabelExprClass:
IndirectJumpTargets.push_back(cast<AddrLabelExpr>(S)->getLabel());
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits