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