aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer
diff options
context:
space:
mode:
Diffstat (limited to 'lib/StaticAnalyzer')
-rw-r--r--lib/StaticAnalyzer/Core/BugReporterVisitors.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
index d5b4714451..6e5f6b8f2c 100644
--- a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -787,14 +787,17 @@ bool bugreporter::trackNullOrUndefValue(const ExplodedNode *N,
S = OVE->getSourceExpr();
// Peel off the ternary operator.
- if (const ConditionalOperator *CO = dyn_cast<ConditionalOperator>(S)) {
- ProgramStateRef State = N->getState();
- SVal CondVal = State->getSVal(CO->getCond(), N->getLocationContext());
- if (State->isNull(CondVal).isConstrainedTrue()) {
- S = CO->getTrueExpr();
- } else {
- assert(State->isNull(CondVal).isConstrainedFalse());
- S = CO->getFalseExpr();
+ if (const Expr *Ex = dyn_cast<Expr>(S)) {
+ Ex = Ex->IgnoreParenCasts();
+ if (const ConditionalOperator *CO = dyn_cast<ConditionalOperator>(Ex)) {
+ ProgramStateRef State = N->getState();
+ SVal CondVal = State->getSVal(CO->getCond(), N->getLocationContext());
+ if (State->isNull(CondVal).isConstrainedTrue()) {
+ S = CO->getTrueExpr();
+ } else {
+ assert(State->isNull(CondVal).isConstrainedFalse());
+ S = CO->getFalseExpr();
+ }
}
}