Index: cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCPropertyChecker.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCPropertyChecker.cpp +++ cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCPropertyChecker.cpp @@ -58,8 +58,7 @@ if (const ObjCInterfaceDecl *IntD = dyn_cast(D->getDeclContext())) { ImplD = IntD->getImplementation(); - } else { - const ObjCCategoryDecl *CatD = cast(D->getDeclContext()); + } else if (auto *CatD = dyn_cast(D->getDeclContext())) { ImplD = CatD->getClassInterface()->getImplementation(); } Index: cfe/trunk/test/Analysis/ObjCPropertiesSyntaxChecks.m =================================================================== --- cfe/trunk/test/Analysis/ObjCPropertiesSyntaxChecks.m +++ cfe/trunk/test/Analysis/ObjCPropertiesSyntaxChecks.m @@ -59,3 +59,10 @@ @interface IWithoutImpl : NSObject {} @property(copy) NSMutableString *mutableStr; // no-warning @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