llvm-project/clang/test/CodeGenObjCXX/property-reference.mm
John McCall 9b0a7cea0f Make -fobjc-nonfragile-abi the -cc1 default, since it's the
increasingly prevailing case to the point that new features
like ARC don't even support the fragile ABI anymore.

This required a little bit of reshuffling with exceptions
because a check was assuming that ObjCNonFragileABI was
only being set in ObjC mode, and that's actually a bit
obnoxious to do.

Most, though, it involved a perl script to translate a ton
of test cases.

Mostly no functionality change for driver users, although
there are corner cases with disabling language-specific
exceptions that we should handle more correctly now.

llvm-svn: 140957
2011-10-02 01:16:38 +00:00

55 lines
1.3 KiB
Plaintext

// 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;
};
@interface MyClass {
MyStruct _foo;
}
@property (assign, readwrite) const MyStruct& foo;
- (const MyStruct&) foo;
- (void) setFoo:(const MyStruct&)inFoo;
@end
void test0() {
MyClass* myClass;
MyStruct myStruct;
myClass.foo = myStruct;
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