[cfe-commits] r143780 - /cfe/trunk/lib/Analysis/LiveVariables.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Nov 4 21:03:43 PDT 2011


Author: akirtzidis
Date: Fri Nov  4 23:03:43 2011
New Revision: 143780

URL: http://llvm.org/viewvc/llvm-project?rev=143780&view=rev
Log:
Fix infinite loop in LiveVariables due to a misplaced 'break' (it would break out of
switch statement, not the while loop).

Modified:
    cfe/trunk/lib/Analysis/LiveVariables.cpp

Modified: cfe/trunk/lib/Analysis/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/LiveVariables.cpp?rev=143780&r1=143779&r2=143780&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/lib/Analysis/LiveVariables.cpp Fri Nov  4 23:03:43 2011
@@ -233,18 +233,12 @@
 
 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;
 }





More information about the cfe-commits mailing list