Fixed #7694 (ValueType: 1.23L)

This commit is contained in:
Daniel Marjamäki 2016-08-20 08:44:53 +02:00
parent b56c765a45
commit 8a66535399
2 changed files with 6 additions and 0 deletions

View File

@ -4497,6 +4497,8 @@ void SymbolDatabase::setValueTypeInTokenList(Token *tokens, bool cpp, const Sett
const char suffix = tok->str()[tok->str().size() - 1U]; const char suffix = tok->str()[tok->str().size() - 1U];
if (suffix == 'f' || suffix == 'F') if (suffix == 'f' || suffix == 'F')
type = ValueType::Type::FLOAT; type = ValueType::Type::FLOAT;
else if (suffix == 'L' || suffix == 'l')
type = ValueType::Type::LONGDOUBLE;
::setValueType(tok, ValueType(ValueType::Sign::UNKNOWN_SIGN, type, 0U), cpp, defsign, settings); ::setValueType(tok, ValueType(ValueType::Sign::UNKNOWN_SIGN, type, 0U), cpp, defsign, settings);
} else if (MathLib::isInt(tok->str())) { } else if (MathLib::isInt(tok->str())) {
ValueType::Sign sign = ValueType::Sign::SIGNED; ValueType::Sign sign = ValueType::Sign::SIGNED;

View File

@ -3842,6 +3842,7 @@ private:
ASSERT_EQUALS("unsigned long", typeOf("1UL", "1UL")); ASSERT_EQUALS("unsigned long", typeOf("1UL", "1UL"));
ASSERT_EQUALS("signed long long", typeOf("1LL", "1LL")); ASSERT_EQUALS("signed long long", typeOf("1LL", "1LL"));
ASSERT_EQUALS("unsigned long long", typeOf("1ULL", "1ULL")); ASSERT_EQUALS("unsigned long long", typeOf("1ULL", "1ULL"));
ASSERT_EQUALS("unsigned long long", typeOf("1LLU", "1LLU"));
ASSERT_EQUALS("signed long long", typeOf("1i64", "1i64")); ASSERT_EQUALS("signed long long", typeOf("1i64", "1i64"));
ASSERT_EQUALS("unsigned long long", typeOf("1ui64", "1ui64")); ASSERT_EQUALS("unsigned long long", typeOf("1ui64", "1ui64"));
ASSERT_EQUALS("unsigned int", typeOf("1u", "1u")); ASSERT_EQUALS("unsigned int", typeOf("1u", "1u"));
@ -3849,9 +3850,12 @@ private:
ASSERT_EQUALS("unsigned long", typeOf("1ul", "1ul")); ASSERT_EQUALS("unsigned long", typeOf("1ul", "1ul"));
ASSERT_EQUALS("signed long long", typeOf("1ll", "1ll")); ASSERT_EQUALS("signed long long", typeOf("1ll", "1ll"));
ASSERT_EQUALS("unsigned long long", typeOf("1ull", "1ull")); ASSERT_EQUALS("unsigned long long", typeOf("1ull", "1ull"));
ASSERT_EQUALS("unsigned long long", typeOf("1llu", "1llu"));
ASSERT_EQUALS("float", typeOf("1.0F", "1.0F")); ASSERT_EQUALS("float", typeOf("1.0F", "1.0F"));
ASSERT_EQUALS("float", typeOf("1.0f", "1.0f")); ASSERT_EQUALS("float", typeOf("1.0f", "1.0f"));
ASSERT_EQUALS("double", typeOf("1.0", "1.0")); ASSERT_EQUALS("double", typeOf("1.0", "1.0"));
ASSERT_EQUALS("double", typeOf("1E3", "1E3"));
ASSERT_EQUALS("long double", typeOf("1.23L", "1.23L"));
// Constant calculations // Constant calculations
ASSERT_EQUALS("signed int", typeOf("1 + 2", "+")); ASSERT_EQUALS("signed int", typeOf("1 + 2", "+"));