ValueType: Set ValueType for false/true
This commit is contained in:
parent
5a32d2d017
commit
1b4895a579
|
@ -5348,6 +5348,8 @@ void SymbolDatabase::setValueTypeInTokenList()
|
|||
}
|
||||
}
|
||||
setValueType(tok, ValueType(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::BOOL, 0U));
|
||||
} else if (tok->isBoolean()) {
|
||||
setValueType(tok, ValueType(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::BOOL, 0U));
|
||||
} else if (tok->tokType() == Token::eChar)
|
||||
setValueType(tok, ValueType(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::CHAR, 0U));
|
||||
else if (tok->tokType() == Token::eString) {
|
||||
|
|
|
@ -5959,10 +5959,12 @@ private:
|
|||
ASSERT_EQUALS("const char *", typeOf("int x; double y; a = (b ? \"a\" : \"b\");", "?"));
|
||||
ASSERT_EQUALS("", typeOf("int x; double y; a = (b ? \"a\" : std::string(\"b\"));", "?"));
|
||||
|
||||
// Boolean operators
|
||||
// Boolean operators/literals
|
||||
ASSERT_EQUALS("bool", typeOf("a > b;", ">"));
|
||||
ASSERT_EQUALS("bool", typeOf(";!b;", "!"));
|
||||
ASSERT_EQUALS("bool", typeOf("c = a && b;", "&&"));
|
||||
ASSERT_EQUALS("bool", typeOf("a = false;", "false"));
|
||||
ASSERT_EQUALS("bool", typeOf("a = true;", "true"));
|
||||
|
||||
// shift => result has same type as lhs
|
||||
ASSERT_EQUALS("signed int", typeOf("int x; a = x << 1U;", "<<"));
|
||||
|
|
Loading…
Reference in New Issue