parent
ccd525962b
commit
1ec7397c21
|
@ -725,8 +725,7 @@ void execute(const Token* expr,
|
||||||
*result = 0;
|
*result = 0;
|
||||||
else
|
else
|
||||||
*error = true;
|
*error = true;
|
||||||
}
|
} else if (expr->str() == "(" && expr->isCast()) {
|
||||||
else if (expr->str() == "(" && expr->isCast()) {
|
|
||||||
if (Token::simpleMatch(expr->previous(), ">") && expr->previous()->link())
|
if (Token::simpleMatch(expr->previous(), ">") && expr->previous()->link())
|
||||||
execute(expr->astOperand2(), programMemory, result, error);
|
execute(expr->astOperand2(), programMemory, result, error);
|
||||||
else
|
else
|
||||||
|
|
|
@ -4610,7 +4610,9 @@ struct ConditionHandler {
|
||||||
std::all_of(values.begin(), values.end(), [](const ValueFlow::Value& v) {
|
std::all_of(values.begin(), values.end(), [](const ValueFlow::Value& v) {
|
||||||
return v.isIntValue() || v.isFloatValue();
|
return v.isIntValue() || v.isFloatValue();
|
||||||
})))
|
})))
|
||||||
values.remove_if([&](const ValueFlow::Value& v) { return v.isImpossible(); });
|
values.remove_if([&](const ValueFlow::Value& v) {
|
||||||
|
return v.isImpossible();
|
||||||
|
});
|
||||||
Analyzer::Result r = forward(parent->astOperand2(), cond.vartok, values, tokenlist, settings);
|
Analyzer::Result r = forward(parent->astOperand2(), cond.vartok, values, tokenlist, settings);
|
||||||
if (r.terminate != Analyzer::Terminate::None)
|
if (r.terminate != Analyzer::Terminate::None)
|
||||||
return;
|
return;
|
||||||
|
@ -4807,8 +4809,7 @@ struct SimpleConditionHandler : ConditionHandler {
|
||||||
const Token* exprTok,
|
const Token* exprTok,
|
||||||
const std::list<ValueFlow::Value>& values,
|
const std::list<ValueFlow::Value>& values,
|
||||||
TokenList* tokenlist,
|
TokenList* tokenlist,
|
||||||
const Settings* settings) const OVERRIDE
|
const Settings* settings) const OVERRIDE {
|
||||||
{
|
|
||||||
return valueFlowForward(top, exprTok, values, tokenlist, settings);
|
return valueFlowForward(top, exprTok, values, tokenlist, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4821,8 +4822,7 @@ struct SimpleConditionHandler : ConditionHandler {
|
||||||
return valueFlowReverse(start, endToken, exprTok, values, tokenlist, settings);
|
return valueFlowReverse(start, endToken, exprTok, values, tokenlist, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::vector<Condition> parse(const Token* tok, const Settings*) const OVERRIDE
|
virtual std::vector<Condition> parse(const Token* tok, const Settings*) const OVERRIDE {
|
||||||
{
|
|
||||||
Condition cond;
|
Condition cond;
|
||||||
ValueFlow::Value true_value;
|
ValueFlow::Value true_value;
|
||||||
ValueFlow::Value false_value;
|
ValueFlow::Value false_value;
|
||||||
|
@ -6355,8 +6355,7 @@ static std::list<ValueFlow::Value> getIteratorValues(std::list<ValueFlow::Value>
|
||||||
}
|
}
|
||||||
|
|
||||||
struct IteratorConditionHandler : SimpleConditionHandler {
|
struct IteratorConditionHandler : SimpleConditionHandler {
|
||||||
virtual std::vector<Condition> parse(const Token* tok, const Settings*) const OVERRIDE
|
virtual std::vector<Condition> parse(const Token* tok, const Settings*) const OVERRIDE {
|
||||||
{
|
|
||||||
Condition cond;
|
Condition cond;
|
||||||
|
|
||||||
ValueFlow::Value true_value;
|
ValueFlow::Value true_value;
|
||||||
|
@ -6567,8 +6566,7 @@ struct ContainerConditionHandler : ConditionHandler {
|
||||||
const Token* exprTok,
|
const Token* exprTok,
|
||||||
const std::list<ValueFlow::Value>& values,
|
const std::list<ValueFlow::Value>& values,
|
||||||
TokenList* tokenlist,
|
TokenList* tokenlist,
|
||||||
const Settings*) const OVERRIDE
|
const Settings*) const OVERRIDE {
|
||||||
{
|
|
||||||
Analyzer::Result result{};
|
Analyzer::Result result{};
|
||||||
for (const ValueFlow::Value& value : values)
|
for (const ValueFlow::Value& value : values)
|
||||||
result.update(valueFlowContainerForwardRecursive(top, exprTok, value, tokenlist));
|
result.update(valueFlowContainerForwardRecursive(top, exprTok, value, tokenlist));
|
||||||
|
@ -6584,8 +6582,7 @@ struct ContainerConditionHandler : ConditionHandler {
|
||||||
return valueFlowContainerReverse(start, endTok, exprTok, values, tokenlist, settings);
|
return valueFlowContainerReverse(start, endTok, exprTok, values, tokenlist, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::vector<Condition> parse(const Token* tok, const Settings*) const OVERRIDE
|
virtual std::vector<Condition> parse(const Token* tok, const Settings*) const OVERRIDE {
|
||||||
{
|
|
||||||
Condition cond;
|
Condition cond;
|
||||||
ValueFlow::Value true_value;
|
ValueFlow::Value true_value;
|
||||||
ValueFlow::Value false_value;
|
ValueFlow::Value false_value;
|
||||||
|
|
|
@ -286,7 +286,9 @@ namespace ValueFlow {
|
||||||
bool isIteratorEndValue() const {
|
bool isIteratorEndValue() const {
|
||||||
return valueType == ValueType::ITERATOR_END;
|
return valueType == ValueType::ITERATOR_END;
|
||||||
}
|
}
|
||||||
bool isSymbolicValue() const { return valueType == ValueType::SYMBOLIC; }
|
bool isSymbolicValue() const {
|
||||||
|
return valueType == ValueType::SYMBOLIC;
|
||||||
|
}
|
||||||
|
|
||||||
bool isLocalLifetimeValue() const {
|
bool isLocalLifetimeValue() const {
|
||||||
return valueType == ValueType::LIFETIME && lifetimeScope == LifetimeScope::Local;
|
return valueType == ValueType::LIFETIME && lifetimeScope == LifetimeScope::Local;
|
||||||
|
|
|
@ -1419,8 +1419,7 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void iterator27()
|
void iterator27() {
|
||||||
{
|
|
||||||
// #10378
|
// #10378
|
||||||
check("struct A {\n"
|
check("struct A {\n"
|
||||||
" int a;\n"
|
" int a;\n"
|
||||||
|
|
|
@ -154,7 +154,9 @@ private:
|
||||||
return !val.isLifetimeValue();
|
return !val.isLifetimeValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isNotUninitValue(const ValueFlow::Value& val) { return !val.isUninitValue(); }
|
static bool isNotUninitValue(const ValueFlow::Value& val) {
|
||||||
|
return !val.isUninitValue();
|
||||||
|
}
|
||||||
|
|
||||||
static bool isNotPossible(const ValueFlow::Value& val) {
|
static bool isNotPossible(const ValueFlow::Value& val) {
|
||||||
return !val.isPossible();
|
return !val.isPossible();
|
||||||
|
|
Loading…
Reference in New Issue