diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index c1f6dc5d8..a92a20545 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -4864,17 +4864,23 @@ void SymbolDatabase::setValueTypeInTokenList(Token *tokens, bool cpp, const Sett const Token *typeTok = tok->next(); if (Token::Match(typeTok, "( std| ::| nothrow )")) typeTok = typeTok->link()->next(); + std::string typestr; + while (Token::Match(typeTok, "%name% :: %name%")) { + typestr += typeTok->str() + "::"; + typeTok = typeTok->tokAt(2); + } if (!Token::Match(typeTok, "%type% ;|[|(")) return; + typestr += typeTok->str(); ValueType vt; vt.pointer = 1; if (typeTok->type() && typeTok->type()->classScope) { vt.type = ValueType::Type::NONSTD; vt.typeScope = typeTok->type()->classScope; } else { - vt.type = ValueType::typeFromString(typeTok->str(), typeTok->isLong()); + vt.type = ValueType::typeFromString(typestr, typeTok->isLong()); if (vt.type == ValueType::Type::UNKNOWN_TYPE) - vt.fromLibraryType(typeTok->str(), settings); + vt.fromLibraryType(typestr, settings); if (vt.type == ValueType::Type::UNKNOWN_TYPE) return; if (typeTok->isUnsigned()) diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 8181a3fd0..c1844794b 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -4289,13 +4289,14 @@ private: settingsWin64.platformType = Settings::Win64; const Library::PodType u32 = { 4, 'u' }; settingsWin64.library.podtypes["u32"] = u32; - settingsWin64.library.podtypes["xyz::u32"] = u32; + settingsWin64.library.podtypes["xyz::x"] = u32; ValueType vt; ASSERT_EQUALS(true, vt.fromLibraryType("u32", &settingsWin64)); - ASSERT_EQUALS(true, vt.fromLibraryType("xyz::u32", &settingsWin64)); + ASSERT_EQUALS(true, vt.fromLibraryType("xyz::x", &settingsWin64)); ASSERT_EQUALS(ValueType::Type::INT, vt.type); ASSERT_EQUALS("unsigned int *", typeOf(";void *data = new u32[10];", "new", "test.cpp", &settingsWin64)); - ASSERT_EQUALS("unsigned int", typeOf("; x = (xyz::u32)12;", "(", "test.cpp", &settingsWin64)); + ASSERT_EQUALS("unsigned int *", typeOf(";void *data = new xyz::x[10];", "new", "test.cpp", &settingsWin64)); + ASSERT_EQUALS("unsigned int", typeOf("; x = (xyz::x)12;", "(", "test.cpp", &settingsWin64)); } { // PlatformType