diff options
| author | Anna Zaks <ganna@apple.com> | 2013-04-03 19:28:12 +0000 |
|---|---|---|
| committer | Anna Zaks <ganna@apple.com> | 2013-04-03 19:28:12 +0000 |
| commit | ede0983f8858b4acf1978e2d650603a471f3bfc3 (patch) | |
| tree | 7220f5356e7e4ee659cb029e970f49e59fea1a71 /clang/lib/StaticAnalyzer/Core/ProgramState.cpp | |
| parent | ddef54cad61a1e9680220a4a2f07a004d000fb9f (diff) | |
| download | bcm5719-llvm-ede0983f8858b4acf1978e2d650603a471f3bfc3.tar.gz bcm5719-llvm-ede0983f8858b4acf1978e2d650603a471f3bfc3.zip | |
[analyzer] Properly handle the ternary operator in trackNullOrUndefValue
1) Look for the node where the condition expression is live when checking if
it is constrained to true or false.
2) Fix a bug in ProgramState::isNull, which was masking the problem. When
the expression is not a symbol (,which is the case when it is Unknown) return
unconstrained value, instead of value constrained to “false”!
(Thankfully other callers of isNull have not been effected by the bug.)
llvm-svn: 178684
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ProgramState.cpp')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/ProgramState.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ProgramState.cpp b/clang/lib/StaticAnalyzer/Core/ProgramState.cpp index f3e80f19c92..bff2242925e 100644 --- a/clang/lib/StaticAnalyzer/Core/ProgramState.cpp +++ b/clang/lib/StaticAnalyzer/Core/ProgramState.cpp @@ -380,9 +380,13 @@ ConditionTruthVal ProgramState::isNull(SVal V) const { if (V.isZeroConstant()) return true; + if (V.isConstant()) + return false; + SymbolRef Sym = V.getAsSymbol(); if (!Sym) - return false; + return ConditionTruthVal(); + return getStateManager().ConstraintMgr->isNull(this, Sym); } |

