diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-11-05 07:34:28 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-11-05 07:34:28 +0000 |
commit | 6bbecd5e96c2bfe6dcb935a3ca0deb06782a5b14 (patch) | |
tree | 9537962bb3ff61d7abe663346e66a0af0a4fc2c0 /lib/Analysis/LiveVariables.cpp | |
parent | ef911a1bc5ef41c4d43c39294270aeb1dd8d4dac (diff) |
Tweak LookThroughStmt() in LiveVariables to properly look through alternativing ParenExprs and OpaqueValueExprs. Thanks to Anna and Argiris for iterating on this function. My original patch embarssingly didn't even pass the Clang tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143797 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LiveVariables.cpp')
-rw-r--r-- | lib/Analysis/LiveVariables.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp index 69b0933042..cd6f09f2a7 100644 --- a/lib/Analysis/LiveVariables.cpp +++ b/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<OpaqueValueExpr>(S)) - return OVE->getSourceExpr()->IgnoreParens(); - if (const Expr *E = dyn_cast<Expr>(S)) - return E->IgnoreParens(); + while (S) { + if (const Expr *Ex = dyn_cast<Expr>(S)) + S = Ex->IgnoreParens(); + if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(S)) { + S = OVE->getSourceExpr(); + continue; + } + break; + } return S; } |