1*0a6a1f1dSLionel Sambuc // RUN: rm -rf %t 2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fmodules -x objective-c++ -std=c++11 -fmodules-cache-path=%t -I %S/Inputs -triple %itanium_abi_triple -disable-llvm-optzns -emit-llvm -o - %s | FileCheck %s 3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fmodules -x objective-c++ -std=c++11 -fmodules-cache-path=%t -I %S/Inputs -triple %itanium_abi_triple -disable-llvm-optzns -emit-llvm -g -o - %s | FileCheck %s 4*0a6a1f1dSLionel Sambuc // FIXME: When we have a syntax for modules in C++, use that. 5*0a6a1f1dSLionel Sambuc 6*0a6a1f1dSLionel Sambuc @import cxx_irgen_top; 7*0a6a1f1dSLionel Sambuc 8*0a6a1f1dSLionel Sambuc // CHECK-DAG: call {{[a-z]*[ ]?i32}} @_ZN8CtorInitIiE1fEv( 9*0a6a1f1dSLionel Sambuc CtorInit<int> x; 10*0a6a1f1dSLionel Sambuc 11*0a6a1f1dSLionel Sambuc @import cxx_irgen_left; 12*0a6a1f1dSLionel Sambuc @import cxx_irgen_right; 13*0a6a1f1dSLionel Sambuc 14*0a6a1f1dSLionel Sambuc // Keep these two namespace definitions separate; merging them hides the bug. 15*0a6a1f1dSLionel Sambuc namespace EmitInlineMethods { 16*0a6a1f1dSLionel Sambuc // CHECK-DAG: define linkonce_odr [[CC:(x86_thiscallcc[ ]+)?]]void @_ZN17EmitInlineMethods1C1fEPNS_1AE( 17*0a6a1f1dSLionel Sambuc // CHECK-DAG: declare [[CC]]void @_ZN17EmitInlineMethods1A1gEv( 18*0a6a1f1dSLionel Sambuc struct C { fEmitInlineMethods::C19*0a6a1f1dSLionel Sambuc __attribute__((used)) void f(A *p) { p->g(); } 20*0a6a1f1dSLionel Sambuc }; 21*0a6a1f1dSLionel Sambuc } 22*0a6a1f1dSLionel Sambuc namespace EmitInlineMethods { 23*0a6a1f1dSLionel Sambuc // CHECK-DAG: define linkonce_odr [[CC]]void @_ZN17EmitInlineMethods1D1fEPNS_1BE( 24*0a6a1f1dSLionel Sambuc // CHECK-DAG: define linkonce_odr [[CC]]void @_ZN17EmitInlineMethods1B1gEv( 25*0a6a1f1dSLionel Sambuc struct D { fEmitInlineMethods::D26*0a6a1f1dSLionel Sambuc __attribute__((used)) void f(B *p) { p->g(); } 27*0a6a1f1dSLionel Sambuc }; 28*0a6a1f1dSLionel Sambuc } 29*0a6a1f1dSLionel Sambuc 30*0a6a1f1dSLionel Sambuc // CHECK-DAG: define available_externally hidden {{signext i32|i32}} @_ZN1SIiE1gEv({{.*}} #[[ALWAYS_INLINE:.*]] align 31*0a6a1f1dSLionel Sambuc int a = S<int>::g(); 32*0a6a1f1dSLionel Sambuc 33*0a6a1f1dSLionel Sambuc int b = h(); 34*0a6a1f1dSLionel Sambuc 35*0a6a1f1dSLionel Sambuc // CHECK-DAG: define linkonce_odr {{signext i32|i32}} @_Z3minIiET_S0_S0_(i32 36*0a6a1f1dSLionel Sambuc int c = min(1, 2); 37*0a6a1f1dSLionel Sambuc 38*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define {{.*}} @_ZN20OperatorDeleteLookup1AD0Ev( 39*0a6a1f1dSLionel Sambuc // CHECK: call void @_ZN20OperatorDeleteLookup1AdlEPv( 40*0a6a1f1dSLionel Sambuc 41*0a6a1f1dSLionel Sambuc namespace ImplicitSpecialMembers { 42*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define {{.*}} @_ZN22ImplicitSpecialMembers1DC2EOS0_( 43*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} @_ZN22ImplicitSpecialMembers1AC1ERKS0_( 44*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define {{.*}} @_ZN22ImplicitSpecialMembers1DC2ERKS0_( 45*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} @_ZN22ImplicitSpecialMembers1AC1ERKS0_( 46*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define {{.*}} @_ZN22ImplicitSpecialMembers1CC2EOS0_( 47*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} @_ZN22ImplicitSpecialMembers1AC1ERKS0_( 48*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define {{.*}} @_ZN22ImplicitSpecialMembers1CC2ERKS0_( 49*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} @_ZN22ImplicitSpecialMembers1AC1ERKS0_( 50*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define {{.*}} @_ZN22ImplicitSpecialMembers1BC2EOS0_( 51*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} @_ZN22ImplicitSpecialMembers1AC1ERKS0_( 52*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define {{.*}} @_ZN22ImplicitSpecialMembers1BC2ERKS0_( 53*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} @_ZN22ImplicitSpecialMembers1AC1ERKS0_( 54*0a6a1f1dSLionel Sambuc 55*0a6a1f1dSLionel Sambuc extern B b1; 56*0a6a1f1dSLionel Sambuc B b2(b1); 57*0a6a1f1dSLionel Sambuc B b3(static_cast<B&&>(b1)); 58*0a6a1f1dSLionel Sambuc 59*0a6a1f1dSLionel Sambuc extern C c1; 60*0a6a1f1dSLionel Sambuc C c2(c1); 61*0a6a1f1dSLionel Sambuc C c3(static_cast<C&&>(c1)); 62*0a6a1f1dSLionel Sambuc 63*0a6a1f1dSLionel Sambuc extern D d1; 64*0a6a1f1dSLionel Sambuc D d2(d1); 65*0a6a1f1dSLionel Sambuc D d3(static_cast<D&&>(d1)); 66*0a6a1f1dSLionel Sambuc } 67*0a6a1f1dSLionel Sambuc 68*0a6a1f1dSLionel Sambuc namespace OperatorDeleteLookup { 69*0a6a1f1dSLionel Sambuc // Trigger emission of B's vtable and deleting dtor. 70*0a6a1f1dSLionel Sambuc // This requires us to know what operator delete was selected. g()71*0a6a1f1dSLionel Sambuc void g() { f(); } 72*0a6a1f1dSLionel Sambuc } 73*0a6a1f1dSLionel Sambuc 74*0a6a1f1dSLionel Sambuc // CHECK: define available_externally {{signext i32|i32}} @_ZN1SIiE1fEv({{.*}} #[[ALWAYS_INLINE]] align 75*0a6a1f1dSLionel Sambuc 76*0a6a1f1dSLionel Sambuc // CHECK: attributes #[[ALWAYS_INLINE]] = {{.*}} alwaysinline 77