[analyzer] Correctly model iteration through "nil" objects
authorGeorge Karpenkov <ekarpenkov@apple.com>
Thu, 8 Mar 2018 02:53:39 +0000 (02:53 +0000)
committerGeorge Karpenkov <ekarpenkov@apple.com>
Thu, 8 Mar 2018 02:53:39 +0000 (02:53 +0000)
commit04b9dc58b898e9f421759147bc5feca899efb1ef
tree19f97b4241ee71776167a5eb117dc4883daaf75a
parent1087a542554ac0ab23bbca07d026b2fb49862809
[analyzer] Correctly model iteration through "nil" objects

Previously, iteration through nil objects which resulted from
objc-messages being set to nil were modeled incorrectly.

There are a couple of notes about this patch:

In principle, ExprEngineObjC might be left untouched IFF osx.loops
checker is enabled.
I however think that we should not do something
completely incorrect depending on what checkers are left on.
We should evaluate and potentially remove altogether the isConsumedExpr
performance heuristic, as it seems very fragile.

rdar://22205149

Differential Revision: https://reviews.llvm.org/D44178

llvm-svn: 326982
clang/lib/AST/ParentMap.cpp
clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp
clang/test/Analysis/objc-for.m