diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-10-31 16:44:55 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-10-31 16:44:55 +0000 |
commit | c45bb4dcb648cd8b5250492afe7df254e4157aaa (patch) | |
tree | 54c9bb463f36becc8d5686757ffb1d88e8bb4b09 /lib/StaticAnalyzer/Core/ConstraintManager.cpp | |
parent | bfd452ea9b362a0e5d8e2b8d599ad9f4092ce29e (diff) |
[analyzer] Let ConstraintManager subclasses provide a more efficient checkNull.
Previously, every call to a ConstraintManager's isNull would do a full
assumeDual to test feasibility. Now, ConstraintManagers can override
checkNull if they have a cheaper way to do the same thing.
RangeConstraintManager can do this in less than half the work.
<rdar://problem/12608209>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167138 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/ConstraintManager.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/ConstraintManager.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/StaticAnalyzer/Core/ConstraintManager.cpp b/lib/StaticAnalyzer/Core/ConstraintManager.cpp index 5dd1392bde..4dec526005 100644 --- a/lib/StaticAnalyzer/Core/ConstraintManager.cpp +++ b/lib/StaticAnalyzer/Core/ConstraintManager.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h" -#include "llvm/Support/SaveAndRestore.h" using namespace clang; using namespace ento; @@ -26,13 +25,8 @@ static DefinedSVal getLocFromSymbol(const ProgramStateRef &State, return loc::MemRegionVal(R); } -/// Convenience method to query the state to see if a symbol is null or -/// not null, or neither assumption can be made. -ConditionTruthVal ConstraintManager::isNull(ProgramStateRef State, - SymbolRef Sym) { - // Disable recursive notification of clients. - llvm::SaveAndRestore<bool> DisableNotify(NotifyAssumeClients, false); - +ConditionTruthVal ConstraintManager::checkNull(ProgramStateRef State, + SymbolRef Sym) { QualType Ty = Sym->getType(); DefinedSVal V = Loc::isLocType(Ty) ? getLocFromSymbol(State, Sym) : nonloc::SymbolVal(Sym); |