diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2018-03-08 02:53:39 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2018-03-08 02:53:39 +0000 |
commit | ab58e0282509fde82681fab7f5aae064dea779d6 (patch) | |
tree | 67a58c1db7a9f4bd591e27e015e32d60e540ee63 /lib/AST | |
parent | 333877a41170884159a4e9d579f8cc2e4bf01f7b (diff) | |
download | clang-ab58e0282509fde82681fab7f5aae064dea779d6.tar.gz |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326982 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST')
-rw-r--r-- | lib/AST/ParentMap.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/AST/ParentMap.cpp b/lib/AST/ParentMap.cpp index d8882c9030..bc57b20790 100644 --- a/lib/AST/ParentMap.cpp +++ b/lib/AST/ParentMap.cpp @@ -15,6 +15,7 @@ #include "clang/AST/Decl.h" #include "clang/AST/Expr.h" #include "clang/AST/ExprCXX.h" +#include "clang/AST/StmtObjC.h" #include "llvm/ADT/DenseMap.h" using namespace clang; @@ -193,6 +194,8 @@ bool ParentMap::isConsumedExpr(Expr* E) const { return DirectChild == cast<IndirectGotoStmt>(P)->getTarget(); case Stmt::SwitchStmtClass: return DirectChild == cast<SwitchStmt>(P)->getCond(); + case Stmt::ObjCForCollectionStmtClass: + return DirectChild == cast<ObjCForCollectionStmt>(P)->getCollection(); case Stmt::ReturnStmtClass: return true; } |