Skip to content
Snippets Groups Projects
Commit 8acf4ef9 authored by Devin Coughlin's avatar Devin Coughlin
Browse files

[Analyzer] Fix crash in ObjCPropertyChecker on protocol property

Fix a crash in the ObjCPropertyChecker when analyzing a 'copy' property of an
NSMutable* type in a protocol.

rdar://problem/30766684

Differential Revision: https://reviews.llvm.org/D30482

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296562 91177308-0d34-0410-b5e6-96231b3b80d8
parent c7049d60
No related branches found
No related tags found
No related merge requests found
...@@ -58,8 +58,7 @@ void ObjCPropertyChecker::checkCopyMutable(const ObjCPropertyDecl *D, ...@@ -58,8 +58,7 @@ void ObjCPropertyChecker::checkCopyMutable(const ObjCPropertyDecl *D,
if (const ObjCInterfaceDecl *IntD = if (const ObjCInterfaceDecl *IntD =
dyn_cast<ObjCInterfaceDecl>(D->getDeclContext())) { dyn_cast<ObjCInterfaceDecl>(D->getDeclContext())) {
ImplD = IntD->getImplementation(); ImplD = IntD->getImplementation();
} else { } else if (auto *CatD = dyn_cast<ObjCCategoryDecl>(D->getDeclContext())) {
const ObjCCategoryDecl *CatD = cast<ObjCCategoryDecl>(D->getDeclContext());
ImplD = CatD->getClassInterface()->getImplementation(); ImplD = CatD->getClassInterface()->getImplementation();
} }
......
...@@ -59,3 +59,10 @@ ...@@ -59,3 +59,10 @@
@interface IWithoutImpl : NSObject {} @interface IWithoutImpl : NSObject {}
@property(copy) NSMutableString *mutableStr; // no-warning @property(copy) NSMutableString *mutableStr; // no-warning
@end @end
@protocol SomeProtocol
// Don't warn on protocol properties because it is possible to
// conform to them correctly; it is only synthesized setters that
// that are definitely incorrect.
@property (copy) NSMutableString *myProp; // no-crash // no-warning
@end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment