ExprEngine: Handle 'break' and 'while (0);'
This commit is contained in:
parent
dcf8a7213f
commit
6c0c9ba6d3
|
@ -563,6 +563,11 @@ struct ExprData {
|
||||||
getExpr(c->values[0].second));
|
getExpr(c->values[0].second));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (auto integerTruncation = std::dynamic_pointer_cast<ExprEngine::IntegerTruncation>(v)) {
|
||||||
|
return getExpr(integerTruncation->inputValue);
|
||||||
|
//return getExpr(integerTruncation->inputValue) & ((1 << integerTruncation->bits) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (v->type == ExprEngine::ValueType::UninitValue)
|
if (v->type == ExprEngine::ValueType::UninitValue)
|
||||||
return context.int_val(0);
|
return context.int_val(0);
|
||||||
|
|
||||||
|
@ -1036,6 +1041,14 @@ static void execute(const Token *start, const Token *end, Data &data)
|
||||||
if (Token::Match(tok, "[;{}]"))
|
if (Token::Match(tok, "[;{}]"))
|
||||||
data.trackProgramState(tok);
|
data.trackProgramState(tok);
|
||||||
|
|
||||||
|
if (Token::simpleMatch(tok, "while ( 0 ) ;")) {
|
||||||
|
tok = tok->tokAt(4);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tok->str() == "break")
|
||||||
|
return;
|
||||||
|
|
||||||
if (Token::Match(tok, "for|while|switch ("))
|
if (Token::Match(tok, "for|while|switch ("))
|
||||||
// TODO this is a bailout
|
// TODO this is a bailout
|
||||||
throw std::runtime_error("Unhandled:" + tok->str());
|
throw std::runtime_error("Unhandled:" + tok->str());
|
||||||
|
|
Loading…
Reference in New Issue