[PATCH] [analyzer] Fix ObjC Dealloc Checker to operate only on classes with retained properties
David Kilzer
ddkilzer at kilzer.net
Fri Aug 29 15:58:02 PDT 2014
Thanks for the comments, Anna! I will post a new patch soon.
================
Comment at: lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp:108
@@ -82,3 +107,3 @@
assert (LOpts.getGC() != LangOptions::GCOnly);
----------------
None of these checks is useful for ARC (-fobjc-arc), so I need to assert this is never called in ARC mode (which Jordan alluded to in a previous comment).
================
Comment at: lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp:206
@@ -194,3 +205,3 @@
bool requiresRelease = PD->getSetterKind() != ObjCPropertyDecl::Assign;
if (scan_ivar_release(MD->getBody(), ID, PD, RS, SelfII, Ctx)
!= requiresRelease) {
----------------
zaks.anna wrote:
> Would it be possible to move the checking of the setter (to be not 'assign') into the body of isSynthesizedWritablePointerProperty() ?
I can, but it makes it harder to share code with the patch in D5042, since I need that bit of information separately.
================
Comment at: lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp:255-256
@@ -237,4 +254,4 @@
BugReporter &BR) const {
if (mgr.getLangOpts().getGC() == LangOptions::GCOnly)
return;
checkObjCDealloc(this, cast<ObjCImplementationDecl>(D), mgr.getLangOpts(),
----------------
None of these checks is useful for ARC (-fobjc-arc), so I need to return early for ARC mode as well (which Jordan alluded to in a previous comment).
http://reviews.llvm.org/D5023
More information about the cfe-commits
mailing list