summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
diff options
context:
space:
mode:
authorDevin Coughlin <dcoughlin@apple.com>2016-02-06 17:17:32 +0000
committerDevin Coughlin <dcoughlin@apple.com>2016-02-06 17:17:32 +0000
commit38e0e2970cf3303617c0bc915c9846c592b8aec3 (patch)
tree05eb18bb9ad3550532ac5c544a66731bb35cce20 /clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
parentbfa5f236e4af63753aa10f4a54ff0be824319bd9 (diff)
downloadbcm5719-llvm-38e0e2970cf3303617c0bc915c9846c592b8aec3.tar.gz
bcm5719-llvm-38e0e2970cf3303617c0bc915c9846c592b8aec3.zip
[analyzer] DeallocChecker: Don't warn on release of readonly assign property in dealloc.
It is common for the ivars for read-only assign properties to always be stored retained, so don't warn for a release in dealloc for the ivar backing these properties. llvm-svn: 259998
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
index d17a8b53978..1a3519307a2 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
@@ -216,6 +216,12 @@ static void checkObjCDealloc(const CheckerBase *Checker,
<< "' was retained by a synthesized property "
"but was not released in 'dealloc'";
} else {
+ // It is common for the ivars for read-only assign properties to
+ // always be stored retained, so don't warn for a release in
+ // dealloc for the ivar backing these properties.
+ if (PD->isReadOnly())
+ continue;
+
name = LOpts.getGC() == LangOptions::NonGC
? "extra ivar release (use-after-release)"
: "extra ivar release (Hybrid MM, non-GC)";
OpenPOWER on IntegriCloud