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

Argyrios Kyrtzidis akyrtzi at gmail.com
Sat Nov 5 00:28:42 PDT 2011


On Nov 5, 2011, at 12:11 AM, Ted Kremenek wrote:

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

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


> 
> 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
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111105/72402190/attachment.html>


More information about the cfe-commits mailing list