From c7852c4ae3c74cb12fb8ac8415430b486fe77492 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 20 Jul 2015 00:54:39 +0300 Subject: Detect what variable is null after if with both branches set variable to null value. --- src/analysis/statement.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/analysis/statement.cpp b/src/analysis/statement.cpp index f405c2c..e22cdae 100644 --- a/src/analysis/statement.cpp +++ b/src/analysis/statement.cpp @@ -170,6 +170,14 @@ void analyseCondition(Node *node, addNonNullVar(wo, it); } } + FOR_EACH (it, wo2.knownNullVars) + { + if (isIn(it, wo3.knownNullVars) && + isNotIn(it, wo.knownNullVars)) + { + addNullVar(wo, it); + } + } } wo.isReturned = false; -- cgit v1.2.3-70-g09d2