[cfe-commits] r112003 - in /cfe/trunk: lib/Sema/SemaObjCProperty.cpp test/SemaObjC/default-synthesize-1.m
Fariborz Jahanian
fjahanian at apple.com
Tue Aug 24 17:31:58 PDT 2010
Author: fjahanian
Date: Tue Aug 24 19:31:58 2010
New Revision: 112003
URL: http://llvm.org/viewvc/llvm-project?rev=112003&view=rev
Log:
No need to default synthesize property if implementation
has its own getter and setter methods declared.
Fixed 8349319 (nonfragile-abi2).
Modified:
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/test/SemaObjC/default-synthesize-1.m
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=112003&r1=112002&r2=112003&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Tue Aug 24 19:31:58 2010
@@ -953,6 +953,12 @@
// Property may have been synthesized by user.
if (IMPDecl->FindPropertyImplDecl(Prop->getIdentifier()))
continue;
+ if (IMPDecl->getInstanceMethod(Prop->getGetterName())) {
+ if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readonly)
+ continue;
+ if (IMPDecl->getInstanceMethod(Prop->getSetterName()))
+ continue;
+ }
ActOnPropertyImplDecl(S, IMPDecl->getLocation(), IMPDecl->getLocation(),
true, IMPDecl,
Modified: cfe/trunk/test/SemaObjC/default-synthesize-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/default-synthesize-1.m?rev=112003&r1=112002&r2=112003&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/default-synthesize-1.m (original)
+++ cfe/trunk/test/SemaObjC/default-synthesize-1.m Tue Aug 24 19:31:58 2010
@@ -85,4 +85,32 @@
}
@end
+// rdar://8349319
+// No default synthesis if implementation has getter (readonly) and setter(readwrite) methods.
+ at interface DSATextSearchResult
+ at property(assign,readonly) float relevance;
+ at property(assign,readonly) char isTitleMatch;
+ at end
+
+ at interface DSANodeSearchResult : DSATextSearchResult {}
+ at end
+
+
+ at implementation DSATextSearchResult
+-(char)isTitleMatch {
+ return (char)0;
+}
+
+-(float)relevance {
+ return 0.0;
+}
+ at end
+
+ at implementation DSANodeSearchResult
+-(id)initWithNode:(id )node relevance:(float)relevance isTitleMatch:(char)isTitleMatch {
+ relevance = 0.0;
+ isTitleMatch = 'a';
+ return self;
+}
+ at end
More information about the cfe-commits
mailing list