[cfe-commits] r161822 - in /cfe/trunk: lib/Analysis/LiveVariables.cpp test/Analysis/inlining/RetainCountExamples.m

Anna Zaks ganna at apple.com
Tue Aug 14 11:41:10 PDT 2012


On Aug 13, 2012, at 5:57 PM, Jordan Rose wrote:

> 
> On Aug 13, 2012, at 5:36 PM, Anna Zaks <ganna at apple.com> wrote:
> 
>> Author: zaks
>> Date: Mon Aug 13 19:36:20 2012
>> New Revision: 161822
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=161822&view=rev
>> Log:
>> [analyzer] Teach live variable analyzes that super uses self pointer.
>> 
>> Added:
>>   cfe/trunk/test/Analysis/inlining/RetainCountExamples.m
>> 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=161822&r1=161821&r2=161822&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Analysis/LiveVariables.cpp (original)
>> +++ cfe/trunk/lib/Analysis/LiveVariables.cpp Mon Aug 13 19:36:20 2012
>> @@ -284,6 +284,14 @@
>>      }
>>      break;
>>    }
>> +    case Stmt::ObjCMessageExprClass: {
>> +      // In calls to super, include the implicit "self" pointer as being live.
>> +      ObjCMessageExpr *CE = cast<ObjCMessageExpr>(S);
>> +      if (CE->getReceiverKind() == ObjCMessageExpr::SuperInstance)
>> +        val.liveDecls = LV.DSetFact.add(val.liveDecls,
>> +                                        LV.analysisContext.getSelfDecl());
>> +      break;
>> +    }
> 
> Although we can't test it yet, the 'self' pointer should also stay live when the receiver is SuperClass as well.
> 
> + (void)test {
>  [super test];
> }
> 

I've added a TODO test case that would exercise this in r161884. I'd rather not add the code to LiveVariables unless we can test it.

Currently, the self region is not created until it's being accessed in the parent, so there is nothing to keep alive.

> 




More information about the cfe-commits mailing list