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.

llvm-svn: 143797
This commit is contained in:
Ted Kremenek 2011-11-05 07:34:28 +00:00
parent c843fd2afb
commit 977e30d1c4
1 changed files with 9 additions and 4 deletions

View File

@ -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;
}