[cfe-commits] r143794 - /cfe/trunk/lib/Analysis/LiveVariables.cpp

Ted Kremenek kremenek at apple.com
Sat Nov 5 00:32:48 PDT 2011


On Nov 5, 2011, at 12:28 AM, Argyrios Kyrtzidis wrote:

> Ah ok, I didn't see your response before the changes. FWIW, my vote goes for
> 
> 
> static const Stmt *LookThroughStmt(const Stmt *S) {
>   if (const Expr *E = dyn_cast<Expr>(S))
>     S = E->IgnoreParens();
>   if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(S))
>     return LookThroughStmt(OVE->getSourceExpr());
>   return S;
> }
> 

I'm going with:

static const Stmt *LookThroughStmt(const Stmt *S) {
  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;
}

and doing the tail recursion manually.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111105/849c17ee/attachment.html>


More information about the cfe-commits mailing list