diff options
author | Jordan Rose <jordan_rose@apple.com> | 2015-02-19 23:57:04 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2015-02-19 23:57:04 +0000 |
commit | 000bac5e1704e05c1c9da31885f7b7147687577c (patch) | |
tree | c0e8aa9a66fafd15a75e43707510e8675091fcd8 /clang/lib/StaticAnalyzer | |
parent | d34db1716ef1903225bedaf9587287ce3de22a94 (diff) | |
download | bcm5719-llvm-000bac5e1704e05c1c9da31885f7b7147687577c.tar.gz bcm5719-llvm-000bac5e1704e05c1c9da31885f7b7147687577c.zip |
[analyzer] RetainCountChecker: don't try to track ivars known to be nil.
We expect in general that any nil value has no retain count information
associated with it; violating this results in unexpected state unification
/later/ when we decide to throw the information away. Unexpectedly caching
out can lead to an assertion failure or crash.
rdar://problem/19862648
llvm-svn: 229934
Diffstat (limited to 'clang/lib/StaticAnalyzer')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index fee8e766f6c..366672bca16 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -2852,7 +2852,7 @@ void RetainCountChecker::checkPostStmt(const ObjCIvarRefExpr *IRE, ProgramStateRef State = C.getState(); SymbolRef Sym = State->getSVal(*IVarLoc).getAsSymbol(); - if (!Sym) + if (!Sym || !wasLoadedFromIvar(Sym)) return; // Accessing an ivar directly is unusual. If we've done that, be more @@ -2867,7 +2867,9 @@ void RetainCountChecker::checkPostStmt(const ObjCIvarRefExpr *IRE, else return; - if (!wasLoadedFromIvar(Sym)) + // If the value is already known to be nil, don't bother tracking it. + ConstraintManager &CMgr = State->getConstraintManager(); + if (CMgr.isNull(State, Sym).isConstrainedTrue()) return; if (const RefVal *RV = getRefBinding(State, Sym)) { |