/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | //== ConstraintManager.cpp - Constraints on symbolic values -----*- C++ -*--==// |
2 | | // |
3 | | // The LLVM Compiler Infrastructure |
4 | | // |
5 | | // This file is distributed under the University of Illinois Open Source |
6 | | // License. See LICENSE.TXT for details. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | // |
10 | | // This file defined the interface to manage constraints on symbolic values. |
11 | | // |
12 | | //===----------------------------------------------------------------------===// |
13 | | |
14 | | #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h" |
15 | | |
16 | | using namespace clang; |
17 | | using namespace ento; |
18 | | |
19 | 6.87k | ConstraintManager::~ConstraintManager() {} |
20 | | |
21 | | static DefinedSVal getLocFromSymbol(const ProgramStateRef &State, |
22 | 0 | SymbolRef Sym) { |
23 | 0 | const MemRegion *R = |
24 | 0 | State->getStateManager().getRegionManager().getSymbolicRegion(Sym); |
25 | 0 | return loc::MemRegionVal(R); |
26 | 0 | } |
27 | | |
28 | | ConditionTruthVal ConstraintManager::checkNull(ProgramStateRef State, |
29 | 0 | SymbolRef Sym) { |
30 | 0 | QualType Ty = Sym->getType(); |
31 | 0 | DefinedSVal V = Loc::isLocType(Ty) ? getLocFromSymbol(State, Sym) |
32 | 0 | : nonloc::SymbolVal(Sym); |
33 | 0 | const ProgramStatePair &P = assumeDual(State, V); |
34 | 0 | if (P.first && 0 !P.second0 ) |
35 | 0 | return ConditionTruthVal(false); |
36 | 0 | if (0 !P.first && 0 P.second0 ) |
37 | 0 | return ConditionTruthVal(true); |
38 | 0 | return ConditionTruthVal(); |
39 | 0 | } |