[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / clang / test / SemaObjC / strong-in-c-struct.m
blob5dd5f94af83012ae9822efe482efaa9fd8727e5f
1 // RUN: %clang_cc1 -triple arm64-apple-ios11 -fobjc-arc -fblocks  -fobjc-runtime=ios-11.0 -fsyntax-only -verify %s
3 typedef struct {
4   id a;
5 } Strong;
7 void callee_variadic(const char *, ...);
9 void test_variadic(void) {
10   Strong t;
11   callee_variadic("s", t); // expected-error {{cannot pass non-trivial C object of type 'Strong' by value to variadic function}}
14 void test_jump0(int cond) {
15   switch (cond) {
16   case 0:
17     ;
18     Strong x; // expected-note {{jump bypasses initialization of variable of non-trivial C struct type}}
19     break;
20   case 1: // expected-error {{cannot jump from switch statement to this case label}}
21     x.a = 0;
22     break;
23   }
26 void test_jump1(void) {
27   static void *ips[] = { &&L0 };
28 L0:  // expected-note {{possible target of indirect goto}}
29   ;
30   Strong x; // expected-note {{jump exits scope of variable with non-trivial destructor}}
31   goto *ips; // expected-error {{cannot jump}}
34 typedef void (^BlockTy)(void);
35 void func(BlockTy);
36 void func2(Strong);
38 void test_block_scope0(int cond) {
39   Strong x; // expected-note {{jump enters lifetime of block which captures a C struct that is non-trivial to destroy}}
40   switch (cond) {
41   case 0:
42     func(^{ func2(x); });
43     break;
44   default: // expected-error {{cannot jump from switch statement to this case label}}
45     break;
46   }
49 void test_block_scope1(void) {
50   static void *ips[] = { &&L0 };
51 L0:  // expected-note {{possible target of indirect goto}}
52   ;
53   Strong x; // expected-note {{jump exits scope of variable with non-trivial destructor}} expected-note {{jump exits lifetime of block which captures a C struct that is non-trivial to destroy}}
54   func(^{ func2(x); });
55   goto *ips; // expected-error {{cannot jump}}