Home | History | Annotate | Download | only in CodeGenObjC
      1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -fexceptions -fobjc-exceptions -o %t %s
      2 // RUN: FileCheck -check-prefix=CHECK-X86_64 < %t %s
      3 // RUN: grep '@"OBJC_EHTYPE_$_EH3"' %t | count 3
      4 
      5 // CHECK-X86_64: @"OBJC_CLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 8
      6 // CHECK-X86_64: @"OBJC_METACLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 8
      7 // CHECK-X86_64: @"\01L_OBJC_CLASS_NAME_" = {{.*}}, section "__TEXT,__objc_classname,cstring_literals", align 1
      8 // CHECK-X86_64: @"OBJC_EHTYPE_$_EH1" = weak global {{.*}}, section "__DATA,__datacoal_nt,coalesced", align 8
      9 // CHECK-X86_64: @"OBJC_EHTYPE_$_EH2" = external global
     10 // CHECK-X86_64: @"OBJC_EHTYPE_$_EH3" = global {{.*}}, section "__DATA,__objc_const", align 8
     11 // CHECK-X86_64: @"\01L_OBJC_LABEL_CLASS_$" = internal global {{.*}}, section "__DATA, __objc_classlist, regular, no_dead_strip", align 8
     12 // CHECK-X86_64: define internal void @"\01-[A im0]"
     13 // CHECK-X86_64: define internal void @"\01-[A(Cat) im1]"
     14 
     15 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-exceptions -fvisibility hidden -emit-llvm -o %t %s
     16 // RUN: FileCheck -check-prefix=CHECK-X86_64-HIDDEN < %t %s
     17 
     18 // CHECK-X86_64-HIDDEN: @"OBJC_CLASS_$_A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8
     19 // CHECK-X86_64-HIDDEN: @"OBJC_METACLASS_$_A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8
     20 // CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_EH1" = weak hidden global {{.*}}, section "__DATA,__datacoal_nt,coalesced"
     21 // CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_EH2" = external global
     22 // CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_EH3" = hidden global {{.*}}, section "__DATA,__objc_const", align 8
     23 // CHECK-X86_64-HIDDEN: define internal void @"\01-[A im0]"
     24 // CHECK-X86_64-HIDDEN: define internal void @"\01-[A(Cat) im1]"
     25 
     26 // RUN: %clang_cc1 -triple armv6-apple-darwin10 -target-abi apcs-gnu -fobjc-nonfragile-abi -fobjc-exceptions -emit-llvm -o %t %s
     27 // RUN: FileCheck -check-prefix=CHECK-ARMV6 < %t %s
     28 
     29 // CHECK-ARMV6: @"OBJC_CLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 4
     30 // CHECK-ARMV6: @"OBJC_METACLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 4
     31 // CHECK-ARMV6: @"\01L_OBJC_CLASS_NAME_" = {{.*}}, section "__TEXT,__objc_classname,cstring_literals", align 1
     32 // CHECK-ARMV6: @"OBJC_EHTYPE_$_EH1" = weak global {{.*}}, section "__DATA,__datacoal_nt,coalesced", align 4
     33 // CHECK-ARMV6: @"OBJC_EHTYPE_$_EH2" = external global
     34 // CHECK-ARMV6: @"OBJC_EHTYPE_$_EH3" = global {{.*}}, section "__DATA,__objc_const", align 4
     35 // CHECK-ARMV6: @"\01L_OBJC_LABEL_CLASS_$" = internal global {{.*}}, section "__DATA, __objc_classlist, regular, no_dead_strip", align 4
     36 // CHECK-ARMV6: define internal void @"\01-[A im0]"
     37 // CHECK-ARMV6: define internal void @"\01-[A(Cat) im1]"
     38 
     39 @interface A
     40 @end
     41 
     42 @implementation A
     43 -(void) im0 {
     44 }
     45 @end
     46 
     47 @implementation A (Cat)
     48 -(void) im1 {
     49 }
     50 @end
     51 
     52 @interface EH1
     53 @end
     54 
     55 __attribute__((__objc_exception__))
     56 @interface EH2
     57 @end
     58 
     59 __attribute__((__objc_exception__))
     60 @interface EH3
     61 @end
     62 
     63 void f1();
     64 
     65 void f0(id x) {
     66   @try {
     67     f1();
     68   } @catch (EH1 *x) {
     69   } @catch (EH2 *x) {
     70   } @catch (EH3 *x) {
     71   }
     72 }
     73 
     74 @implementation EH3
     75 @end
     76