John McCall | 260611a | 2012-06-20 06:18:46 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 2 | |
| 3 | // rdar://problem/9158302 |
| 4 | // This should not use a memmove_collectable in non-GC mode. |
| 5 | namespace test0 { |
| 6 | struct A { |
| 7 | id x; |
| 8 | }; |
| 9 | |
| 10 | // CHECK: define [[A:%.*]]* @_ZN5test04testENS_1AE( |
| 11 | // CHECK: alloca |
| 12 | // CHECK-NEXT: getelementptr |
| 13 | // CHECK-NEXT: store |
| 14 | // CHECK-NEXT: call noalias i8* @_Znwm( |
| 15 | // CHECK-NEXT: bitcast |
| 16 | // CHECK-NEXT: bitcast |
John McCall | f85e193 | 2011-06-15 23:02:42 +0000 | [diff] [blame] | 17 | // CHECK-NEXT: bitcast |
| 18 | // CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64( |
| 19 | // CHECK-NEXT: ret |
| 20 | A *test(A a) { |
| 21 | return new A(a); |
| 22 | } |
| 23 | } |
| 24 | |
Chris Lattner | b13eab9 | 2011-07-20 06:29:00 +0000 | [diff] [blame] | 25 | |
| 26 | // rdar://9780211 |
| 27 | @protocol bork |
| 28 | @end |
| 29 | |
| 30 | namespace test1 { |
| 31 | template<typename T> struct RetainPtr { |
| 32 | RetainPtr() {} |
| 33 | }; |
| 34 | |
| 35 | |
| 36 | RetainPtr<id<bork> > x; |
| 37 | RetainPtr<id> y; |
| 38 | |
| 39 | } |