aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/LiveVariables.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-05 04:03:43 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-05 04:03:43 +0000
commit5112fc48495fa705cabe7ec455f9a6e73ec9ecc7 (patch)
treed209ad3c4686f2602f06c7fb179c76ec650908c0 /lib/Analysis/LiveVariables.cpp
parent66042b32b3b37ddcba731ff05c2792e3bb572102 (diff)
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
Diffstat (limited to 'lib/Analysis/LiveVariables.cpp')
-rw-r--r--lib/Analysis/LiveVariables.cpp18
1 files 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<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;
}