xref: /llvm-project/clang/test/PCH/non-trivial-c-compound-literal.m (revision 9466b49171dc4b21f56a48594fc82b1e52f5358a)
1// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -x objective-c -fobjc-arc -emit-pch -o %t %s
2// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -x objective-c -fobjc-arc -include-pch %t -emit-llvm -o - %s | FileCheck %s
3
4#ifndef HEADER
5#define HEADER
6
7typedef struct {
8  id f;
9} S;
10
11static inline id getObj(id a) {
12  S *p = &(S){ .f = a };
13  return p->f;
14}
15
16#else
17
18// CHECK: %[[STRUCT_S:.*]] = type { ptr }
19
20// CHECK: define internal ptr @getObj(
21// CHECK: %[[_COMPOUNDLITERAL:.*]] = alloca %[[STRUCT_S]],
22// CHECK: call void @__destructor_8_s0(ptr %[[_COMPOUNDLITERAL]])
23
24id test(id a) {
25  return getObj(a);
26}
27
28#endif
29