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

Jordan Rose jordan_rose at apple.com
Mon Aug 13 17:57:38 PDT 2012


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





More information about the cfe-commits mailing list