aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenObjCXX
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGenObjCXX')
-rw-r--r--test/CodeGenObjCXX/2007-10-03-MetadataPointers.mm7
-rw-r--r--test/CodeGenObjCXX/2010-08-04-Template.mm10
-rw-r--r--test/CodeGenObjCXX/2010-08-06-X.Y-syntax.mm16
-rw-r--r--test/CodeGenObjCXX/arc-globals.mm2
-rw-r--r--test/CodeGenObjCXX/arc-mangle.mm2
-rw-r--r--test/CodeGenObjCXX/arc-move.mm2
-rw-r--r--test/CodeGenObjCXX/arc-new-delete.mm2
-rw-r--r--test/CodeGenObjCXX/arc-pseudo-destructors.mm2
-rw-r--r--test/CodeGenObjCXX/arc-references.mm7
-rw-r--r--test/CodeGenObjCXX/arc-returns-inner-reference-ptr.mm22
-rw-r--r--test/CodeGenObjCXX/arc-special-member-functions.mm18
-rw-r--r--test/CodeGenObjCXX/arc.mm47
-rw-r--r--test/CodeGenObjCXX/block-in-template-inst.mm2
-rw-r--r--test/CodeGenObjCXX/block-var-layout.mm2
-rw-r--r--test/CodeGenObjCXX/blocks.mm6
-rw-r--r--test/CodeGenObjCXX/catch-id-type.mm7
-rw-r--r--test/CodeGenObjCXX/copy.mm17
-rw-r--r--test/CodeGenObjCXX/copyable-property-object.mm2
-rw-r--r--test/CodeGenObjCXX/encode.mm41
-rw-r--r--test/CodeGenObjCXX/exceptions.mm5
-rw-r--r--test/CodeGenObjCXX/gc.mm2
-rw-r--r--test/CodeGenObjCXX/implicit-copy-assign-operator.mm2
-rw-r--r--test/CodeGenObjCXX/implicit-copy-constructor.mm2
-rw-r--r--test/CodeGenObjCXX/mangle-blocks.mm2
-rw-r--r--test/CodeGenObjCXX/message-reference.mm2
-rw-r--r--test/CodeGenObjCXX/nrvo.mm32
-rw-r--r--test/CodeGenObjCXX/property-derived-to-base-conv.mm2
-rw-r--r--test/CodeGenObjCXX/property-dot-copy.mm2
-rw-r--r--test/CodeGenObjCXX/property-dot-reference.mm2
-rw-r--r--test/CodeGenObjCXX/property-object-conditional-exp.mm2
-rw-r--r--test/CodeGenObjCXX/property-object-reference.mm23
-rw-r--r--test/CodeGenObjCXX/property-objects.mm2
-rw-r--r--test/CodeGenObjCXX/property-reference.mm52
-rw-r--r--test/CodeGenObjCXX/refence-assign-write-barrier.mm2
-rw-r--r--test/CodeGenObjCXX/selector-expr-lvalue.mm2
-rw-r--r--test/CodeGenObjCXX/write-barrier-global-assign.mm2
36 files changed, 296 insertions, 56 deletions
diff --git a/test/CodeGenObjCXX/2007-10-03-MetadataPointers.mm b/test/CodeGenObjCXX/2007-10-03-MetadataPointers.mm
new file mode 100644
index 000000000000..2564d67ee501
--- /dev/null
+++ b/test/CodeGenObjCXX/2007-10-03-MetadataPointers.mm
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
+
+@class NSImage;
+void bork() {
+ NSImage *nsimage;
+ [nsimage release];
+}
diff --git a/test/CodeGenObjCXX/2010-08-04-Template.mm b/test/CodeGenObjCXX/2010-08-04-Template.mm
new file mode 100644
index 000000000000..c53e3cb6da44
--- /dev/null
+++ b/test/CodeGenObjCXX/2010-08-04-Template.mm
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+struct TRunSoon {
+ template <class P1> static void Post() {}
+};
+
+@implementation TPrivsTableViewMainController
+- (void) applyToEnclosed {
+ TRunSoon::Post<int>();
+}
+@end
diff --git a/test/CodeGenObjCXX/2010-08-06-X.Y-syntax.mm b/test/CodeGenObjCXX/2010-08-06-X.Y-syntax.mm
new file mode 100644
index 000000000000..290aaf67bbfd
--- /dev/null
+++ b/test/CodeGenObjCXX/2010-08-06-X.Y-syntax.mm
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+struct TFENode {
+ TFENode(const TFENode& inNode);
+};
+
+@interface TIconViewController
+- (const TFENode&) target;
+@end
+
+void sortAllChildrenForNode(const TFENode&node);
+
+@implementation TIconViewController
+- (void) setArrangeBy {
+ sortAllChildrenForNode(self.target);
+}
+@end
diff --git a/test/CodeGenObjCXX/arc-globals.mm b/test/CodeGenObjCXX/arc-globals.mm
index 7167dbc366d0..958d1d872c28 100644
--- a/test/CodeGenObjCXX/arc-globals.mm
+++ b/test/CodeGenObjCXX/arc-globals.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fblocks -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s
// Test that we're properly retaining lifetime-qualified pointers
// initialized statically and wrapping up those initialization in an
diff --git a/test/CodeGenObjCXX/arc-mangle.mm b/test/CodeGenObjCXX/arc-mangle.mm
index 1955348f1c32..c2b5817c73b3 100644
--- a/test/CodeGenObjCXX/arc-mangle.mm
+++ b/test/CodeGenObjCXX/arc-mangle.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-arc -fobjc-runtime-has-weak -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -emit-llvm -o - %s | FileCheck %s
// CHECK: define void @_Z1fPU8__strongP11objc_object(i8**)
void f(__strong id *) {}
diff --git a/test/CodeGenObjCXX/arc-move.mm b/test/CodeGenObjCXX/arc-move.mm
index 70469e6a8586..cf3051dd1fe6 100644
--- a/test/CodeGenObjCXX/arc-move.mm
+++ b/test/CodeGenObjCXX/arc-move.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fblocks -fobjc-arc -O2 -std=c++0x -disable-llvm-optzns -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -O2 -std=c++11 -disable-llvm-optzns -o - %s | FileCheck %s
// define void @_Z11simple_moveRU8__strongP11objc_objectS2_
void simple_move(__strong id &x, __strong id &y) {
diff --git a/test/CodeGenObjCXX/arc-new-delete.mm b/test/CodeGenObjCXX/arc-new-delete.mm
index 4597985f8dfe..a778bcad8fa7 100644
--- a/test/CodeGenObjCXX/arc-new-delete.mm
+++ b/test/CodeGenObjCXX/arc-new-delete.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-arc -fobjc-runtime-has-weak -fblocks -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -fblocks -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s | FileCheck %s
typedef __strong id strong_id;
typedef __weak id weak_id;
diff --git a/test/CodeGenObjCXX/arc-pseudo-destructors.mm b/test/CodeGenObjCXX/arc-pseudo-destructors.mm
index 4023e90b7dc7..2f8d9e1878bb 100644
--- a/test/CodeGenObjCXX/arc-pseudo-destructors.mm
+++ b/test/CodeGenObjCXX/arc-pseudo-destructors.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-arc -fobjc-runtime-has-weak -fblocks -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -fblocks -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s | FileCheck %s
// CHECK: define void @_Z28test_objc_object_pseudo_dtorPU8__strongP11objc_objectPU6__weakS0_
void test_objc_object_pseudo_dtor(__strong id *ptr, __weak id *wptr) {
diff --git a/test/CodeGenObjCXX/arc-references.mm b/test/CodeGenObjCXX/arc-references.mm
index 3d0313d13ac8..954c02abf23a 100644
--- a/test/CodeGenObjCXX/arc-references.mm
+++ b/test/CodeGenObjCXX/arc-references.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fblocks -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-runtime-has-weak -fblocks -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s
@interface A
@end
@@ -61,8 +61,9 @@ void sink(__strong A* &&);
// CHECK: define void @_Z5test5RU8__strongP11objc_object
void test5(__strong id &x) {
- // CHECK: [[OBJ_ID:%[a-zA-Z0-9]+]] = call i8* @objc_retain
- // CHECK-NEXT: [[OBJ_A:%[a-zA-Z0-9]+]] = bitcast i8* [[OBJ_ID]] to [[A:%[a-zA-Z0-9]+]]*
+ // CHECK: [[REFTMP:%.*]] = alloca {{%.*}}*, align 8
+ // CHECK: [[OBJ_ID:%.*]] = call i8* @objc_retain(
+ // CHECK-NEXT: [[OBJ_A:%.*]] = bitcast i8* [[OBJ_ID]] to [[A:%[a-zA-Z0-9]+]]*
// CHECK-NEXT: store [[A]]* [[OBJ_A]], [[A]]** [[REFTMP:%[a-zA-Z0-9]+]]
// CHECK-NEXT: call void @_Z4sinkOU8__strongP1A
sink(x);
diff --git a/test/CodeGenObjCXX/arc-returns-inner-reference-ptr.mm b/test/CodeGenObjCXX/arc-returns-inner-reference-ptr.mm
new file mode 100644
index 000000000000..c4ab34ea0e8b
--- /dev/null
+++ b/test/CodeGenObjCXX/arc-returns-inner-reference-ptr.mm
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -o - %s | FileCheck %s
+// rdar://10139365
+
+@interface Test58
+- (char* &) interior __attribute__((objc_returns_inner_pointer));
+- (int&)reference_to_interior_int __attribute__((objc_returns_inner_pointer));
+@end
+
+void foo() {
+ Test58 *ptr;
+ char *c = [(ptr) interior];
+
+ int i = [(ptr) reference_to_interior_int];
+}
+
+// CHECK: [[T0:%.*]] = load {{%.*}} {{%.*}}, align 8
+// CHECK: [[T1:%.*]] = bitcast {{%.*}} [[T0]] to i8*
+// call i8* @objc_retainAutorelease(i8* [[T1]]) nounwind
+// CHECK: [[T2:%.*]] = load {{%.*}} {{%.*}}, align 8
+// CHECK: [[T3:%.*]] = bitcast {{%.*}} [[T2]] to i8*
+// call i8* @objc_retainAutorelease(i8* [[T3]]) nounwind
+
diff --git a/test/CodeGenObjCXX/arc-special-member-functions.mm b/test/CodeGenObjCXX/arc-special-member-functions.mm
index d88a2bd62ffc..421a9fedffac 100644
--- a/test/CodeGenObjCXX/arc-special-member-functions.mm
+++ b/test/CodeGenObjCXX/arc-special-member-functions.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-arc -fblocks -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fobjc-arc -fblocks -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s | FileCheck %s
struct ObjCMember {
id member;
@@ -92,12 +92,16 @@ void test_ObjCBlockMember_copy_assign(ObjCBlockMember m1, ObjCBlockMember m2) {
// Implicitly-generated copy assignment operator for ObjCBlockMember
// CHECK: define linkonce_odr {{%.*}}* @_ZN15ObjCBlockMemberaSERKS_(
-// CHECK: [[T0:%.*]] = call i8* @objc_retainBlock(
-// CHECK-NEXT: [[T1:%.*]] = bitcast i8* [[T0]] to i32 (i32)*
-// CHECK-NEXT: [[T2:%.*]] = load {{.*}} [[SLOT:%.*]],
-// CHECK: store
-// CHECK-NEXT: [[T3:%.*]] = bitcast
-// CHECK-NEXT: call void @objc_release(i8* [[T3]])
+// CHECK: [[T0:%.*]] = getelementptr inbounds [[T:%.*]]* {{%.*}}, i32 0, i32 0
+// CHECK-NEXT: [[T1:%.*]] = load i32 (i32)** [[T0]], align 8
+// CHECK-NEXT: [[T2:%.*]] = bitcast i32 (i32)* [[T1]] to i8*
+// CHECK-NEXT: [[T3:%.*]] = call i8* @objc_retainBlock(i8* [[T2]])
+// CHECK-NEXT: [[T4:%.*]] = bitcast i8* [[T3]] to i32 (i32)*
+// CHECK-NEXT: [[T5:%.*]] = getelementptr inbounds [[T]]* {{%.*}}, i32 0, i32 0
+// CHECK-NEXT: [[T6:%.*]] = load i32 (i32)** [[T5]], align 8
+// CHECK-NEXT: store i32 (i32)* [[T4]], i32 (i32)** [[T5]]
+// CHECK-NEXT: [[T7:%.*]] = bitcast i32 (i32)* [[T6]] to i8*
+// CHECK-NEXT: call void @objc_release(i8* [[T7]])
// CHECK-NEXT: ret
// Implicitly-generated copy constructor for ObjCBlockMember
diff --git a/test/CodeGenObjCXX/arc.mm b/test/CodeGenObjCXX/arc.mm
index 0c5466a4cea3..8f3aa711d65d 100644
--- a/test/CodeGenObjCXX/arc.mm
+++ b/test/CodeGenObjCXX/arc.mm
@@ -1,4 +1,15 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fobjc-runtime-has-weak -fblocks -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-runtime-has-weak -fblocks -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s
+
+struct NSFastEnumerationState;
+@interface NSArray
+- (unsigned long) countByEnumeratingWithState: (struct NSFastEnumerationState*) state
+ objects: (id*) buffer
+ count: (unsigned long) bufferSize;
+@end;
+NSArray *nsarray() { return 0; }
+// CHECK: define [[NSARRAY:%.*]]* @_Z7nsarrayv()
+
+void use(id);
// rdar://problem/9315552
// The analogous ObjC testcase test46 in arr.m.
@@ -164,3 +175,37 @@ id test36(id z) {
// CHECK: objc_autoreleaseReturnValue
return z;
}
+
+// Template instantiation side of rdar://problem/9817306
+@interface Test37
+- (NSArray *) array;
+@end
+template <class T> void test37(T *a) {
+ for (id x in a.array) {
+ use(x);
+ }
+}
+extern template void test37<Test37>(Test37 *a);
+template void test37<Test37>(Test37 *a);
+// CHECK: define weak_odr void @_Z6test37I6Test37EvPT_(
+// CHECK-LP64: [[T0:%.*]] = call [[NSARRAY]]* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to [[NSARRAY]]* (i8*, i8*)*)(
+// CHECK-LP64-NEXT: [[T1:%.*]] = bitcast [[NSARRAY]]* [[T0]] to i8*
+// CHECK-LP64-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]])
+// CHECK-LP64-NEXT: [[COLL:%.*]] = bitcast i8* [[T2]] to [[NSARRAY]]*
+
+// Make sure it's not immediately released before starting the iteration.
+// CHECK-LP64-NEXT: load i8** @"\01L_OBJC_SELECTOR_REFERENCES_
+// CHECK-LP64-NEXT: [[T0:%.*]] = bitcast [[NSARRAY]]* [[COLL]] to i8*
+// CHECK-LP64-NEXT: @objc_msgSend
+
+// This bitcast is for the mutation check.
+// CHECK-LP64: [[T0:%.*]] = bitcast [[NSARRAY]]* [[COLL]] to i8*
+// CHECK-LP64-NEXT: @objc_enumerationMutation
+
+// This bitcast is for the 'next' message send.
+// CHECK-LP64: [[T0:%.*]] = bitcast [[NSARRAY]]* [[COLL]] to i8*
+// CHECK-LP64-NEXT: @objc_msgSend
+
+// This bitcast is for the final release.
+// CHECK-LP64: [[T0:%.*]] = bitcast [[NSARRAY]]* [[COLL]] to i8*
+// CHECK-LP64-NEXT: call void @objc_release(i8* [[T0]])
diff --git a/test/CodeGenObjCXX/block-in-template-inst.mm b/test/CodeGenObjCXX/block-in-template-inst.mm
index 72042fc03330..93a0e4907d29 100644
--- a/test/CodeGenObjCXX/block-in-template-inst.mm
+++ b/test/CodeGenObjCXX/block-in-template-inst.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm-only -std=c++0x -fblocks -o - -triple x86_64-apple-darwin10 %s
+// RUN: %clang_cc1 -emit-llvm-only -std=c++11 -fblocks -o - -triple x86_64-apple-darwin10 -fobjc-fragile-abi %s
// rdar://9362021
@class DYFuture;
diff --git a/test/CodeGenObjCXX/block-var-layout.mm b/test/CodeGenObjCXX/block-var-layout.mm
index 363e21497ec7..a8f8be0ea8a3 100644
--- a/test/CodeGenObjCXX/block-var-layout.mm
+++ b/test/CodeGenObjCXX/block-var-layout.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -fblocks -fobjc-gc -triple x86_64-apple-darwin -emit-llvm %s -o %t-64.ll
+// RUN: %clang_cc1 -x objective-c++ -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-fragile-abi -emit-llvm %s -o %t-64.ll
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.ll %s
// See commentary in test/CodeGenObjC/block-var-layout.m, from which
diff --git a/test/CodeGenObjCXX/blocks.mm b/test/CodeGenObjCXX/blocks.mm
index e220753ff788..126931d51fad 100644
--- a/test/CodeGenObjCXX/blocks.mm
+++ b/test/CodeGenObjCXX/blocks.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -fblocks -triple x86_64-apple-darwin %s -verify -emit-llvm -o %t
+// RUN: %clang_cc1 -x objective-c++ -fblocks -triple x86_64-apple-darwin -fobjc-fragile-abi %s -verify -emit-llvm -o %t
// rdar://8979379
@interface A
@@ -30,7 +30,7 @@ void foo(id <NSObject>(^objectCreationBlock)(void)) {
// Test4
struct S {
- S *(^a)() = ^{ // expected-warning {{C++0x}}
+ S *(^a)() = ^{ // expected-warning {{C++11}}
return this;
};
};
@@ -40,7 +40,7 @@ S s;
struct X {
void f() {
^ {
- struct Nested { Nested *ptr = this; }; // expected-warning {{C++0x}}
+ struct Nested { Nested *ptr = this; }; // expected-warning {{C++11}}
} ();
};
};
diff --git a/test/CodeGenObjCXX/catch-id-type.mm b/test/CodeGenObjCXX/catch-id-type.mm
index ece342bb8720..a5fa3e78fb59 100644
--- a/test/CodeGenObjCXX/catch-id-type.mm
+++ b/test/CodeGenObjCXX/catch-id-type.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-apple-macosx10.6.6 -emit-llvm -fobjc-exceptions -fcxx-exceptions -fexceptions -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-macosx10.6.6 -fobjc-fragile-abi -emit-llvm -fobjc-exceptions -fcxx-exceptions -fexceptions -o - %s | FileCheck %s
// rdar://8940528
@interface ns_array
@@ -30,7 +30,10 @@ id FUNC() {
}
catch( id error )
{
- // CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector({{.*}} @__gxx_personality_v0 {{.*}} @_ZTIP4INTF {{.*}} @_ZTIP11objc_object {{.*}} @_ZTIP10objc_class
+ // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ // CHECK-NEXT: catch i8* bitcast ({ i8*, i8*, i32, i8* }* @_ZTIP4INTF to i8*)
+ // CHECK-NEXT: catch i8* bitcast ({ i8*, i8*, i32, i8* }* @_ZTIP11objc_object to i8*)
+ // CHECK-NEXT: catch i8* bitcast ({ i8*, i8*, i32, i8* }* @_ZTIP10objc_class to i8*)
error = error;
groups = [ns_array array];
}
diff --git a/test/CodeGenObjCXX/copy.mm b/test/CodeGenObjCXX/copy.mm
index 133910f25dcf..a61ccd4e5daa 100644
--- a/test/CodeGenObjCXX/copy.mm
+++ b/test/CodeGenObjCXX/copy.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s
// rdar://problem/9158302
// This should not use a memmove_collectable in non-GC mode.
@@ -24,3 +24,18 @@ namespace test0 {
}
}
+
+// rdar://9780211
+@protocol bork
+@end
+
+namespace test1 {
+template<typename T> struct RetainPtr {
+ RetainPtr() {}
+};
+
+
+RetainPtr<id<bork> > x;
+RetainPtr<id> y;
+
+}
diff --git a/test/CodeGenObjCXX/copyable-property-object.mm b/test/CodeGenObjCXX/copyable-property-object.mm
index 8962c536ea29..03c0c06a41ee 100644
--- a/test/CodeGenObjCXX/copyable-property-object.mm
+++ b/test/CodeGenObjCXX/copyable-property-object.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s
struct POD {
int array[3][4];
diff --git a/test/CodeGenObjCXX/encode.mm b/test/CodeGenObjCXX/encode.mm
index 2c10fbcb9753..8391c04b7da8 100644
--- a/test/CodeGenObjCXX/encode.mm
+++ b/test/CodeGenObjCXX/encode.mm
@@ -105,6 +105,27 @@ namespace rdar9624314 {
const char g2[] = @encode(S2);
}
+namespace test {
+ class Foo {
+ public:
+ virtual void f() {};
+ };
+
+ class Bar {
+ public:
+ virtual void g() {};
+ };
+
+ class Zoo : virtual public Foo, virtual public Bar {
+ public:
+ int x;
+ int y;
+ };
+
+ // CHECK: @_ZN4testL3ecdE = internal constant [15 x i8] c"{Zoo=^^?ii^^?}\00"
+ const char ecd[] = @encode(Zoo);
+}
+
struct Base1 {
char x;
};
@@ -146,3 +167,23 @@ _Alloc_hider _M_dataplus;
// CHECK: @_ZL2g5 = internal constant [32 x i8] c"{basic_string={_Alloc_hider=*}}\00"
const char g5[] = @encode(basic_string);
+
+
+// PR10990
+class CefBase {
+ virtual ~CefBase() {}
+};
+class CefBrowser : public virtual CefBase {};
+class CefBrowserImpl : public CefBrowser {};
+// CHECK: @_ZL2g6 = internal constant [21 x i8] c"{CefBrowserImpl=^^?}\00"
+const char g6[] = @encode(CefBrowserImpl);
+
+// PR10990_2
+class CefBase2 {
+ virtual ~CefBase2() {}
+ int i;
+};
+class CefBrowser2 : public virtual CefBase2 {};
+class CefBrowserImpl2 : public CefBrowser2 {};
+// CHECK: @_ZL2g7 = internal constant [26 x i8] c"{CefBrowserImpl2=^^?^^?i}\00"
+const char g7[] = @encode(CefBrowserImpl2);
diff --git a/test/CodeGenObjCXX/exceptions.mm b/test/CodeGenObjCXX/exceptions.mm
index d4c0756cb89f..ce6d20aa98b6 100644
--- a/test/CodeGenObjCXX/exceptions.mm
+++ b/test/CodeGenObjCXX/exceptions.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fcxx-exceptions -fexceptions -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -o - %s | FileCheck %s
@interface OCType @end
void opaque();
@@ -11,7 +11,8 @@ namespace test0 {
// CHECK: invoke void @_Z6opaquev
opaque();
} catch (OCType *T) {
- // CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector({{.*}} @__objc_personality_v0 {{.*}} @"OBJC_EHTYPE_$_OCType"
+ // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*)
+ // CHECK-NEXT: catch %struct._objc_typeinfo* @"OBJC_EHTYPE_$_OCType"
}
}
}
diff --git a/test/CodeGenObjCXX/gc.mm b/test/CodeGenObjCXX/gc.mm
index aa293dacf3a7..1e9fe00fd060 100644
--- a/test/CodeGenObjCXX/gc.mm
+++ b/test/CodeGenObjCXX/gc.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s
namespace test0 {
extern id x;
diff --git a/test/CodeGenObjCXX/implicit-copy-assign-operator.mm b/test/CodeGenObjCXX/implicit-copy-assign-operator.mm
index 16ae1472ddfd..0a6e08e2ff62 100644
--- a/test/CodeGenObjCXX/implicit-copy-assign-operator.mm
+++ b/test/CodeGenObjCXX/implicit-copy-assign-operator.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-gc -emit-llvm -triple x86_64-apple-darwin10.0.0 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fobjc-gc -emit-llvm -triple x86_64-apple-darwin10.0.0 -fobjc-fragile-abi -o - %s | FileCheck %s
struct A {
A &operator=(const A&);
A &operator=(A&);
diff --git a/test/CodeGenObjCXX/implicit-copy-constructor.mm b/test/CodeGenObjCXX/implicit-copy-constructor.mm
index 10eb644ddb22..63dd4f084cd8 100644
--- a/test/CodeGenObjCXX/implicit-copy-constructor.mm
+++ b/test/CodeGenObjCXX/implicit-copy-constructor.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s
struct A {
A();
diff --git a/test/CodeGenObjCXX/mangle-blocks.mm b/test/CodeGenObjCXX/mangle-blocks.mm
index 9f57557f8f67..fcbc60860884 100644
--- a/test/CodeGenObjCXX/mangle-blocks.mm
+++ b/test/CodeGenObjCXX/mangle-blocks.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -fblocks -o - -triple x86_64-apple-darwin10 %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -fblocks -o - -triple x86_64-apple-darwin10 -fobjc-fragile-abi %s | FileCheck %s
// CHECK: @_ZGVN3foo20__foo_block_invoke_05valueE = internal global i64 0
diff --git a/test/CodeGenObjCXX/message-reference.mm b/test/CodeGenObjCXX/message-reference.mm
index b7cf98d88c66..fa41fef4c909 100644
--- a/test/CodeGenObjCXX/message-reference.mm
+++ b/test/CodeGenObjCXX/message-reference.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s
// rdar://8604515
@interface I {}
diff --git a/test/CodeGenObjCXX/nrvo.mm b/test/CodeGenObjCXX/nrvo.mm
new file mode 100644
index 000000000000..ef5052eea603
--- /dev/null
+++ b/test/CodeGenObjCXX/nrvo.mm
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -emit-llvm -o - -fblocks %s -O1 -triple x86_64-apple-darwin10.0.0 -fobjc-fragile-abi | FileCheck %s
+
+// PR10835 / <rdar://problem/10050178>
+struct X {
+ X();
+ X(const X&);
+ ~X();
+};
+
+@interface NRVO
+@end
+
+@implementation NRVO
+// CHECK: define internal void @"\01-[NRVO getNRVO]"
+- (X)getNRVO {
+ X x;
+ // CHECK: tail call void @_ZN1XC1Ev
+ // CHECK-NEXT: ret void
+ return x;
+}
+@end
+
+X blocksNRVO() {
+ return ^{
+ // CHECK: define internal void @__blocksNRVO_block_invoke_0
+ X x;
+ // CHECK: tail call void @_ZN1XC1Ev
+ // CHECK-NEXT: ret void
+ return x;
+ }() ;
+}
+
diff --git a/test/CodeGenObjCXX/property-derived-to-base-conv.mm b/test/CodeGenObjCXX/property-derived-to-base-conv.mm
index d7c743c69068..ddca857fbab0 100644
--- a/test/CodeGenObjCXX/property-derived-to-base-conv.mm
+++ b/test/CodeGenObjCXX/property-derived-to-base-conv.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s
+// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s
// rdar: // 7501812
struct A {
diff --git a/test/CodeGenObjCXX/property-dot-copy.mm b/test/CodeGenObjCXX/property-dot-copy.mm
index 9b23c58ca17b..c0ff258e8585 100644
--- a/test/CodeGenObjCXX/property-dot-copy.mm
+++ b/test/CodeGenObjCXX/property-dot-copy.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
// rdar://8427922
struct Vector3D
diff --git a/test/CodeGenObjCXX/property-dot-reference.mm b/test/CodeGenObjCXX/property-dot-reference.mm
index 6b53639f54cb..e64b397cc026 100644
--- a/test/CodeGenObjCXX/property-dot-reference.mm
+++ b/test/CodeGenObjCXX/property-dot-reference.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fexceptions -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - %s | FileCheck %s
// rdar://8409336
struct TFENode {
diff --git a/test/CodeGenObjCXX/property-object-conditional-exp.mm b/test/CodeGenObjCXX/property-object-conditional-exp.mm
index 5d8a8826355c..281076e47f4d 100644
--- a/test/CodeGenObjCXX/property-object-conditional-exp.mm
+++ b/test/CodeGenObjCXX/property-object-conditional-exp.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s
struct CGRect {
char* origin;
diff --git a/test/CodeGenObjCXX/property-object-reference.mm b/test/CodeGenObjCXX/property-object-reference.mm
new file mode 100644
index 000000000000..b87ce2303b5e
--- /dev/null
+++ b/test/CodeGenObjCXX/property-object-reference.mm
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - | FileCheck %s
+// rdar://10188258
+
+struct Foo {int i;};
+
+@interface ObjCTest { }
+@property (nonatomic, readonly) Foo& FooRefProperty;
+@end
+
+
+@implementation ObjCTest
+@dynamic FooRefProperty;
+
+-(void) test {
+ Foo& f = self.FooRefProperty;
+}
+@end
+
+// CHECK: [[T0:%.*]] = load {{%.*}} [[S0:%.*]]
+// CHECK: load i8** @"\01L_OBJC_SELECTOR_REFERENCES_
+// CHECK: [[T2:%.*]] = bitcast {{%.*}} [[T0]] to i8*
+// CHECK: @objc_msgSend
+
diff --git a/test/CodeGenObjCXX/property-objects.mm b/test/CodeGenObjCXX/property-objects.mm
index 1f4311763595..6dfcc27f1921 100644
--- a/test/CodeGenObjCXX/property-objects.mm
+++ b/test/CodeGenObjCXX/property-objects.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
// CHECK-NOT: callq _objc_msgSend_stret
// CHECK: call void @_ZN1SC1ERKS_
// CHECK: call %class.S* @_ZN1SaSERKS_
diff --git a/test/CodeGenObjCXX/property-reference.mm b/test/CodeGenObjCXX/property-reference.mm
index 7c235cb9b4ef..bc3bb475f5f7 100644
--- a/test/CodeGenObjCXX/property-reference.mm
+++ b/test/CodeGenObjCXX/property-reference.mm
@@ -1,16 +1,14 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - | FileCheck %s
// rdar://9208606
-struct MyStruct
-{
- int x;
- int y;
- int z;
+struct MyStruct {
+ int x;
+ int y;
+ int z;
};
-@interface MyClass
-{
- MyStruct _foo;
+@interface MyClass {
+ MyStruct _foo;
}
@property (assign, readwrite) const MyStruct& foo;
@@ -19,16 +17,38 @@ struct MyStruct
- (void) setFoo:(const MyStruct&)inFoo;
@end
-int main()
-{
- MyClass* myClass;
- MyStruct myStruct;
+void test0() {
+ MyClass* myClass;
+ MyStruct myStruct;
- myClass.foo = myStruct;
+ myClass.foo = myStruct;
- const MyStruct& currentMyStruct = myClass.foo;
- return 0;
+ const MyStruct& currentMyStruct = myClass.foo;
}
// CHECK: [[C:%.*]] = call %struct.MyStruct* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
// CHECK: store %struct.MyStruct* [[C]], %struct.MyStruct** [[D:%.*]]
+
+namespace test1 {
+ struct A { A(); A(const A&); A&operator=(const A&); ~A(); };
+}
+@interface Test1 {
+ test1::A ivar;
+}
+@property const test1::A &prop1;
+@end
+@implementation Test1
+@synthesize prop1 = ivar;
+@end
+// CHECK: define internal [[A:%.*]]* @"\01-[Test1 prop1]"(
+// CHECK: [[SELF:%.*]] = alloca [[TEST1:%.*]]*, align 8
+// CHECK: [[T0:%.*]] = load [[TEST1]]** [[SELF]]
+// CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8*
+// CHECK-NEXT: [[T2:%.*]] = getelementptr inbounds i8* [[T1]], i64 0
+// CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[A]]*
+// CHECK-NEXT: ret [[A]]* [[T3]]
+
+// CHECK: define internal void @"\01-[Test1 setProp1:]"(
+// CHECK: call [[A]]* @_ZN5test11AaSERKS0_(
+// CHECK-NEXT: ret void
+
diff --git a/test/CodeGenObjCXX/refence-assign-write-barrier.mm b/test/CodeGenObjCXX/refence-assign-write-barrier.mm
index b295eb25672f..206ecb0c29e3 100644
--- a/test/CodeGenObjCXX/refence-assign-write-barrier.mm
+++ b/test/CodeGenObjCXX/refence-assign-write-barrier.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s
// rdar://8681766
@interface NSArray
diff --git a/test/CodeGenObjCXX/selector-expr-lvalue.mm b/test/CodeGenObjCXX/selector-expr-lvalue.mm
index 030545119be4..3e3bf4ecf20e 100644
--- a/test/CodeGenObjCXX/selector-expr-lvalue.mm
+++ b/test/CodeGenObjCXX/selector-expr-lvalue.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s
// PR7390
@interface NSObject {}
diff --git a/test/CodeGenObjCXX/write-barrier-global-assign.mm b/test/CodeGenObjCXX/write-barrier-global-assign.mm
index a14804ffe104..cb563f339565 100644
--- a/test/CodeGenObjCXX/write-barrier-global-assign.mm
+++ b/test/CodeGenObjCXX/write-barrier-global-assign.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -fobjc-fragile-abi -emit-llvm -o - %s | FileCheck %s
// rdar://8761767
@class CPDestUser;