aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-11-02 18:45:36 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-11-02 18:45:36 +0000
commit3684bd4c9518f6507d375ff8e4a4e32ce3bb51c3 (patch)
tree017fe6f61fe22de355a23b0ba6ca39e82d72bda5 /lib/Sema/SemaDeclObjC.cpp
parentcf3293eaeb3853d12cff47e648bbe835004e929f (diff)
Diagnose implementation of a property declared in a category
in its class implementation instead of crashing. Fixes radar 7350345. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85813 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--lib/Sema/SemaDeclObjC.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index d1b68a7977..881652f7aa 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -2047,6 +2047,14 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
Diag(PropertyLoc, diag::error_bad_property_decl) << IDecl->getDeclName();
return DeclPtrTy();
}
+ if (const ObjCCategoryDecl *CD =
+ dyn_cast<ObjCCategoryDecl>(property->getDeclContext())) {
+ if (CD->getIdentifier()) {
+ Diag(PropertyLoc, diag::error_category_property) << CD->getDeclName();
+ Diag(property->getLocation(), diag::note_category_property);
+ return DeclPtrTy();
+ }
+ }
} else if ((CatImplClass = dyn_cast<ObjCCategoryImplDecl>(ClassImpDecl))) {
if (Synthesize) {
Diag(AtLoc, diag::error_synthesize_category_decl);