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 | d703ec94a95221c2916f5a89304673d65639527e (patch) | |
tree | 4ec0c656ac06bff3d96cdbd73e83c102d81830b8 /clang/lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp | |
parent | cf9ff89663d7fac3759eb2b0bb9030a7bf97e47f (diff) | |
download | bcm5719-llvm-d703ec94a95221c2916f5a89304673d65639527e.tar.gz bcm5719-llvm-d703ec94a95221c2916f5a89304673d65639527e.zip |
[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
llvm-svn: 322753
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp index e04e2ab2c32..53632b41df4 100644 --- a/clang/lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp @@ -110,8 +110,6 @@ DeleteWithNonVirtualDtorChecker::DeleteBugVisitor::VisitNode( if (Satisfied) return nullptr; - ProgramStateRef State = N->getState(); - const LocationContext *LC = N->getLocationContext(); const Stmt *S = PathDiagnosticLocation::getStmt(N); if (!S) return nullptr; @@ -128,7 +126,7 @@ DeleteWithNonVirtualDtorChecker::DeleteBugVisitor::VisitNode( } // Region associated with the current cast expression. - const MemRegion *M = State->getSVal(CastE, LC).getAsRegion(); + const MemRegion *M = N->getSVal(CastE).getAsRegion(); if (!M) return nullptr; |