Richard Smith | d28ac5b | 2014-03-22 23:33:22 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
Richard Smith | 04d05b5 | 2014-03-23 00:27:18 +0000 | [diff] [blame] | 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 |
Richard Smith | c9cbde7 | 2014-08-13 21:15:09 +0000 | [diff] [blame] | 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 |
Richard Smith | d28ac5b | 2014-03-22 23:33:22 +0000 | [diff] [blame] | 4 | // FIXME: When we have a syntax for modules in C++, use that. |
| 5 | |
| 6 | @import cxx_irgen_top; |
Richard Smith | cd45dbc | 2014-04-19 03:48:30 +0000 | [diff] [blame] | 7 | |
Will Schmidt | 22b065c | 2014-06-02 21:47:14 +0000 | [diff] [blame] | 8 | // CHECK-DAG: call {{[a-z]*[ ]?i32}} @_ZN8CtorInitIiE1fEv( |
Richard Smith | cd45dbc | 2014-04-19 03:48:30 +0000 | [diff] [blame] | 9 | CtorInit<int> x; |
| 10 | |
Richard Smith | d28ac5b | 2014-03-22 23:33:22 +0000 | [diff] [blame] | 11 | @import cxx_irgen_left; |
| 12 | @import cxx_irgen_right; |
| 13 | |
Richard Smith | c9cbde7 | 2014-08-13 21:15:09 +0000 | [diff] [blame] | 14 | // Keep these two namespace definitions separate; merging them hides the bug. |
| 15 | namespace EmitInlineMethods { |
NAKAMURA Takumi | c92ab5c | 2014-08-14 00:23:30 +0000 | [diff] [blame] | 16 | // CHECK-DAG: define linkonce_odr [[CC:(x86_thiscallcc[ ]+)?]]void @_ZN17EmitInlineMethods1C1fEPNS_1AE( |
| 17 | // CHECK-DAG: declare [[CC]]void @_ZN17EmitInlineMethods1A1gEv( |
Richard Smith | c9cbde7 | 2014-08-13 21:15:09 +0000 | [diff] [blame] | 18 | struct C { |
| 19 | __attribute__((used)) void f(A *p) { p->g(); } |
| 20 | }; |
| 21 | } |
| 22 | namespace EmitInlineMethods { |
NAKAMURA Takumi | c92ab5c | 2014-08-14 00:23:30 +0000 | [diff] [blame] | 23 | // CHECK-DAG: define linkonce_odr [[CC]]void @_ZN17EmitInlineMethods1D1fEPNS_1BE( |
| 24 | // CHECK-DAG: define linkonce_odr [[CC]]void @_ZN17EmitInlineMethods1B1gEv( |
Richard Smith | c9cbde7 | 2014-08-13 21:15:09 +0000 | [diff] [blame] | 25 | struct D { |
| 26 | __attribute__((used)) void f(B *p) { p->g(); } |
| 27 | }; |
| 28 | } |
| 29 | |
Hal Finkel | 834da75 | 2014-04-12 11:50:34 +0000 | [diff] [blame] | 30 | // CHECK-DAG: define available_externally hidden {{signext i32|i32}} @_ZN1SIiE1gEv({{.*}} #[[ALWAYS_INLINE:.*]] align |
Richard Smith | d28ac5b | 2014-03-22 23:33:22 +0000 | [diff] [blame] | 31 | int a = S<int>::g(); |
| 32 | |
Richard Smith | d28ac5b | 2014-03-22 23:33:22 +0000 | [diff] [blame] | 33 | int b = h(); |
| 34 | |
Hal Finkel | 834da75 | 2014-04-12 11:50:34 +0000 | [diff] [blame] | 35 | // CHECK-DAG: define linkonce_odr {{signext i32|i32}} @_Z3minIiET_S0_S0_(i32 |
Richard Smith | 04d05b5 | 2014-03-23 00:27:18 +0000 | [diff] [blame] | 36 | int c = min(1, 2); |
| 37 | |
Richard Smith | 4d23579 | 2014-08-07 18:53:08 +0000 | [diff] [blame] | 38 | // CHECK-LABEL: define {{.*}} @_ZN20OperatorDeleteLookup1AD0Ev( |
| 39 | // CHECK: call void @_ZN20OperatorDeleteLookup1AdlEPv( |
| 40 | |
Richard Smith | 6de7a24 | 2014-07-31 23:46:44 +0000 | [diff] [blame] | 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_( |
Richard Smith | 46bb581 | 2014-08-01 01:56:39 +0000 | [diff] [blame] | 53 | // CHECK: call {{.*}} @_ZN22ImplicitSpecialMembers1AC1ERKS0_( |
Richard Smith | 6de7a24 | 2014-07-31 23:46:44 +0000 | [diff] [blame] | 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 | |
Richard Smith | 4d23579 | 2014-08-07 18:53:08 +0000 | [diff] [blame] | 68 | namespace OperatorDeleteLookup { |
| 69 | // Trigger emission of B's vtable and deleting dtor. |
| 70 | // This requires us to know what operator delete was selected. |
| 71 | void g() { f(); } |
| 72 | } |
| 73 | |
Richard Smith | 6de7a24 | 2014-07-31 23:46:44 +0000 | [diff] [blame] | 74 | // CHECK: define available_externally {{signext i32|i32}} @_ZN1SIiE1fEv({{.*}} #[[ALWAYS_INLINE]] align |
| 75 | |
Richard Smith | d28ac5b | 2014-03-22 23:33:22 +0000 | [diff] [blame] | 76 | // CHECK: attributes #[[ALWAYS_INLINE]] = {{.*}} alwaysinline |