From 977ea7864a50eee39f6bef8a5a79154ac9ba4b3e Mon Sep 17 00:00:00 2001 From: John McCall Date: Tue, 21 Feb 2012 21:48:05 +0000 Subject: [PATCH] Don't crash on attempts to synthesize an invalid property. rdar://problem/10904479 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151089 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaObjCProperty.cpp | 1 + test/SemaObjC/arc-property.m | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index f9c064d997..5df214fd9f 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -1777,6 +1777,7 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, Attributes & ObjCDeclSpec::DQ_PR_copy ? "copy" : "retain (or strong)"); Attributes &= ~(ObjCDeclSpec::DQ_PR_weak | ObjCDeclSpec::DQ_PR_copy | ObjCDeclSpec::DQ_PR_retain | ObjCDeclSpec::DQ_PR_strong); + PropertyDecl->setInvalidDecl(); } // Check for more than one of { assign, copy, retain }. diff --git a/test/SemaObjC/arc-property.m b/test/SemaObjC/arc-property.m index 2993118592..226b03b3ae 100644 --- a/test/SemaObjC/arc-property.m +++ b/test/SemaObjC/arc-property.m @@ -46,3 +46,12 @@ @synthesize z; // suppressed @end +// rdar://problem/10904479 +// Don't crash. +@interface Test2 +// Minor FIXME: kill the redundant error +@property (strong) UndeclaredClass *test2; // expected-error {{unknown type name 'UndeclaredClass'}} expected-error {{must be of object type}} +@end +@implementation Test2 +@synthesize test2; +@end -- 2.50.1