aboutsummaryrefslogtreecommitdiff
path: root/clang/test/ARCMT
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2015-01-16 23:04:26 +0000
committerJordan Rose <jordan_rose@apple.com>2015-01-16 23:04:26 +0000
commit16ba553f754a6ab6c934deaa6232be1cb74db904 (patch)
treeb95d7f967d9fac4741d0be74fafe866c1898ae19 /clang/test/ARCMT
parent71fb83ea7aeed1a60a621752471f9f7f28346df3 (diff)
downloadllvm-16ba553f754a6ab6c934deaa6232be1cb74db904.zip
llvm-16ba553f754a6ab6c934deaa6232be1cb74db904.tar.gz
llvm-16ba553f754a6ab6c934deaa6232be1cb74db904.tar.bz2
ObjC getters with names like "newItem" should still be linked to the @property.
Two years ago I added a compile-time "optimization" to ObjCMethodDecl::findPropertyDecl: exit early if the current method is part of a special Objective-C method family (like 'new' or 'init'). However, if a property (declared with @property) has a name that matches a method family, the getter picks up that family despite being declared by the property. The early exit then made ObjCMethodDecl::findPropertyDecl decide that there was no associated property, despite the method itself being marked as an accessor. This corrects that by removing the early exit. This does /not/ change the fact that such a getter is considered to return a value with a +1 retain count. The best way to eliminate this is by adding the objc_method_family(none) attribute to the getter, but unlike the existing ns_returns_not_retained that can't be applied directly to the property -- you have to redeclare the getter instead. (It'd be nice if @property just implied objc_method_family(none) for its getter, but that would be a backwards-incompatible change.) rdar://problem/19038838 llvm-svn: 226338
Diffstat (limited to 'clang/test/ARCMT')
-rw-r--r--clang/test/ARCMT/objcmt-property-dot-syntax.m9
-rw-r--r--clang/test/ARCMT/objcmt-property-dot-syntax.m.result9
2 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/ARCMT/objcmt-property-dot-syntax.m b/clang/test/ARCMT/objcmt-property-dot-syntax.m
index 0e25abc..aaa3ea1 100644
--- a/clang/test/ARCMT/objcmt-property-dot-syntax.m
+++ b/clang/test/ARCMT/objcmt-property-dot-syntax.m
@@ -59,3 +59,12 @@ P* fun();
[self->obj count];
}
@end
+
+
+@interface Rdar19038838
+@property id newItem; // should be marked objc_method_family(none), but isn't.
+@end
+
+id testRdar19038838(Rdar19038838 *obj) {
+ return [obj newItem];
+}
diff --git a/clang/test/ARCMT/objcmt-property-dot-syntax.m.result b/clang/test/ARCMT/objcmt-property-dot-syntax.m.result
index 6822d44..44b7cf1 100644
--- a/clang/test/ARCMT/objcmt-property-dot-syntax.m.result
+++ b/clang/test/ARCMT/objcmt-property-dot-syntax.m.result
@@ -59,3 +59,12 @@ P* fun();
self->obj.count;
}
@end
+
+
+@interface Rdar19038838
+@property id newItem; // should be marked objc_method_family(none), but isn't.
+@end
+
+id testRdar19038838(Rdar19038838 *obj) {
+ return obj.newItem;
+}