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

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


This isn't correct.  We need the 'while' loop in case the ParenExpr wraps an OpaqueValueExpr, and vis versa.

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

> Author: akirtzidis
> Date: Sat Nov  5 02:03:54 2011
> New Revision: 143794
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=143794&view=rev
> Log:
> Simplify LookThroughStmt in LiveVariables.cpp
> 
> Modified:
>    cfe/trunk/lib/Analysis/LiveVariables.cpp
> 
> Modified: cfe/trunk/lib/Analysis/LiveVariables.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/LiveVariables.cpp?rev=143794&r1=143793&r2=143794&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Analysis/LiveVariables.cpp (original)
> +++ cfe/trunk/lib/Analysis/LiveVariables.cpp Sat Nov  5 02:03:54 2011
> @@ -232,18 +232,10 @@
> }
> 
> static const Stmt *LookThroughStmt(const Stmt *S) {
> -  while (S) {
> -    if (const ParenExpr *ParenE = dyn_cast<ParenExpr>(S)) {
> -      S = ParenE->getSubExpr();
> -      continue;
> -    } else if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(S)) {
> -      S = OVE->getSourceExpr();
> -      continue;
> -    } else if (const Expr *E = dyn_cast<Expr>(S)) {
> -      return E->IgnoreParens();
> -    } else
> -      break;
> -  }
> +  if (const Expr *E = dyn_cast<Expr>(S))
> +    return E->IgnoreParens();
> +  if (const OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(S))
> +    return OVE->IgnoreParens();
>   return S;
> }
> 
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list