Home | History | Annotate | Download | only in CodeGenObjCXX
      1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -std=c++11 -emit-llvm -o - | FileCheck %s
      2 
      3 // CHECK: @"_ZZ11+[A shared]E1a" = internal global
      4 // CHECK: @"_ZZ11-[A(Foo) f]E1a" = internal global
      5 // CHECK: v56@0:8i16i20i24i28i32i36i40i44^i48
      6 
      7 @interface A
      8 @end
      9 
     10 @implementation A
     11 
     12 + (A *)shared {
     13   static A* a;
     14   
     15   return a;
     16 }
     17 
     18 @end
     19 
     20 @interface A(Foo)
     21 @end
     22 
     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 @end
     34 
     35 // PR6468
     36 @interface Test
     37 - (void) process: (int)r3 :(int)r4 :(int)r5 :(int)r6 :(int)r7 :(int)r8 :(int)r9 :(int)r10 :(int &)i;
     38 @end
     39 
     40 @implementation Test
     41 - (void) process: (int)r3 :(int)r4 :(int)r5 :(int)r6 :(int)r7 :(int)r8 :(int)r9 :(int)r10 :(int &)i {
     42 }
     43 @end
     44 
     45 // rdar://9566314
     46 @interface NX
     47 - (void)Meth;
     48 @end
     49 
     50 @implementation NX
     51 - (void)Meth {
     52   void uiIsVisible();
     53 // CHECK: call void @_Z11uiIsVisiblev
     54   uiIsVisible();
     55 }
     56 @end
     57 
     58 // rdar://13434937
     59 //
     60 // Don't crash when mangling an enum whose semantic context
     61 // is a class extension (which looks anonymous in the AST).
     62 // The other tests here are just for coverage.
     63 @interface Test2 @end
     64 @interface Test2 ()
     65 @property (assign) enum { T2x, T2y, T2z } axis;
     66 @end
     67 @interface Test2 (a)
     68 @property (assign) enum { T2i, T2j, T2k } dimension;
     69 @end
     70 @implementation Test2 {
     71 @public
     72   enum { T2a, T2b, T2c } alt_axis;
     73 }
     74 @end
     75 template <class T> struct Test2Template { Test2Template() {} }; // must have a member that we'll instantiate and mangle
     76 void test2(Test2 *t) {
     77   Test2Template<decltype(t.axis)> t0;
     78   Test2Template<decltype(t.dimension)> t1;
     79   Test2Template<decltype(t->alt_axis)> t2;
     80 }
     81 
     82 @protocol P;
     83 void overload1(A<P>*) {}
     84 // CHECK-LABEL: define void @_Z9overload1PU11objcproto1P1A
     85 void overload1(const A<P>*) {}
     86 // CHECK-LABEL: define void @_Z9overload1PKU11objcproto1P1A
     87 void overload1(A<P>**) {}
     88 // CHECK-LABEL: define void @_Z9overload1PPU11objcproto1P1A
     89 void overload1(A<P>*const*) {}
     90 // CHECK-LABEL: define void @_Z9overload1PKPU11objcproto1P1A
     91 void overload1(A<P>***) {}
     92 // CHECK-LABEL: define void @_Z9overload1PPPU11objcproto1P1A
     93 void overload1(void (f)(A<P>*)) {}
     94 // CHECK-LABEL: define void @_Z9overload1PFvPU11objcproto1P1AE
     95 
     96 template<typename T> struct X { void f(); };
     97 template<> void X<A*>::f() {}
     98 // CHECK-LABEL: define void @_ZN1XIP1AE1fEv
     99 template<> void X<A<P>*>::f() {}
    100 // CHECK-LABEL: define void @_ZN1XIPU11objcproto1P1AE1fEv
    101