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