diff --git a/clang/lib/Analysis/LiveVariables.cpp b/clang/lib/Analysis/LiveVariables.cpp index 69b093304268..cd6f09f2a744 100644 --- a/clang/lib/Analysis/LiveVariables.cpp +++ b/clang/lib/Analysis/LiveVariables.cpp @@ -232,10 +232,15 @@ static const VariableArrayType *FindVA(QualType Ty) { } static const Stmt *LookThroughStmt(const Stmt *S) { - if (const OpaqueValueExpr *OVE = dyn_cast(S)) - return OVE->getSourceExpr()->IgnoreParens(); - if (const Expr *E = dyn_cast(S)) - return E->IgnoreParens(); + while (S) { + if (const Expr *Ex = dyn_cast(S)) + S = Ex->IgnoreParens(); + if (const OpaqueValueExpr *OVE = dyn_cast(S)) { + S = OVE->getSourceExpr(); + continue; + } + break; + } return S; }