ValueFlow: Temporarily comment out valueFlowTerminatingCondition

This commit is contained in:
Daniel Marjamäki 2019-01-02 19:42:08 +01:00
parent 7a40b85531
commit 39a96a5a16
2 changed files with 17 additions and 2 deletions

View File

@ -1165,6 +1165,10 @@ static void valueFlowSameExpressions(TokenList *tokenlist)
static void valueFlowTerminatingCondition(TokenList *tokenlist, SymbolDatabase* symboldatabase, const Settings *settings) static void valueFlowTerminatingCondition(TokenList *tokenlist, SymbolDatabase* symboldatabase, const Settings *settings)
{ {
(void)tokenlist;
(void)symboldatabase;
(void)settings;
/* TODO : this is commented out until #8924 is fixed (There is a test case with the comment #8924)
const bool cpp = symboldatabase->isCPP(); const bool cpp = symboldatabase->isCPP();
typedef std::pair<const Token*, const Scope*> Condition; typedef std::pair<const Token*, const Scope*> Condition;
for (const Scope * scope : symboldatabase->functionScopes) { for (const Scope * scope : symboldatabase->functionScopes) {
@ -1261,6 +1265,7 @@ static void valueFlowTerminatingCondition(TokenList *tokenlist, SymbolDatabase*
} }
} }
} }
*/
} }
static bool getExpressionRange(const Token *expr, MathLib::bigint *minvalue, MathLib::bigint *maxvalue) static bool getExpressionRange(const Token *expr, MathLib::bigint *minvalue, MathLib::bigint *maxvalue)

View File

@ -3515,7 +3515,7 @@ private:
" if (i == j) return;\n" " if (i == j) return;\n"
" if(i != j) {}\n" " if(i != j) {}\n"
"}\n"; "}\n";
ASSERT_EQUALS(true, valueOfTok(code, "!=").intvalue == 1); TODO_ASSERT_EQUALS(true, false, valueOfTok(code, "!=").intvalue == 1);
code = "void f(int i, int j) {\n" code = "void f(int i, int j) {\n"
" if (i == j) return;\n" " if (i == j) return;\n"
@ -3544,7 +3544,7 @@ private:
" bool x = (i != j);\n" " bool x = (i != j);\n"
" bool b = x;\n" " bool b = x;\n"
"}\n"; "}\n";
ASSERT_EQUALS(true, testValueOfXKnown(code, 4U, 0)); TODO_ASSERT_EQUALS(true, false, testValueOfXKnown(code, 4U, 0));
code = "void f(int i, int j) {\n" code = "void f(int i, int j) {\n"
" if (i != j) return;\n" " if (i != j) return;\n"
@ -3575,6 +3575,16 @@ private:
" if(i != j) {}\n" " if(i != j) {}\n"
"}\n"; "}\n";
ASSERT_EQUALS(false, valueOfTok(code, "!=").intvalue == 1); ASSERT_EQUALS(false, valueOfTok(code, "!=").intvalue == 1);
code = "void foo()\n" // #8924
"{\n"
" if ( this->FileIndex >= 0 )\n"
" return;\n"
"\n"
" this->FileIndex = 1 ;\n"
" if ( this->FileIndex < 0 ) {}\n"
"}";
ASSERT_EQUALS(false, valueOfTok(code, "<").intvalue == 1);
} }
static std::string isPossibleContainerSizeValue(const std::list<ValueFlow::Value> &values, MathLib::bigint i) { static std::string isPossibleContainerSizeValue(const std::list<ValueFlow::Value> &values, MathLib::bigint i) {