aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenObjC
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGenObjC')
-rw-r--r--test/CodeGenObjC/PR4541.m19
-rw-r--r--test/CodeGenObjC/PR4894-recursive-debug-crash.m40
-rw-r--r--test/CodeGenObjC/constant-strings.m4
-rw-r--r--test/CodeGenObjC/debug-info-linkagename.m17
-rw-r--r--test/CodeGenObjC/for-in.m44
-rw-r--r--test/CodeGenObjC/ivar-layout-64-bitfields.m40
-rw-r--r--test/CodeGenObjC/ivar-layout-no-optimize.m18
-rw-r--r--test/CodeGenObjC/messages.m4
-rw-r--r--test/CodeGenObjC/objc-assign-ivar.m53
-rw-r--r--test/CodeGenObjC/objc-gc-aggr-assign.m46
-rw-r--r--test/CodeGenObjC/objc-read-weak-byref.m26
-rw-r--r--test/CodeGenObjC/objc2-assign-global.m83
-rw-r--r--test/CodeGenObjC/objc2-ivar-assign.m41
-rw-r--r--test/CodeGenObjC/objc2-new-gc-api-strongcast.m26
-rw-r--r--test/CodeGenObjC/objc2-weak-assign.m4
-rw-r--r--test/CodeGenObjC/objc2-weak-ivar-debug.m15
-rw-r--r--test/CodeGenObjC/objc2-write-barrier-2.m80
-rw-r--r--test/CodeGenObjC/objc2-write-barrier-3.m47
-rw-r--r--test/CodeGenObjC/objc2-write-barrier-4.m28
-rw-r--r--test/CodeGenObjC/objc2-write-barrier-5.m27
-rw-r--r--test/CodeGenObjC/objc2-write-barrier.m114
-rw-r--r--test/CodeGenObjC/object-incr-decr-1.m19
-rw-r--r--test/CodeGenObjC/overloadable.m4
-rw-r--r--test/CodeGenObjC/predefined-expr.m90
-rw-r--r--test/CodeGenObjC/property-agrr-getter.m23
-rw-r--r--test/CodeGenObjC/property-setter-attr.m2
-rw-r--r--test/CodeGenObjC/protocol-in-extended-class.m29
-rw-r--r--test/CodeGenObjC/protocols-lazy.m4
-rw-r--r--test/CodeGenObjC/protocols.m50
-rw-r--r--test/CodeGenObjC/variadic-sends.m41
30 files changed, 1024 insertions, 14 deletions
diff --git a/test/CodeGenObjC/PR4541.m b/test/CodeGenObjC/PR4541.m
new file mode 100644
index 000000000000..9a651162c1e1
--- /dev/null
+++ b/test/CodeGenObjC/PR4541.m
@@ -0,0 +1,19 @@
+// RUN: clang-cc -o %t -w -g %s
+
+
+@class NSString;
+@interface NSAttributedString
+- (NSString *)string;
+@end
+@interface NSMutableAttributedString : NSAttributedString
+@end
+@class NSImage;
+@implementation CYObjectsController
++ (void)initialize {
+}
++ (NSAttributedString *)attributedStringWithString:(id)string image:(NSImage *)image {
+ NSMutableAttributedString *attrStr;
+}
+@end
+
+
diff --git a/test/CodeGenObjC/PR4894-recursive-debug-crash.m b/test/CodeGenObjC/PR4894-recursive-debug-crash.m
new file mode 100644
index 000000000000..c5f901c2680e
--- /dev/null
+++ b/test/CodeGenObjC/PR4894-recursive-debug-crash.m
@@ -0,0 +1,40 @@
+// RUN: clang-cc -triple i386-apple-darwin9 -g -emit-llvm %s -o - | FileCheck %s
+// PR4894
+//
+// This test is actually just making sure we can generate the debug info for the
+// return type from im0 without crashing.
+// XFAIL
+
+@interface I0 {
+ I0 *_iv0;
+}
+@end
+@protocol P0 @end
+
+@interface I1 @end
+@implementation I1
+- (I0<P0> *) im0 {
+// CHECK: @"\01-[I1 im0]"
+// CHECK: llvm.dbg.func.start
+ return 0;
+}
+@end
+
+// FIXME: This was another PR4894 test case, which is crashing somewhere
+// else. PR5025.
+#if 0
+typedef const struct objc_selector {
+ void *sel_id;
+ const char *sel_types;
+} *SEL;
+
+@interface I2
++(id) dictionary;
+@end
+
+@implementation I3;
++(void) initialize {
+ I2 *a0 = [I2 dictionary];
+}
+@end
+#endif
diff --git a/test/CodeGenObjC/constant-strings.m b/test/CodeGenObjC/constant-strings.m
index d4fefd903653..82cd916b5ca8 100644
--- a/test/CodeGenObjC/constant-strings.m
+++ b/test/CodeGenObjC/constant-strings.m
@@ -1,4 +1,6 @@
-// RUN: clang-cc -fnext-runtime -emit-llvm -o %t %s
+// RUN: clang-cc -fnext-runtime -emit-llvm -o %t %s &&
+// RUN: clang-cc -fgnu-runtime -emit-llvm -o %t %s && grep NXConstantString %t | count 1 &&
+// RUN: clang-cc -fgnu-runtime -fconstant-string-class=NSConstantString -emit-llvm -o %t %s && grep NSConstantString %t | count 1
id a = @"Hello World!";
diff --git a/test/CodeGenObjC/debug-info-linkagename.m b/test/CodeGenObjC/debug-info-linkagename.m
new file mode 100644
index 000000000000..730568954cb0
--- /dev/null
+++ b/test/CodeGenObjC/debug-info-linkagename.m
@@ -0,0 +1,17 @@
+// RUN: clang-cc -g -S -o %t %s &&
+// RUN: not grep 001 %t
+
+@interface F
+-(int) bar;
+@end
+
+@implementation F
+-(int) bar {
+ return 42;
+}
+@end
+
+extern int f(F *fn) {
+ return [fn bar];
+}
+
diff --git a/test/CodeGenObjC/for-in.m b/test/CodeGenObjC/for-in.m
new file mode 100644
index 000000000000..434ff796b335
--- /dev/null
+++ b/test/CodeGenObjC/for-in.m
@@ -0,0 +1,44 @@
+// RUN: clang-cc -emit-llvm %s -o %t
+
+void p(const char*, ...);
+
+@interface NSArray
++(NSArray*) arrayWithObjects: (id) first, ...;
+-(unsigned) count;
+@end
+@interface NSString
+-(const char*) cString;
+@end
+
+#define S(n) @#n
+#define L1(n) S(n+0),S(n+1)
+#define L2(n) L1(n+0),L1(n+2)
+#define L3(n) L2(n+0),L2(n+4)
+#define L4(n) L3(n+0),L3(n+8)
+#define L5(n) L4(n+0),L4(n+16)
+#define L6(n) L5(n+0),L5(n+32)
+
+void t0() {
+ NSArray *array = [NSArray arrayWithObjects: L1(0), (void*)0];
+
+ p("array.length: %d\n", [array count]);
+ unsigned index = 0;
+ for (NSString *i in array) {
+ p("element %d: %s\n", index++, [i cString]);
+ }
+}
+
+void t1() {
+ NSArray *array = [NSArray arrayWithObjects: L6(0), (void*)0];
+
+ p("array.length: %d\n", [array count]);
+ unsigned index = 0;
+ for (NSString *i in array) {
+ index++;
+ if (index == 10)
+ continue;
+ p("element %d: %s\n", index, [i cString]);
+ if (index == 55)
+ break;
+ }
+}
diff --git a/test/CodeGenObjC/ivar-layout-64-bitfields.m b/test/CodeGenObjC/ivar-layout-64-bitfields.m
new file mode 100644
index 000000000000..cb5611835f62
--- /dev/null
+++ b/test/CodeGenObjC/ivar-layout-64-bitfields.m
@@ -0,0 +1,40 @@
+// RUN: clang-cc -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
+@interface I
+{
+ struct {
+ unsigned int d : 1;
+ } bitfield;
+}
+@end
+
+@implementation I
+@end
+
+@interface J
+{
+ struct {
+ unsigned short _reserved : 16;
+
+ _Bool _draggedNodesAreDeletable: 1;
+ _Bool _draggedOutsideOutlineView : 1;
+ _Bool _adapterRespondsTo_addRootPaths : 1;
+ _Bool _adapterRespondsTo_moveDataNodes : 1;
+ _Bool _adapterRespondsTo_removeRootDataNode : 1;
+ _Bool _adapterRespondsTo_doubleClickDataNode : 1;
+ _Bool _adapterRespondsTo_selectDataNode : 1;
+ _Bool _adapterRespondsTo_textDidEndEditing : 1;
+
+ _Bool _adapterRespondsTo_updateAndSaveRoots : 1;
+ _Bool _adapterRespondsTo_askToDeleteRootNodes : 1;
+ _Bool _adapterRespondsTo_contextMenuForSelectedNodes : 1;
+ _Bool _adapterRespondsTo_pasteboardFilenamesForNodes : 1;
+ _Bool _adapterRespondsTo_writeItemsToPasteboard : 1;
+ _Bool _adapterRespondsTo_writeItemsToPasteboardXXXX : 1;
+ } _flags;
+}
+@end
+
+@implementation J
+@end
+
+
diff --git a/test/CodeGenObjC/ivar-layout-no-optimize.m b/test/CodeGenObjC/ivar-layout-no-optimize.m
new file mode 100644
index 000000000000..d7796bc279e1
--- /dev/null
+++ b/test/CodeGenObjC/ivar-layout-no-optimize.m
@@ -0,0 +1,18 @@
+// RUN: clang-cc -fobjc-gc -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s &&
+// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s &&
+// RUN: true
+
+@interface NSObject {
+ id isa;
+}
+@end
+
+@interface AllPointers : NSObject {
+ id foo;
+ void *__strong bar; NSObject *bletch;}
+@end
+@implementation AllPointers
+@end
+
+// CHECK-LP64: L_OBJC_CLASS_NAME_6:
+// CHECK-LP64-NEXT: .asciz "\004"
diff --git a/test/CodeGenObjC/messages.m b/test/CodeGenObjC/messages.m
index f9b9be6e11a3..b7f42d126d2b 100644
--- a/test/CodeGenObjC/messages.m
+++ b/test/CodeGenObjC/messages.m
@@ -2,8 +2,8 @@
// RUN: grep "objc_msgSend" %t | count 6 &&
// RUN: clang-cc -fgnu-runtime --emit-llvm -o %t %s &&
// RUN: grep "objc_msg_lookup" %t | count 6 &&
-// RUN: clang-cc -fgnu-runtime -fobjc-sender-dependent-dispatch --emit-llvm -o %t %s &&
-// RUN: grep "objc_msg_lookup_sender" %t | count 6
+// RUN: clang-cc -fgnu-runtime -fobjc-nonfragile-abi --emit-llvm -o %t %s &&
+// RUN: grep "objc_msg_lookup_sender" %t | count 6 &&
// RUN: true
typedef struct {
diff --git a/test/CodeGenObjC/objc-assign-ivar.m b/test/CodeGenObjC/objc-assign-ivar.m
new file mode 100644
index 000000000000..f79faaf23826
--- /dev/null
+++ b/test/CodeGenObjC/objc-assign-ivar.m
@@ -0,0 +1,53 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s &&
+// RUN: grep -F '@objc_assign_ivar' %t | count 14 &&
+// RUN: true
+
+typedef struct {
+ id element;
+ id elementArray[10];
+ __strong id cfElement;
+ __strong id cfElementArray[10];
+} struct_with_ids_t;
+
+
+@interface NSString @end
+
+@interface Foo {
+@public
+// assignments to any/all of these fields should generate objc_assign_ivar
+ __strong id dict;
+ __strong id dictArray[3];
+ id ivar;
+ id array[10];
+ id nsobject;
+ NSString *stringArray[10];
+ struct_with_ids_t inner;
+
+ Foo *obj[20];
+ short idx[5];
+}
+@end
+
+// The test cases
+int IvarAssigns;
+void *rhs = 0;
+#define ASSIGNTEST(expr, global) expr = rhs
+
+void testIvars() {
+ Foo *foo;
+ ASSIGNTEST(foo->ivar, IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->dict, IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->dictArray[0], IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->array[0], IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->nsobject, IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->stringArray[0], IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->inner.element, IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->inner.elementArray[0], IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->inner.cfElement, IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->inner.cfElementArray[0], IvarAssigns); // objc_assign_ivar
+ int counter=1;
+ ASSIGNTEST(foo->obj[5], IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->obj[++counter], IvarAssigns); // objc_assign_ivar
+ foo->idx[++counter] = 15;
+ ASSIGNTEST(foo->obj[foo->idx[2]], IvarAssigns); // objc_assign_ivar
+}
diff --git a/test/CodeGenObjC/objc-gc-aggr-assign.m b/test/CodeGenObjC/objc-gc-aggr-assign.m
new file mode 100644
index 000000000000..96a9fdf65409
--- /dev/null
+++ b/test/CodeGenObjC/objc-gc-aggr-assign.m
@@ -0,0 +1,46 @@
+// RUN: clang-cc -fnext-runtime -fobjc-gc -emit-llvm -o %t %s &&
+// RUN: grep objc_memmove_collectable %t | grep call | count 3
+
+static int count;
+
+typedef struct S {
+ int ii;
+} SS;
+
+struct type_s {
+ SS may_recurse;
+ id id_val;
+};
+
+@interface NamedObject
+{
+ struct type_s type_s_ivar;
+}
+- (void) setSome : (struct type_s) arg;
+- (struct type_s) getSome;
+@property(assign) struct type_s aggre_prop;
+@end
+
+@implementation NamedObject
+- (void) setSome : (struct type_s) arg
+ {
+ type_s_ivar = arg;
+ }
+- (struct type_s) getSome
+ {
+ return type_s_ivar;
+ }
+@synthesize aggre_prop = type_s_ivar;
+@end
+
+struct type_s some = {{1234}, (id)0};
+
+struct type_s get(void)
+{
+ return some;
+}
+
+void f(const struct type_s *in, struct type_s *out) {
+ *out = *in;
+}
+
diff --git a/test/CodeGenObjC/objc-read-weak-byref.m b/test/CodeGenObjC/objc-read-weak-byref.m
new file mode 100644
index 000000000000..7c297be56679
--- /dev/null
+++ b/test/CodeGenObjC/objc-read-weak-byref.m
@@ -0,0 +1,26 @@
+// RUN: clang-cc -fblocks -fobjc-gc -triple x86_64-apple-darwin -S %s -o %t-64.s &&
+// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s &&
+// RUN: clang-cc -fblocks -fobjc-gc -triple i386-apple-darwin -S %s -o %t-32.s &&
+// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s &&
+// RUN: true
+
+@interface NSObject
+- copy;
+@end
+
+int main() {
+ NSObject *object = 0;
+ __weak __block NSObject* weak_object = object;
+ void (^callback) (void) = [^{
+ if (weak_object)
+ [weak_object copy];
+ } copy];
+ callback();
+ return 0;
+}
+
+// CHECK-LP64: call _objc_read_weak
+// CHECK-LP64: call _objc_read_weak
+
+// CHECK-LP32: call L_objc_read_weak
+// CHECK-LP32: call L_objc_read_weak
diff --git a/test/CodeGenObjC/objc2-assign-global.m b/test/CodeGenObjC/objc2-assign-global.m
index ae407619093e..9b6b4151f6a0 100644
--- a/test/CodeGenObjC/objc2-assign-global.m
+++ b/test/CodeGenObjC/objc2-assign-global.m
@@ -1,8 +1,81 @@
-// RUN: clang-cc -fnext-runtime -fobjc-gc -emit-llvm -o %t %s &&
-// RUN: grep -F '@objc_assign_global' %t | count 2 &&
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fnext-runtime -fobjc-gc -emit-llvm -o %t %s &&
+// RUN: grep -F '@objc_assign_global' %t | count 26 &&
// RUN: true
-id a;
+
+@class NSObject;
+typedef const struct __CFDictionary * CFDictionaryRef;
+typedef struct {
+ id element;
+ id elementArray[10];
+ __strong CFDictionaryRef cfElement;
+ __strong CFDictionaryRef cfElementArray[10];
+} struct_with_ids_t;
+
+
+// assignments to these should generate objc_assign_global
+@interface A
+@end
+
+typedef struct s0 {
+ A *a[4];
+} T;
+
+T g0;
+
+extern id FileExternID;
+static id FileStaticID;
+id GlobalId;
+id GlobalArray[20];
+NSObject *GlobalObject;
+NSObject *GlobalObjectArray[20];
+__strong CFDictionaryRef Gdict;
+__strong CFDictionaryRef Gdictarray[10];
+struct_with_ids_t GlobalStruct;
+struct_with_ids_t GlobalStructArray[10];
+
+#define ASSIGNTEST(expr, global) expr = rhs
+void *rhs = 0;
+
int main() {
- a = 0;
-}
+ static id staticGlobalId;
+ static id staticGlobalArray[20];
+ static NSObject *staticGlobalObject;
+ static NSObject *staticGlobalObjectArray[20];
+ static __strong CFDictionaryRef staticGdict;
+ static __strong CFDictionaryRef staticGdictarray[10];
+ static struct_with_ids_t staticGlobalStruct;
+ static struct_with_ids_t staticGlobalStructArray[10];
+ extern id ExID;
+ id localID;
+
+ ASSIGNTEST(GlobalId, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(GlobalArray[0], GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(GlobalObject, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(GlobalObjectArray[0], GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(Gdict, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(Gdictarray[1], GlobalAssigns); // objc_assign_global
+
+ ASSIGNTEST(GlobalStruct.element, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(GlobalStruct.elementArray[0], GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(GlobalStruct.cfElement, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(GlobalStruct.cfElementArray[0], GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGlobalId, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGlobalArray[0], GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGlobalObject, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGlobalObjectArray[0], GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGdict, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGdictarray[1], GlobalAssigns); // objc_assign_global
+
+ ASSIGNTEST(staticGlobalStruct.element, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGlobalStruct.elementArray[0], GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGlobalStruct.cfElement, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGlobalStruct.cfElementArray[0], GlobalAssigns); // objc_assign_global
+
+ ExID = 0;
+ localID = 0;
+ FileStaticID = 0;
+ FileExternID=0;
+ g0.a[0] = 0;
+ ((T*) &g0)->a[0] = 0;
+}
diff --git a/test/CodeGenObjC/objc2-ivar-assign.m b/test/CodeGenObjC/objc2-ivar-assign.m
new file mode 100644
index 000000000000..cfdf87f2f12b
--- /dev/null
+++ b/test/CodeGenObjC/objc2-ivar-assign.m
@@ -0,0 +1,41 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s &&
+// RUN: grep objc_assign_ivar %t | count 6 &&
+// RUN: true
+
+@interface I @end
+
+typedef I TI;
+typedef I* TPI;
+
+typedef id ID;
+
+@interface MyClass {
+}
+
+@property id property;
+@property I* propertyI;
+
+@property TI* propertyTI;
+
+@property TPI propertyTPI;
+
+@property ID propertyID;
+@end
+
+@implementation MyClass
+ @synthesize property=_property;
+ @synthesize propertyI;
+ @synthesize propertyTI=_propertyTI;
+ @synthesize propertyTPI=_propertyTPI;
+ @synthesize propertyID = _propertyID;
+@end
+
+int main () {
+ MyClass *myObj;
+ myObj.property = 0;
+ myObj.propertyI = 0;
+ myObj.propertyTI = 0;
+ myObj.propertyTPI = 0;
+ myObj.propertyID = 0;
+ return 0;
+}
diff --git a/test/CodeGenObjC/objc2-new-gc-api-strongcast.m b/test/CodeGenObjC/objc2-new-gc-api-strongcast.m
new file mode 100644
index 000000000000..6a1aea6a7340
--- /dev/null
+++ b/test/CodeGenObjC/objc2-new-gc-api-strongcast.m
@@ -0,0 +1,26 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fblocks -fnext-runtime -fobjc-gc -emit-llvm -o %t %s &&
+// RUN: grep -F '@objc_assign_strongCast' %t | count 4 &&
+// RUN: true
+
+@interface DSATextSearch @end
+
+DSATextSearch **_uniqueIdToIdentifierArray = ((void *)0);
+void foo (int _nextId)
+{
+ _uniqueIdToIdentifierArray[_nextId] = 0; // objc_assign_strongCast
+}
+
+typedef struct {
+ unsigned long state;
+ id *itemsPtr;
+ void (^bp)();
+ unsigned long *mutationsPtr;
+ unsigned long extra[5];
+} NSFastEnumerationState;
+
+void foo1 (NSFastEnumerationState * state)
+{
+ state->itemsPtr = 0;
+ state->bp = ^{};
+}
+
diff --git a/test/CodeGenObjC/objc2-weak-assign.m b/test/CodeGenObjC/objc2-weak-assign.m
index a3740b207e85..635ca38df46c 100644
--- a/test/CodeGenObjC/objc2-weak-assign.m
+++ b/test/CodeGenObjC/objc2-weak-assign.m
@@ -9,6 +9,10 @@ __weak id* a1[20];
id* __weak a2[30];
id** __weak a3[40];
+void foo (__weak id *param) {
+ *param = 0;
+}
+
int main()
{
*x = 0;
diff --git a/test/CodeGenObjC/objc2-weak-ivar-debug.m b/test/CodeGenObjC/objc2-weak-ivar-debug.m
new file mode 100644
index 000000000000..24a7757b9acf
--- /dev/null
+++ b/test/CodeGenObjC/objc2-weak-ivar-debug.m
@@ -0,0 +1,15 @@
+// RUN: clang-cc -triple x86_64-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s &&
+// RUN: clang-cc -triple i386-apple-darwin9 -fobjc-gc -g -emit-llvm -o - %s
+
+// rdar://7252252
+@interface Loop {
+@public
+ __weak Loop *_loop;
+}
+@end
+
+@implementation Loop @end
+
+void loop(Loop *L) {
+ L->_loop = 0;
+}
diff --git a/test/CodeGenObjC/objc2-write-barrier-2.m b/test/CodeGenObjC/objc2-write-barrier-2.m
new file mode 100644
index 000000000000..c47224f1c516
--- /dev/null
+++ b/test/CodeGenObjC/objc2-write-barrier-2.m
@@ -0,0 +1,80 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fnext-runtime -fobjc-gc -emit-llvm -o %t %s &&
+// RUN: grep -F '@objc_assign_global' %t | count 7 &&
+// RUN: grep -F '@objc_assign_ivar' %t | count 5 &&
+// RUN: grep -F '@objc_assign_strongCast' %t | count 8 &&
+// RUN: true
+
+extern id **somefunc(void);
+extern id *somefunc2(void);
+
+
+// Globals
+
+id W, *X, **Y;
+
+void func(id a, id *b, id **c) {
+ static id w, *x, **y;
+ W = a;
+ w = a;
+ X = b;
+ x = b;
+ Y = c;
+ y = c;
+}
+
+// Instances
+
+@interface something {
+ id w, *x, **y;
+}
+@end
+
+@implementation something
+- (void)amethod {
+ id badIdea = *somefunc2();
+ w = badIdea;
+ x = &badIdea;
+ y = &x;
+}
+@end
+
+typedef struct {
+ int junk;
+ id alfred;
+} AStruct;
+
+void funct2(AStruct *aptr) {
+ id **ppptr = somefunc();
+ aptr->alfred = 0;
+ **ppptr = aptr->alfred;
+ *ppptr = somefunc2();
+}
+
+typedef const struct __CFString * CFStringRef;
+@interface DSATextSearch {
+__strong CFStringRef *_documentNames;
+ struct {
+ id *innerNames;
+ struct {
+ id *nestedDeeperNames;
+ struct I {
+ id *is1;
+ id is2[5];
+ } arrI [3];
+ } inner_most;
+ } inner;
+
+}
+- filter;
+@end
+@implementation DSATextSearch
+- filter {
+ int filteredPos = 0;
+ _documentNames[filteredPos] = 0; // storing into an element of array ivar. objc_assign_strongCast is needed.
+ inner.innerNames[filteredPos] = 0;
+ inner.inner_most.nestedDeeperNames[filteredPos] = 0;
+ inner.inner_most.arrI[3].is1[5] = 0;
+ inner.inner_most.arrI[3].is2[5] = 0;
+}
+@end
+
diff --git a/test/CodeGenObjC/objc2-write-barrier-3.m b/test/CodeGenObjC/objc2-write-barrier-3.m
new file mode 100644
index 000000000000..2fb416b79b2f
--- /dev/null
+++ b/test/CodeGenObjC/objc2-write-barrier-3.m
@@ -0,0 +1,47 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s &&
+// RUN: grep objc_assign_ivar %t | count 3 &&
+// RUN: grep objc_assign_strongCast %t | count 6 &&
+// RUN: true
+
+struct Slice {
+ void *__strong * items;
+};
+
+typedef struct Slice Slice;
+
+@interface ISlice {
+@public
+ void *__strong * IvarItem;
+}
+@end
+
+typedef void (^observer_block_t)(id object);
+@interface Observer {
+@public
+ observer_block_t block;
+}
+@end
+
+
+void foo (int i) {
+ // storing into an array of strong pointer types.
+ void *__strong* items;
+ items[i] = 0;
+
+ // storing indirectly into an array of strong pointer types.
+ void *__strong* *vitems;
+ *vitems[i] = 0;
+
+ Slice *slice;
+ slice->items = 0;
+ // storing into a struct element of an array of strong pointer types.
+ slice->items[i] = 0;
+
+ ISlice *islice;
+ islice->IvarItem = 0;
+ // Storing into an ivar of an array of strong pointer types.
+ islice->IvarItem[i] = (void*)0;
+
+ Observer *observer;
+ observer->block = 0;
+}
diff --git a/test/CodeGenObjC/objc2-write-barrier-4.m b/test/CodeGenObjC/objc2-write-barrier-4.m
new file mode 100644
index 000000000000..f96a233787b0
--- /dev/null
+++ b/test/CodeGenObjC/objc2-write-barrier-4.m
@@ -0,0 +1,28 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s &&
+// RUN: grep objc_assign_global %t | count 3 &&
+// RUN: grep objc_assign_strongCast %t | count 2 &&
+// RUN: true
+
+@interface A
+@end
+
+typedef struct s0 {
+ A *a[4];
+} T;
+
+T g0;
+
+void f0(id x) {
+ g0.a[0] = x;
+}
+
+void f1(id x) {
+ ((T*) &g0)->a[0] = x;
+}
+
+void f2(unsigned idx)
+{
+ id *keys;
+ keys[idx] = 0;
+}
+
diff --git a/test/CodeGenObjC/objc2-write-barrier-5.m b/test/CodeGenObjC/objc2-write-barrier-5.m
new file mode 100644
index 000000000000..5b8f02cc1e16
--- /dev/null
+++ b/test/CodeGenObjC/objc2-write-barrier-5.m
@@ -0,0 +1,27 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s &&
+// RUN: grep objc_assign_ivar %t | count 0 &&
+// RUN: grep objc_assign_strongCast %t | count 5 &&
+// RUN: true
+
+@interface TestUnarchiver
+{
+ void *allUnarchivedObjects;
+}
+@end
+
+@implementation TestUnarchiver
+
+struct unarchive_list {
+ int ifield;
+ id *list;
+};
+
+- (id)init {
+ (*((struct unarchive_list *)allUnarchivedObjects)).list = 0;
+ ((struct unarchive_list *)allUnarchivedObjects)->list = 0;
+ (**((struct unarchive_list **)allUnarchivedObjects)).list = 0;
+ (*((struct unarchive_list **)allUnarchivedObjects))->list = 0;
+ return 0;
+}
+
+@end
diff --git a/test/CodeGenObjC/objc2-write-barrier.m b/test/CodeGenObjC/objc2-write-barrier.m
new file mode 100644
index 000000000000..53fa10a7a75f
--- /dev/null
+++ b/test/CodeGenObjC/objc2-write-barrier.m
@@ -0,0 +1,114 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -fnext-runtime -fobjc-gc -emit-llvm -o %t %s &&
+// RUN: grep -F '@objc_assign_global' %t | count 21 &&
+// RUN: grep -F '@objc_assign_ivar' %t | count 11 &&
+// RUN: true
+
+
+typedef const struct __CFDictionary * CFDictionaryRef;
+
+// callouts to these are generated with cc -fobjc-gc
+
+int GlobalAssigns;
+int IvarAssigns;
+int StrongCastAssigns;
+
+
+// The test case elements;
+@class NSObject;
+@class NSString;
+
+typedef struct {
+ id element;
+ id elementArray[10];
+ __strong CFDictionaryRef cfElement;
+ __strong CFDictionaryRef cfElementArray[10];
+} struct_with_ids_t;
+
+@interface Foo {
+@public
+// assignments to any/all of these fields should generate objc_assign_ivar
+ __strong CFDictionaryRef dict;
+ __strong CFDictionaryRef dictArray[3];
+ id ivar;
+ id array[10];
+ NSObject *nsobject;
+ NSString *stringArray[10];
+ struct_with_ids_t inner;
+}
+
+@end
+
+// assignments to these should generate objc_assign_global
+id GlobalId;
+id GlobalArray[20];
+NSObject *GlobalObject;
+NSObject *GlobalObjectArray[20];
+__strong CFDictionaryRef Gdict;
+__strong CFDictionaryRef Gdictarray[10];
+struct_with_ids_t GlobalStruct;
+struct_with_ids_t GlobalStructArray[10];
+
+
+// The test cases
+void *rhs = 0;
+
+#define ASSIGNTEST(expr, global) expr = rhs
+
+int testGlobals() {
+ // Everything in this function generates assign_global intercepts
+ int counter = 0;
+
+ static id staticGlobalId;
+ static id staticGlobalArray[20];
+ static NSObject *staticGlobalObject;
+ static NSObject *staticGlobalObjectArray[20];
+ static __strong CFDictionaryRef staticGdict;
+ static __strong CFDictionaryRef staticGdictarray[10];
+ static struct_with_ids_t staticGlobalStruct;
+ static struct_with_ids_t staticGlobalStructArray[10];
+
+ ASSIGNTEST(GlobalId, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(GlobalArray[0], GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(GlobalObject, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(GlobalObjectArray[0], GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(Gdict, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(Gdictarray[1], GlobalAssigns); // objc_assign_global
+
+ ASSIGNTEST(GlobalStruct.element, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(GlobalStruct.elementArray[0], GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(GlobalStruct.cfElement, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(GlobalStruct.cfElementArray[0], GlobalAssigns); // objc_assign_global
+
+ ASSIGNTEST(staticGlobalId, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGlobalArray[0], GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGlobalObject, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGlobalObjectArray[0], GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGdict, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGdictarray[1], GlobalAssigns); // objc_assign_global
+
+ ASSIGNTEST(staticGlobalStruct.element, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGlobalStruct.elementArray[0], GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGlobalStruct.cfElement, GlobalAssigns); // objc_assign_global
+ ASSIGNTEST(staticGlobalStruct.cfElementArray[0], GlobalAssigns); // objc_assign_global
+
+ return counter;
+}
+
+
+int testIvars() {
+ Foo *foo;
+ int counter = 0;
+
+ ASSIGNTEST(foo->ivar, IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->dict, IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->dictArray[0], IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->array[0], IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->nsobject, IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->stringArray[0], IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->inner.element, IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->inner.elementArray[0], IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->inner.cfElement, IvarAssigns); // objc_assign_ivar
+ ASSIGNTEST(foo->inner.cfElementArray[0], IvarAssigns); // objc_assign_ivar
+
+ return counter;
+}
diff --git a/test/CodeGenObjC/object-incr-decr-1.m b/test/CodeGenObjC/object-incr-decr-1.m
new file mode 100644
index 000000000000..53311f7aa18c
--- /dev/null
+++ b/test/CodeGenObjC/object-incr-decr-1.m
@@ -0,0 +1,19 @@
+// RUN: clang-cc -triple i386-apple-darwin9 -fnext-runtime -emit-llvm %s -o %t
+
+@interface Foo
+{
+ double d1,d3,d4;
+}
+@end
+
+Foo* foo()
+{
+ Foo *f;
+
+ // Both of these crash clang nicely
+ ++f;
+ --f;
+ f--;
+ f++;
+ return f;
+}
diff --git a/test/CodeGenObjC/overloadable.m b/test/CodeGenObjC/overloadable.m
index 972dc4ed5895..7e9cc3d3b36d 100644
--- a/test/CodeGenObjC/overloadable.m
+++ b/test/CodeGenObjC/overloadable.m
@@ -4,7 +4,7 @@
@class C;
// RUN: grep _Z1fP11objc_object %t | count 1 &&
-void __attribute__((overloadable)) f(C *c) { }
+void __attribute__((overloadable)) f(id c) { }
// RUN: grep _Z1fP1C %t | count 1
-void __attribute__((overloadable)) f(id c) { }
+void __attribute__((overloadable)) f(C *c) { }
diff --git a/test/CodeGenObjC/predefined-expr.m b/test/CodeGenObjC/predefined-expr.m
new file mode 100644
index 000000000000..b27bb3488a5a
--- /dev/null
+++ b/test/CodeGenObjC/predefined-expr.m
@@ -0,0 +1,90 @@
+// RUN: clang-cc -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck %s
+
+// CHECK: @"__func__.-[Foo instanceTest1]" = private constant [21 x i8] c"-[Foo instanceTest1]\00"
+// CHECK: @"__func__.-[Foo instanceTest2:]" = private constant [22 x i8] c"-[Foo instanceTest2:]\00"
+// CHECK: @"__func__.-[Foo instanceTest3:withB:]" = private constant [28 x i8] c"-[Foo instanceTest3:withB:]\00"
+// CHECK: @"__func__.-[Foo instanceTest4]" = private constant [21 x i8] c"-[Foo instanceTest4]\00"
+// CHECK: @"__func__.+[Foo classTest1]" = private constant [18 x i8] c"+[Foo classTest1]\00"
+// CHECK: @"__func__.+[Foo classTest2:]" = private constant [19 x i8] c"+[Foo classTest2:]\00"
+// CHECK: @"__func__.+[Foo classTest3:withB:]" = private constant [25 x i8] c"+[Foo classTest3:withB:]\00"
+// CHECK: @"__func__.+[Foo classTest4]" = private constant [18 x i8] c"+[Foo classTest4]\00"
+// CHECK: @"__func__.-[Foo(Category) instanceTestWithCategory]" = private constant [42 x i8] c"-[Foo(Category) instanceTestWithCategory]\00"
+// CHECK: @"__func__.+[Foo(Category) classTestWithCategory]" = private constant [39 x i8] c"+[Foo(Category) classTestWithCategory]\00"
+
+int printf(const char * _Format, ...);
+
+@interface Foo
+@end
+
+@implementation Foo
+
+- (void)instanceTest1 {
+ printf("__func__: %s\n", __func__);
+ printf("__FUNCTION__: %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__: %s\n\n", __PRETTY_FUNCTION__);
+}
+
+- (void)instanceTest2:(int)i {
+ printf("__func__: %s\n", __func__);
+ printf("__FUNCTION__: %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__: %s\n\n", __PRETTY_FUNCTION__);
+}
+
+- (void)instanceTest3:(int)a withB:(double)b {
+ printf("__func__: %s\n", __func__);
+ printf("__FUNCTION__: %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__: %s\n\n", __PRETTY_FUNCTION__);
+}
+
+- (int)instanceTest4 {
+ printf("__func__: %s\n", __func__);
+ printf("__FUNCTION__: %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__: %s\n\n", __PRETTY_FUNCTION__);
+ return 0;
+}
+
++ (void)classTest1 {
+ printf("__func__: %s\n", __func__);
+ printf("__FUNCTION__: %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__: %s\n\n", __PRETTY_FUNCTION__);
+}
+
++ (void)classTest2:(int)i {
+ printf("__func__: %s\n", __func__);
+ printf("__FUNCTION__: %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__: %s\n\n", __PRETTY_FUNCTION__);
+}
+
++ (void)classTest3:(int)a withB:(double)b {
+ printf("__func__: %s\n", __func__);
+ printf("__FUNCTION__: %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__: %s\n\n", __PRETTY_FUNCTION__);
+}
+
++ (int)classTest4 {
+ printf("__func__: %s\n", __func__);
+ printf("__FUNCTION__: %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__: %s\n\n", __PRETTY_FUNCTION__);
+ return 0;
+}
+
+@end
+
+@interface Foo (Category)
+@end
+
+@implementation Foo (Category)
+
+- (void)instanceTestWithCategory {
+ printf("__func__: %s\n", __func__);
+ printf("__FUNCTION__: %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__: %s\n\n", __PRETTY_FUNCTION__);
+}
+
++ (void)classTestWithCategory {
+ printf("__func__: %s\n", __func__);
+ printf("__FUNCTION__: %s\n", __FUNCTION__);
+ printf("__PRETTY_FUNCTION__: %s\n\n", __PRETTY_FUNCTION__);
+}
+
+@end
diff --git a/test/CodeGenObjC/property-agrr-getter.m b/test/CodeGenObjC/property-agrr-getter.m
index 0a1df123bffe..46205796936f 100644
--- a/test/CodeGenObjC/property-agrr-getter.m
+++ b/test/CodeGenObjC/property-agrr-getter.m
@@ -9,9 +9,30 @@ typedef struct {
@end
@implementation A
--(s0) f0{}
+-(s0) f0{ while (1) {} }
- (unsigned) bar {
return self.f0.f0;
}
@end
+
+typedef struct _NSSize {
+ float width;
+ float height;
+} NSSize;
+
+
+@interface AnObject
+{
+ NSSize size;
+}
+
+@property NSSize size;
+
+@end
+
+float f ()
+{
+ AnObject* obj;
+ return (obj.size).width;
+}
diff --git a/test/CodeGenObjC/property-setter-attr.m b/test/CodeGenObjC/property-setter-attr.m
index 390392415d73..5f0edf8271e7 100644
--- a/test/CodeGenObjC/property-setter-attr.m
+++ b/test/CodeGenObjC/property-setter-attr.m
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm -triple=i686-apple-darwin8 -o %t %s
+// RUN: clang-cc -emit-llvm -triple=i686-apple-darwin8 -o %t %s &&
// RUN: grep -e "SiSetOtherThings:" %t
@interface A
diff --git a/test/CodeGenObjC/protocol-in-extended-class.m b/test/CodeGenObjC/protocol-in-extended-class.m
new file mode 100644
index 000000000000..87bda46faeaa
--- /dev/null
+++ b/test/CodeGenObjC/protocol-in-extended-class.m
@@ -0,0 +1,29 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -S %s -o %t-64.s &&
+// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s &&
+// RUN: clang-cc -triple i386-apple-darwin -S %s -o %t-32.s &&
+// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s &&
+// RUN: true
+
+@protocol MyProtocol
+@end
+
+@protocol ExtendedProtocol
+@end
+
+@interface ItDoesntWork<MyProtocol> {
+}
+-(void) Meth;
+@end
+
+@interface ItDoesntWork() <MyProtocol, ExtendedProtocol>
+@end
+
+@implementation ItDoesntWork
+-(void) Meth {
+ ItDoesntWork <MyProtocol, ExtendedProtocol> *p = 0;
+ }
+@end
+
+// CHECK-LP64: l_OBJC_PROTOCOL_$_ExtendedProtocol:
+
+// CHECK-LP32: L_OBJC_PROTOCOL_ExtendedProtocol:
diff --git a/test/CodeGenObjC/protocols-lazy.m b/test/CodeGenObjC/protocols-lazy.m
index e91cc0aea836..a8f79026f780 100644
--- a/test/CodeGenObjC/protocols-lazy.m
+++ b/test/CodeGenObjC/protocols-lazy.m
@@ -26,7 +26,7 @@ void f1() { id x = @protocol(P3); }
// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P4 %t | count 3 &&
@protocol P4 -im1; @end
@interface I0<P4> @end
-@implementation I0 -im1 {}; @end
+@implementation I0 -im1 { return 0; }; @end
// Definition following forward reference.
// RUN: grep OBJC_PROTOCOL_P5 %t | count 3 &&
@@ -42,7 +42,7 @@ void f2() { id x = @protocol(P5); } // This generates a forward
// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P6 %t | count 3 &&
@protocol P6 -im1; @end
@interface I1<P6> @end
-@implementation I1 -im1 {}; @end
+@implementation I1 -im1 { return 0; }; @end
void f3() { id x = @protocol(P6); }
// RUN: true
diff --git a/test/CodeGenObjC/protocols.m b/test/CodeGenObjC/protocols.m
new file mode 100644
index 000000000000..4cfb83bf00e0
--- /dev/null
+++ b/test/CodeGenObjC/protocols.m
@@ -0,0 +1,50 @@
+// RUN: clang-cc -fnext-runtime -emit-llvm %s -o %t
+
+void p(const char*, ...);
+
+@interface Root
+-(int) conformsTo: (id) x;
+@end
+
+@protocol P0;
+
+@protocol P1
++(void) classMethodReq0;
+-(void) methodReq0;
+@optional
++(void) classMethodOpt1;
+-(void) methodOpt1;
+@required
++(void) classMethodReq2;
+-(void) methodReq2;
+@end
+
+@protocol P2
+//@property(readwrite) int x;
+@end
+
+@protocol P3<P1, P2>
+-(id <P1>) print0;
+-(void) print1;
+@end
+
+void foo(const id a) {
+ void *p = @protocol(P3);
+}
+
+int main() {
+ Protocol *P0 = @protocol(P0);
+ Protocol *P1 = @protocol(P1);
+ Protocol *P2 = @protocol(P2);
+ Protocol *P3 = @protocol(P3);
+
+#define Pbool(X) p(#X ": %s\n", X ? "yes" : "no");
+ Pbool([P0 conformsTo: P1]);
+ Pbool([P1 conformsTo: P0]);
+ Pbool([P1 conformsTo: P2]);
+ Pbool([P2 conformsTo: P1]);
+ Pbool([P3 conformsTo: P1]);
+ Pbool([P1 conformsTo: P3]);
+
+ return 0;
+}
diff --git a/test/CodeGenObjC/variadic-sends.m b/test/CodeGenObjC/variadic-sends.m
new file mode 100644
index 000000000000..8697feec5d6d
--- /dev/null
+++ b/test/CodeGenObjC/variadic-sends.m
@@ -0,0 +1,41 @@
+// RUN: clang-cc -triple i386-unknown-unknown -fnext-runtime -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-32 %s &&
+// RUN: clang-cc -triple x86_64-unknown-unknown -fnext-runtime -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s
+
+@interface A
+-(void) im0;
+-(void) im1: (int) x;
+-(void) im2: (int) x, ...;
+@end
+
+void f0(A *a) {
+ // CHECK-X86-32: call void bitcast (i8* (i8*, %struct.objc_selector*, ...)* @objc_msgSend to void (i8*, %struct.objc_selector*)*)
+ // CHECK-X86-64: call void bitcast (i8* (i8*, %struct.objc_selector*, ...)* @objc_msgSend to void (i8*, %struct.objc_selector*)*)
+ [a im0];
+}
+
+void f1(A *a) {
+ // CHECK-X86-32: call void bitcast (i8* (i8*, %struct.objc_selector*, ...)* @objc_msgSend to void (i8*, %struct.objc_selector*, i32)*)
+ // CHECK-X86-64: call void bitcast (i8* (i8*, %struct.objc_selector*, ...)* @objc_msgSend to void (i8*, %struct.objc_selector*, i32)*)
+ [a im1: 1];
+}
+
+void f2(A *a) {
+ // CHECK-X86-32: call void (i8*, %struct.objc_selector*, i32, i32, ...)* bitcast (i8* (i8*, %struct.objc_selector*, ...)* @objc_msgSend to void (i8*, %struct.objc_selector*, i32, i32, ...)*)
+ // CHECK-X86-64: call void (i8*, %struct.objc_selector*, i32, i32, ...)* bitcast (i8* (i8*, %struct.objc_selector*, ...)* @objc_msgSend to void (i8*, %struct.objc_selector*, i32, i32, ...)*)
+ [a im2: 1, 2];
+}
+
+@interface B : A @end
+@implementation B : A
+-(void) foo {
+ // CHECK-X86-32: call void bitcast (i8* (%struct._objc_super*, %struct.objc_selector*, ...)* @objc_msgSendSuper to void (%struct._objc_super*, %struct.objc_selector*, i32)*)
+ // CHECK-X86-64: call void bitcast (i8* (%struct._objc_super*, %struct.objc_selector*, ...)* @objc_msgSendSuper to void (%struct._objc_super*, %struct.objc_selector*, i32)*)
+ [super im1: 1];
+}
+-(void) bar {
+ // CHECK-X86-32: call void (%struct._objc_super*, %struct.objc_selector*, i32, i32, ...)* bitcast (i8* (%struct._objc_super*, %struct.objc_selector*, ...)* @objc_msgSendSuper to void (%struct._objc_super*, %struct.objc_selector*, i32, i32, ...)*)
+ // CHECK-X86-64: call void (%struct._objc_super*, %struct.objc_selector*, i32, i32, ...)* bitcast (i8* (%struct._objc_super*, %struct.objc_selector*, ...)* @objc_msgSendSuper to void (%struct._objc_super*, %struct.objc_selector*, i32, i32, ...)*)
+ [super im2: 1, 2];
+}
+
+@end