]> granicus.if.org Git - clang/commitdiff
Fix infinite loop in LiveVariables due to a misplaced 'break' (it would break out of
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 5 Nov 2011 04:03:43 +0000 (04:03 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 5 Nov 2011 04:03:43 +0000 (04:03 +0000)
switch statement, not the while loop).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143780 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/LiveVariables.cpp

index 0b5a236bed046a603b47cadb588c019a65c5d9c3..ccb301e58ebacc3ea0b3889f9612b659d654d891 100644 (file)
@@ -233,18 +233,12 @@ static const VariableArrayType *FindVA(QualType Ty) {
 
 static const Stmt *LookThroughStmt(const Stmt *S) {
   while (S) {
-    switch (S->getStmtClass()) {
-      case Stmt::ParenExprClass: {
-        S = cast<ParenExpr>(S)->getSubExpr();
-        continue;
-      }
-      case Stmt::OpaqueValueExprClass: {
-        S = cast<OpaqueValueExpr>(S)->getSourceExpr();
-        continue;
-      }
-      default:
-        break;
-    }
+    if (const ParenExpr *ParenE = dyn_cast<ParenExpr>(S))
+      S = ParenE->getSubExpr();
+    else if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(S))
+      S = OVE->getSourceExpr();
+    else
+      break;
   }
   return S;
 }