Home | History | Annotate | Download | only in CodeGenObjC
      1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck %s
      2 // RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck %s
      3 
      4 /*
      5 
      6 Here is a handy command for looking at llvm-gcc's output:
      7 llvm-gcc -m64 -fobjc-gc -emit-llvm -S -o - ivar-layout-64.m | \
      8   grep 'OBJC_CLASS_NAME.* =.*global' | \
      9   sed -e 's#, section.*# ...#' | \
     10   sed -e 's#_[0-9]*"#_NNN#' | \
     11   sort
     12 
     13 */
     14 
     15 @interface B @end
     16 
     17 @interface A {
     18   struct s0 {
     19     int f0;
     20     int f1;
     21   } f0;
     22   id f1;
     23 __weak B *f2;
     24   int f3 : 5;
     25   struct s1 {
     26     int *f0;
     27     int *f1;
     28   } f4[2][1];
     29 }
     30 @end
     31 
     32 @interface C : A
     33 @property int p3;
     34 @end
     35 
     36 // CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"C\00"
     37 // CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\11p\00"
     38 // CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"!`\00"
     39 
     40 
     41 @implementation C
     42 @synthesize p3 = _p3;
     43 @end
     44 
     45 @interface A()
     46 @property int p0;
     47 @property (assign) __strong id p1;
     48 @property (assign) __weak id p2;
     49 @end
     50 
     51 // CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"A\00"
     52 // CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\11q\10\00"
     53 // CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"!q\00"
     54 
     55 @implementation A
     56 @synthesize p0 = _p0;
     57 @synthesize p1 = _p1;
     58 @synthesize p2 = _p2;
     59 @end
     60 
     61 @interface D : A
     62 @property int p3;
     63 @end
     64 
     65 // CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"D\00"
     66 // CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\11p\00"
     67 // CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"!`\00"
     68 
     69 @implementation D
     70 @synthesize p3 = _p3;
     71 @end
     72 
     73 typedef unsigned short UInt16;
     74 
     75 
     76 typedef signed char BOOL;
     77 typedef unsigned int FSCatalogInfoBitmap;
     78 
     79 @interface NSFileLocationComponent {
     80     @private
     81 
     82     id _specifierOrStandardizedPath;
     83     BOOL _carbonCatalogInfoAndNameAreValid;
     84     FSCatalogInfoBitmap _carbonCatalogInfoMask;
     85     id _name;
     86     id _containerComponent;
     87     id _presentableName;
     88     id _iconAsAttributedString;
     89 }
     90 @end
     91 
     92 // CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"NSFileLocationComponent\00"
     93 // CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\01\14\00"
     94 
     95 @implementation NSFileLocationComponent @end
     96 
     97 @interface NSObject {
     98   id isa;
     99 }
    100 @end
    101 
    102 @interface Foo : NSObject {
    103     id ivar;
    104 
    105     unsigned long bitfield  :31;
    106     unsigned long bitfield2 :1;
    107     unsigned long bitfield3 :32;
    108 }
    109 @end
    110 
    111 // CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"Foo\00"
    112 // CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\02\10\00"
    113 
    114 @implementation Foo @end
    115