From 9e1a3af030f56159b681ae9c50cfe6cee3b3c150 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Thu, 29 Apr 2010 17:52:18 +0000 Subject: [PATCH] Properties cannot be synthesized by-dafult in categories. Issue usual warnings instead of confusing error message. Radar 7920807 llvm-svn: 102645 --- clang/lib/Sema/SemaObjCProperty.cpp | 2 +- clang/test/SemaObjC/default-synthesize.m | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index 1d27e44dbe74..13c75e4fe960 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -810,7 +810,7 @@ void Sema::DiagnoseUnimplementedProperties(ObjCImplDecl* IMPDecl, Prop->getPropertyImplementation() == ObjCPropertyDecl::Optional || PropImplMap.count(Prop)) continue; - if (LangOpts.ObjCNonFragileABI2) { + if (LangOpts.ObjCNonFragileABI2 && !isa(IMPDecl)) { ActOnPropertyImplDecl(IMPDecl->getLocation(), IMPDecl->getLocation(), true, DeclPtrTy::make(IMPDecl), diff --git a/clang/test/SemaObjC/default-synthesize.m b/clang/test/SemaObjC/default-synthesize.m index b892dfadf4f8..21453d384145 100644 --- a/clang/test/SemaObjC/default-synthesize.m +++ b/clang/test/SemaObjC/default-synthesize.m @@ -93,3 +93,13 @@ @end @implementation SubClass @end // expected-error {{property 'myString' attempting to use ivar 'myString' declared in super class 'TopClass'}} + +// rdar: // 7920807 +@interface C @end +@interface C (Category) +@property int p; // expected-warning {{property 'p' requires method 'p' to be defined }} \ + // expected-warning {{property 'p' requires method 'setP:' to be defined}} +@end +@implementation C (Category) // expected-note 2 {{implementation is here}} +@end +