xref: /llvm-project/clang/test/CodeGenObjC/x86_64-struct-return-gc.m (revision 158d72d728261c1e54dc77931372b2322c52849f)
1// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o - %s | FileCheck %s
2struct Coerce {
3  id a;
4};
5
6struct Coerce coerce_func(void);
7
8// CHECK-LABEL: define{{.*}} void @Coerce_test()
9void Coerce_test(void) {
10  struct Coerce c;
11
12  // CHECK: call ptr @coerce_func
13  // CHECK: call ptr @objc_memmove_collectable(
14  c = coerce_func();
15}
16
17struct Indirect {
18  id a;
19  int b[10];
20};
21
22struct Indirect indirect_func(void);
23
24// CHECK-LABEL: define{{.*}} void @Indirect_test()
25void Indirect_test(void) {
26  struct Indirect i;
27
28  // CHECK: call void @indirect_func(ptr dead_on_unwind writable sret
29  // CHECK: call ptr @objc_memmove_collectable(
30  i = indirect_func();
31}
32