blob: 449279ca60d26b308137e73c2ede825a8f445be4 [file] [log] [blame]
John McCalla1bcc4d2011-02-26 09:12:15 +00001// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-MAC
2// RUN: %clang_cc1 -emit-llvm -fobjc-nonfragile-abi -o - %s | FileCheck %s -check-prefix=CHECK-MAC-NF
3// RUN: %clang_cc1 -fgnu-runtime -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-GNU
4// RUN: %clang_cc1 -fgnu-runtime -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK-GNU-NF
Daniel Dunbarb21d6af2008-09-04 04:36:23 +00005
6typedef struct {
7 int x;
8 int y;
9 int z[10];
10} MyPoint;
11
12void f0(id a) {
13 int i;
14 MyPoint pt = { 1, 2};
15
Fariborz Jahanianc0ddef22011-03-01 17:28:13 +000016 // CHECK-MAC: call {{.*}} @objc_msgSend to
17 // CHECK-MAC-NF: call {{.*}} @objc_msgSend to
John McCalla1bcc4d2011-02-26 09:12:15 +000018 // CHECK-GNU: call {{.*}} @objc_msg_lookup(
19 // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender(
Daniel Dunbarb21d6af2008-09-04 04:36:23 +000020 [a print0];
John McCalla1bcc4d2011-02-26 09:12:15 +000021
22 // CHECK-MAC: call {{.*}} @objc_msgSend to
23 // CHECK-MAC-NF: call {{.*}} @objc_msgSend to
24 // CHECK-GNU: call {{.*}} @objc_msg_lookup to
25 // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to
Daniel Dunbarb21d6af2008-09-04 04:36:23 +000026 [a print1: 10];
John McCalla1bcc4d2011-02-26 09:12:15 +000027
28 // CHECK-MAC: call {{.*}} @objc_msgSend to
29 // CHECK-MAC-NF: call {{.*}} @objc_msgSend to
30 // CHECK-GNU: call {{.*}} @objc_msg_lookup to
31 // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to
Daniel Dunbarb21d6af2008-09-04 04:36:23 +000032 [a print2: 10 and: "hello" and: 2.2];
John McCalla1bcc4d2011-02-26 09:12:15 +000033
34 // CHECK-MAC: call {{.*}} @objc_msgSend to
35 // CHECK-MAC-NF: call {{.*}} @objc_msgSend to
36 // CHECK-GNU: call {{.*}} @objc_msg_lookup to
37 // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to
Daniel Dunbarb21d6af2008-09-04 04:36:23 +000038 [a takeStruct: pt ];
39
40 void *s = @selector(print0);
41 for (i=0; i<2; ++i)
John McCalla1bcc4d2011-02-26 09:12:15 +000042 // CHECK-MAC: call {{.*}} @objc_msgSend to
43 // CHECK-MAC-NF: call {{.*}} @objc_msgSend to
44 // CHECK-GNU: call {{.*}} @objc_msg_lookup to
45 // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to
Daniel Dunbarb21d6af2008-09-04 04:36:23 +000046 [a performSelector:s];
47}