xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjCXX/copy.mm (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuc// rdar://problem/9158302
4*f4a2713aSLionel Sambuc// This should not use a memmove_collectable in non-GC mode.
5*f4a2713aSLionel Sambucnamespace test0 {
6*f4a2713aSLionel Sambuc  struct A {
7*f4a2713aSLionel Sambuc    id x;
8*f4a2713aSLionel Sambuc  };
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambuc  // CHECK:    define [[A:%.*]]* @_ZN5test04testENS_1AE(
11*f4a2713aSLionel Sambuc  // CHECK:      alloca
12*f4a2713aSLionel Sambuc  // CHECK-NEXT: getelementptr
13*f4a2713aSLionel Sambuc  // CHECK-NEXT: store
14*f4a2713aSLionel Sambuc  // CHECK-NEXT: call noalias i8* @_Znwm(
15*f4a2713aSLionel Sambuc  // CHECK-NEXT: bitcast
16*f4a2713aSLionel Sambuc  // CHECK-NEXT: bitcast
17*f4a2713aSLionel Sambuc  // CHECK-NEXT: bitcast
18*f4a2713aSLionel Sambuc  // CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(
19*f4a2713aSLionel Sambuc  // CHECK-NEXT: ret
20*f4a2713aSLionel Sambuc  A *test(A a) {
21*f4a2713aSLionel Sambuc    return new A(a);
22*f4a2713aSLionel Sambuc  }
23*f4a2713aSLionel Sambuc}
24*f4a2713aSLionel Sambuc
25*f4a2713aSLionel Sambuc
26*f4a2713aSLionel Sambuc// rdar://9780211
27*f4a2713aSLionel Sambuc@protocol bork
28*f4a2713aSLionel Sambuc@end
29*f4a2713aSLionel Sambuc
30*f4a2713aSLionel Sambucnamespace test1 {
31*f4a2713aSLionel Sambuctemplate<typename T> struct RetainPtr {
32*f4a2713aSLionel Sambuc  RetainPtr() {}
33*f4a2713aSLionel Sambuc};
34*f4a2713aSLionel Sambuc
35*f4a2713aSLionel Sambuc
36*f4a2713aSLionel SambucRetainPtr<id<bork> > x;
37*f4a2713aSLionel SambucRetainPtr<id> y;
38*f4a2713aSLionel Sambuc
39*f4a2713aSLionel Sambuc}
40