Value flow: added bailout on }
This commit is contained in:
parent
39b47cc1e7
commit
58fb2e756b
|
@ -100,6 +100,12 @@ static void valueFlowBeforeCondition(TokenList *tokenlist, ErrorLogger *errorLog
|
|||
if (var && tok2 == var->nameToken())
|
||||
break;
|
||||
}
|
||||
|
||||
if (tok2->str() == "}") {
|
||||
if (settings->debugwarnings)
|
||||
bailout(tokenlist, errorLogger, tok2, "variable " + var->nameToken()->str() + " stopping on }");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,13 @@ private:
|
|||
"}";
|
||||
ASSERT_EQUALS(true, testValueOfX(code, 2U, 123));
|
||||
|
||||
// bailout: if/else/etc
|
||||
bailout("void f(int x) {\n"
|
||||
" if (x != 123) { b = x; }\n"
|
||||
" if (x == 123) {}\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (debug) ValueFlow bailout: variable x stopping on }\n", errout.str());
|
||||
|
||||
// bailout: assignment
|
||||
bailout("void f(int x) {\n"
|
||||
" x = y;\n"
|
||||
|
|
Loading…
Reference in New Issue