diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2018-01-17 20:27:29 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2018-01-17 20:27:29 +0000 |
commit | b340ee9768986eb2d60ea92071bcb83c67adff2c (patch) | |
tree | 799dd05a2d2f297a3fe94ba31bd566f761435687 /examples | |
parent | 8d0e1351b8d259e92e3f29199c859c237350053d (diff) | |
download | clang-b340ee9768986eb2d60ea92071bcb83c67adff2c.tar.gz |
[analyzer] introduce getSVal(Stmt *) helper on ExplodedNode, make sure the helper is used consistently
In most cases using
`N->getState()->getSVal(E, N->getLocationContext())`
is ugly, verbose, and also opens up more surface area for bugs if an
inconsistent location context is used.
This patch introduces a helper on an exploded node, and ensures
consistent usage of either `ExplodedNode::getSVal` or
`CheckContext::getSVal` across the codebase.
As a result, a large number of redundant lines is removed.
Differential Revision: https://reviews.llvm.org/D42155
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322753 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples')
-rw-r--r-- | examples/analyzer-plugin/MainCallChecker.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/examples/analyzer-plugin/MainCallChecker.cpp b/examples/analyzer-plugin/MainCallChecker.cpp index 7f08760e3d..74fe663e98 100644 --- a/examples/analyzer-plugin/MainCallChecker.cpp +++ b/examples/analyzer-plugin/MainCallChecker.cpp @@ -16,10 +16,8 @@ public: } // end anonymous namespace void MainCallChecker::checkPreStmt(const CallExpr *CE, CheckerContext &C) const { - const ProgramStateRef state = C.getState(); - const LocationContext *LC = C.getLocationContext(); const Expr *Callee = CE->getCallee(); - const FunctionDecl *FD = state->getSVal(Callee, LC).getAsFunctionDecl(); + const FunctionDecl *FD = C.getSVal(Callee).getAsFunctionDecl(); if (!FD) return; |