Fixed #7124 (int32_t etc are recognised as fundamental types, but std::int32_t etc are not)

This commit is contained in:
Daniel Marjamäki 2015-11-15 17:51:27 +01:00
parent 2a4cceae9e
commit ca8b15cd6b
3 changed files with 46 additions and 29 deletions

View File

@ -4048,34 +4048,34 @@
<type templateParameter="0"/>
</container>
<container id="stdString" startPattern="std :: string|wstring|u16string|u32string" endPattern="" inherits="stdAllString"/>
<podtype name="int8_t" sign="s" size="1"/>
<podtype name="int16_t" sign="s" size="2"/>
<podtype name="int32_t" sign="s" size="4"/>
<podtype name="int64_t" sign="s" size="8"/>
<podtype name="uint8_t" sign="u" size="1"/>
<podtype name="uint16_t" sign="u" size="2"/>
<podtype name="uint32_t" sign="u" size="4"/>
<podtype name="uint64_t" sign="u" size="8"/>
<podtype name="int_fast8_t" sign="s"/>
<podtype name="int_fast16_t" sign="s"/>
<podtype name="int_fast32_t" sign="s"/>
<podtype name="int_fast64_t" sign="s"/>
<podtype name="int_least8_t" sign="s"/>
<podtype name="int_least16_t" sign="s"/>
<podtype name="int_least32_t" sign="s"/>
<podtype name="int_least64_t" sign="s"/>
<podtype name="uint_fast8_t" sign="u"/>
<podtype name="uint_fast16_t" sign="u"/>
<podtype name="uint_fast32_t" sign="u"/>
<podtype name="uint_fast64_t" sign="u"/>
<podtype name="uint_least8_t" sign="u"/>
<podtype name="uint_least16_t" sign="u"/>
<podtype name="uint_least32_t" sign="u"/>
<podtype name="uint_least64_t" sign="u"/>
<podtype name="intptr_t" sign="s"/>
<podtype name="uintptr_t" sign="u"/>
<podtype name="intmax_t" sign="s"/>
<podtype name="uintmax_t" sign="u"/>
<podtype name="int8_t,std::int8_t" sign="s" size="1"/>
<podtype name="int16_t,std::int16_t" sign="s" size="2"/>
<podtype name="int32_t,std::int32_t" sign="s" size="4"/>
<podtype name="int64_t,std::int64_t" sign="s" size="8"/>
<podtype name="uint8_t,std::uint8_t" sign="u" size="1"/>
<podtype name="uint16_t,std::uint16_t" sign="u" size="2"/>
<podtype name="uint32_t,std::uint32_t" sign="u" size="4"/>
<podtype name="uint64_t,std::uint64_t" sign="u" size="8"/>
<podtype name="int_fast8_t,std::int_fast8_t" sign="s"/>
<podtype name="int_fast16_t,std::int_fast16_t" sign="s"/>
<podtype name="int_fast32_t,std::int_fast32_t" sign="s"/>
<podtype name="int_fast64_t,std::int_fast64_t" sign="s"/>
<podtype name="int_least8_t,std::int_least8_t" sign="s"/>
<podtype name="int_least16_t,std::int_least16_t" sign="s"/>
<podtype name="int_least32_t,std::int_least32_t" sign="s"/>
<podtype name="int_least64_t,std::int_least64_t" sign="s"/>
<podtype name="uint_fast8_t,std::uint_fast8_t" sign="u"/>
<podtype name="uint_fast16_t,std::uint_fast16_t" sign="u"/>
<podtype name="uint_fast32_t,std::uint_fast32_t" sign="u"/>
<podtype name="uint_fast64_t,std::uint_fast64_t" sign="u"/>
<podtype name="uint_least8_t,std::uint_least8_t" sign="u"/>
<podtype name="uint_least16_t,std::uint_least16_t" sign="u"/>
<podtype name="uint_least32_t,std::uint_least32_t" sign="u"/>
<podtype name="uint_least64_t,std::uint_least64_t" sign="u"/>
<podtype name="intptr_t,std::intptr_t" sign="s"/>
<podtype name="uintptr_t,std::uintptr_t" sign="u"/>
<podtype name="intmax_t,std::intmax_t" sign="s"/>
<podtype name="uintmax_t,std::uintmax_t" sign="u"/>
<podtype name="size_t" sign="u"/>
<podtype name="double_t"/>
<podtype name="float_t"/>

View File

@ -1481,7 +1481,10 @@ void Variable::evaluate(const Library* lib)
_end = _end->previous();
if (_start) {
setFlag(fIsClass, !_start->isStandardType() && !isPointer() && !isReference());
std::string strtype = _start->str();
for (const Token *typeToken = _start; Token::Match(typeToken, "%type% :: %type%"); typeToken = typeToken->tokAt(2))
strtype += "::" + typeToken->strAt(2);
setFlag(fIsClass, !lib->podtype(strtype) && !_start->isStandardType() && !isPointer() && !isReference());
setFlag(fIsStlType, Token::simpleMatch(_start, "std ::"));
setFlag(fIsStlString, isStlType() && (Token::Match(_start->tokAt(2), "string|wstring|u16string|u32string !!::") || (Token::simpleMatch(_start->tokAt(2), "basic_string <") && !Token::simpleMatch(_start->linkAt(3), "> ::"))));
}

View File

@ -234,6 +234,7 @@ private:
TEST_CASE(symboldatabase50); // #6432
TEST_CASE(symboldatabase51); // #6538
TEST_CASE(symboldatabase52); // #6581
TEST_CASE(symboldatabase53); // #7124 (library podtype)
TEST_CASE(isImplicitlyVirtual);
TEST_CASE(isPure);
@ -2191,6 +2192,19 @@ private:
}
}
void symboldatabase53() { // #7124
GET_SYMBOL_DB("int32_t x;"
"std::int32_t y;");
ASSERT(db != nullptr);
if (db) {
ASSERT(db->getVariableFromVarId(1));
ASSERT(db->getVariableFromVarId(2));
ASSERT_EQUALS(false, db->getVariableFromVarId(1)->isClass());
ASSERT_EQUALS(false, db->getVariableFromVarId(2)->isClass());
}
}
void isImplicitlyVirtual() {
{
GET_SYMBOL_DB("class Base {\n"