summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
diff options
context:
space:
mode:
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