On Aug 13, 2012, at 5:36 PM, Anna Zaks <[email protected]> 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];
}


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to