brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · 1ca916b Raw
120 lines · plain
1// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -std=c++11 -emit-llvm -fblocks -o - | FileCheck %s2 3// CHECK: @"_ZZ11+[A shared]E1a" = internal global4// CHECK: @"_ZZ11-[A(Foo) f]E1a" = internal global5// CHECK: v56@0:8i16i20i24i28i32i36i40i44^i486 7@interface A8@end9 10@implementation A11 12+ (A *)shared {13  static A* a;14  15  return a;16}17 18@end19 20@interface A(Foo)21@end22 23@implementation A(Foo)24- (int)f {25  // FIXME: Add a member function to s and make sure that it's mangled correctly.26  struct s {27  };28  29  static s a;30 31  return 0;32}33@end34 35// PR646836@interface Test37- (void) process: (int)r3 :(int)r4 :(int)r5 :(int)r6 :(int)r7 :(int)r8 :(int)r9 :(int)r10 :(int &)i;38@end39 40@implementation Test41- (void) process: (int)r3 :(int)r4 :(int)r5 :(int)r6 :(int)r7 :(int)r8 :(int)r9 :(int)r10 :(int &)i {42}43@end44 45@interface NX46- (void)Meth;47@end48 49@implementation NX50- (void)Meth {51  void uiIsVisible();52// CHECK: call void @_Z11uiIsVisiblev53  uiIsVisible();54}55@end56 57// Don't crash when mangling an enum whose semantic context58// is a class extension (which looks anonymous in the AST).59// The other tests here are just for coverage.60@interface Test2 @end61@interface Test2 ()62@property (assign) enum { T2x, T2y, T2z } axis;63@end64@interface Test2 (a)65@property (assign) enum { T2i, T2j, T2k } dimension;66@end67@implementation Test2 {68@public69  enum { T2a, T2b, T2c } alt_axis;70}71@end72template <class T> struct Test2Template { Test2Template() {} }; // must have a member that we'll instantiate and mangle73void test2(Test2 *t) {74  Test2Template<decltype(t.axis)> t0;75  Test2Template<decltype(t.dimension)> t1;76  Test2Template<decltype(t->alt_axis)> t2;77}78 79@protocol P;80void overload1(A<P>*) {}81// CHECK-LABEL: define{{.*}} void @_Z9overload1PU11objcproto1P1A82void overload1(const A<P>*) {}83// CHECK-LABEL: define{{.*}} void @_Z9overload1PKU11objcproto1P1A84void overload1(A<P>**) {}85// CHECK-LABEL: define{{.*}} void @_Z9overload1PPU11objcproto1P1A86void overload1(A<P>*const*) {}87// CHECK-LABEL: define{{.*}} void @_Z9overload1PKPU11objcproto1P1A88void overload1(A<P>***) {}89// CHECK-LABEL: define{{.*}} void @_Z9overload1PPPU11objcproto1P1A90void overload1(void (f)(A<P>*)) {}91// CHECK-LABEL: define{{.*}} void @_Z9overload1PFvPU11objcproto1P1AE92 93template<typename T> struct X { void f(); };94template<> void X<A*>::f() {}95// CHECK-LABEL: define{{.*}} void @_ZN1XIP1AE1fEv96template<> void X<A<P>*>::f() {}97// CHECK-LABEL: define{{.*}} void @_ZN1XIPU11objcproto1P1AE1fEv98 99// CHECK-LABEL: define{{.*}} void @_Z12kindof_test2PU8__kindof5Test2100void kindof_test2(__kindof Test2 *t2) { }101 102@interface Parameterized<T, U> : A103@end104 105// CHECK-LABEL: define{{.*}} void @_Z19parameterized_test1P13ParameterizedIP1AP4TestE106void parameterized_test1(Parameterized<A *, Test *> *p) {}107 108// CHECK-LABEL: define{{.*}} void @_Z19parameterized_test2PU8__kindof13ParameterizedIP1AP4TestE109void parameterized_test2(__kindof Parameterized<A *, Test *> *p) {}110 111// CHECK-LABEL: define{{.*}} void @_Z19parameterized_test3P13Parameterized112void parameterized_test3(Parameterized *p) {}113 114// CHECK-LABEL: define {{.*}}void @_Z1fP11objc_object115void f(__attribute__((ns_consumed)) id) {}116// CHECK-LABEL: define {{.*}}void @_Z1fPFP11objc_objectS0_S0_E117void f(id (*fn)(__attribute__((ns_consumed)) id, id)) {}118// CHECK-LABEL: define {{.*}}void @_Z1fU13block_pointerFvP11objc_objectE119void f(void (^)(__attribute__((ns_consumed)) id)) {}120