Reid Kleckner | 314ef7b | 2014-02-01 00:04:45 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK |
| 2 | // RUN: %clang_cc1 -triple %ms_abi_triple -emit-llvm -o - %s | FileCheck %s -check-prefix MS |
| 3 | // CHECK-NOT: _ZN1CC1ERK1C |
| 4 | // CHECK-NOT: _ZN1SC1ERK1S |
| 5 | // MS-NOT: ?0C@@QAE@ABV0 |
| 6 | // MS-NOT: ?0S@@QAE@ABV0 |
Fariborz Jahanian | eb86976 | 2009-08-06 01:02:49 +0000 | [diff] [blame] | 7 | |
| 8 | extern "C" int printf(...); |
| 9 | |
| 10 | |
| 11 | struct C { |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 12 | C() : iC(6) {printf("C()\n"); } |
| 13 | C(const C& c) { printf("C(const C& c)\n"); } |
| 14 | int iC; |
Fariborz Jahanian | eb86976 | 2009-08-06 01:02:49 +0000 | [diff] [blame] | 15 | }; |
| 16 | |
| 17 | C foo() { |
| 18 | return C(); |
| 19 | }; |
| 20 | |
| 21 | class X { // ... |
| 22 | public: |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 23 | X(int) {} |
| 24 | X(const X&, int i = 1, int j = 2, C c = foo()) { |
| 25 | printf("X(const X&, %d, %d, %d)\n", i, j, c.iC); |
| 26 | } |
Fariborz Jahanian | eb86976 | 2009-08-06 01:02:49 +0000 | [diff] [blame] | 27 | }; |
| 28 | |
Fariborz Jahanian | 42af5ba | 2009-08-14 20:11:43 +0000 | [diff] [blame] | 29 | |
| 30 | struct S { |
| 31 | S(); |
| 32 | }; |
| 33 | |
| 34 | S::S() { printf("S()\n"); } |
| 35 | |
| 36 | void Call(S) {}; |
| 37 | |
Mike Stump | 11289f4 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 38 | int main() { |
| 39 | X a(1); |
| 40 | X b(a, 2); |
| 41 | X c = b; |
| 42 | X d(a, 5, 6); |
| 43 | S s; |
| 44 | Call(s); |
Fariborz Jahanian | eb86976 | 2009-08-06 01:02:49 +0000 | [diff] [blame] | 45 | } |
David Majnemer | fd1e739 | 2015-02-03 23:04:06 +0000 | [diff] [blame] | 46 | |
| 47 | struct V { |
| 48 | int x; |
| 49 | }; |
| 50 | |
| 51 | typedef V V_over_aligned __attribute((aligned(8))); |
| 52 | extern const V_over_aligned gv1 = {}; |
| 53 | |
| 54 | extern "C" V f() { return gv1; } |
| 55 | |
| 56 | // Make sure that we obey the destination's alignment requirements when emitting |
| 57 | // the copy. |
NAKAMURA Takumi | 2e4c201 | 2015-02-04 14:51:30 +0000 | [diff] [blame] | 58 | // CHECK-LABEL: define {{.*}} @f( |
Pete Cooper | 3b39e88 | 2015-11-19 05:55:59 +0000 | [diff] [blame] | 59 | // CHECK: call void @llvm.memcpy.p0i8.p0i8.{{i64|i32}}({{.*}}, i8* bitcast (%struct.V* @gv1 to i8*), {{i64|i32}} 4, i32 4, i1 false) |