Home | History | Annotate | Download | only in self
      1 //===-- main.m ------------------------------------------*- Objective-C -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 #import <Foundation/Foundation.h>
     11 
     12 @interface A : NSObject
     13 {
     14     int m_a;
     15 }
     16 -(id)init;
     17 -(void)accessMember:(int)a;
     18 +(void)accessStaticMember:(int)a;
     19 @end
     20 
     21 static int s_a = 5;
     22 
     23 @implementation A
     24 -(id)init
     25 {
     26     self = [super init];
     27     
     28     if (self)
     29         m_a = 2;
     30 
     31     return self;
     32 }
     33 
     34 -(void)accessMember:(int)a
     35 {
     36     m_a = a; // breakpoint 1
     37 }
     38 
     39 +(void)accessStaticMember:(int)a
     40 {
     41     s_a = a; // breakpoint 2
     42 }
     43 @end
     44 
     45 int main()
     46 {
     47     NSAutoreleasePool *pool = [NSAutoreleasePool alloc];
     48     A *my_a = [[A alloc] init];
     49     
     50     [my_a accessMember:3];
     51     [A accessStaticMember:5];
     52     
     53     [pool release];
     54 }
     55