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