1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-none-linux-gnu %s -emit-llvm -o - | FileCheck %s 2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple arm-apple-darwin %s -emit-llvm -o - | FileCheck %s 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc // Simple key function test 5*f4a2713aSLionel Sambuc struct testa { virtual void a(); }; a()6*f4a2713aSLionel Sambucvoid testa::a() {} 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc // Simple key function test atestb9*f4a2713aSLionel Sambucstruct testb { virtual void a() {} }; 10*f4a2713aSLionel Sambuc testb *testbvar = new testb; 11*f4a2713aSLionel Sambuc 12*f4a2713aSLionel Sambuc // Key function with out-of-line inline definition 13*f4a2713aSLionel Sambuc struct testc { virtual void a(); }; a()14*f4a2713aSLionel Sambucinline void testc::a() {} 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc // Functions with inline specifier are not key functions (PR5705) 17*f4a2713aSLionel Sambuc struct testd { inline virtual void a(); }; a()18*f4a2713aSLionel Sambucvoid testd::a() {} 19*f4a2713aSLionel Sambuc 20*f4a2713aSLionel Sambuc // Functions with inline specifier are not key functions (PR5705) 21*f4a2713aSLionel Sambuc struct teste { inline virtual void a(); }; 22*f4a2713aSLionel Sambuc teste *testevar = new teste; 23*f4a2713aSLionel Sambuc 24*f4a2713aSLionel Sambuc // Key functions with namespace (PR5711) 25*f4a2713aSLionel Sambuc namespace { 26*f4a2713aSLionel Sambuc struct testf { virtual void a(); }; 27*f4a2713aSLionel Sambuc } a()28*f4a2713aSLionel Sambucvoid testf::a() {} 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc // Key functions with namespace (PR5711) 31*f4a2713aSLionel Sambuc namespace { 32*f4a2713aSLionel Sambuc struct testg { virtual void a(); }; 33*f4a2713aSLionel Sambuc } a()34*f4a2713aSLionel Sambucvoid testg::a() {} 35*f4a2713aSLionel Sambuc testg *testgvar = new testg; 36*f4a2713aSLionel Sambuc 37*f4a2713aSLionel Sambuc struct X0 { virtual ~X0(); }; 38*f4a2713aSLionel Sambuc struct X1 : X0 { 39*f4a2713aSLionel Sambuc virtual void f(); 40*f4a2713aSLionel Sambuc }; 41*f4a2713aSLionel Sambuc f()42*f4a2713aSLionel Sambucinline void X1::f() { } 43*f4a2713aSLionel Sambuc use_X1(X1 * x1)44*f4a2713aSLionel Sambucvoid use_X1(X1 *x1) { x1->f(); } 45*f4a2713aSLionel Sambuc 46*f4a2713aSLionel Sambuc // FIXME: The checks are extremely difficult to get right when the globals 47*f4a2713aSLionel Sambuc // aren't alphabetized 48*f4a2713aSLionel Sambuc // CHECK: @_ZTV2X1 = linkonce_odr unnamed_addr constant 49*f4a2713aSLionel Sambuc // CHECK: @_ZTV5testa = unnamed_addr constant [3 x i8*] [i8* null 50*f4a2713aSLionel Sambuc // CHECK: @_ZTV5testc = linkonce_odr unnamed_addr constant [3 x i8*] [i8* null 51*f4a2713aSLionel Sambuc // CHECK: @_ZTVN12_GLOBAL__N_15testgE = internal unnamed_addr constant [3 x i8*] [i8* null 52*f4a2713aSLionel Sambuc // CHECK: @_ZTV5teste = linkonce_odr unnamed_addr constant [3 x i8*] [i8* null 53*f4a2713aSLionel Sambuc // CHECK: @_ZTV5testb = linkonce_odr unnamed_addr constant [3 x i8*] [i8* null 54