From 5112fc48495fa705cabe7ec455f9a6e73ec9ecc7 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Sat, 5 Nov 2011 04:03:43 +0000 Subject: [PATCH] Fix infinite loop in LiveVariables due to a misplaced 'break' (it would break out of 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 | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp index 0b5a236bed..ccb301e58e 100644 --- a/lib/Analysis/LiveVariables.cpp +++ b/lib/Analysis/LiveVariables.cpp @@ -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(S)->getSubExpr(); - continue; - } - case Stmt::OpaqueValueExprClass: { - S = cast(S)->getSourceExpr(); - continue; - } - default: - break; - } + if (const ParenExpr *ParenE = dyn_cast(S)) + S = ParenE->getSubExpr(); + else if (const OpaqueValueExpr *OVE = dyn_cast(S)) + S = OVE->getSourceExpr(); + else + break; } return S; } -- 2.40.0