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