From 803b4d4cf8d228e8c1bc31a3ed35ef1fb18cbfcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 8 May 2016 14:55:10 +0200 Subject: [PATCH] ValueType: Better handling of nested types --- lib/symboldatabase.cpp | 2 +- test/testsymboldatabase.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 13a1c1cf2..2f5350ee1 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -4228,7 +4228,7 @@ static const Token * parsedecl(const Token *type, ValueType * const valuetype, V type = type->previous(); valuetype->sign = ValueType::Sign::UNKNOWN_SIGN; valuetype->type = valuetype->typeScope ? ValueType::Type::NONSTD : ValueType::Type::UNKNOWN_TYPE; - while (Token::Match(type, "%name%|*|&") && !type->variable()) { + while (Token::Match(type, "%name%|*|&|::") && !type->variable()) { if (type->isSigned()) valuetype->sign = ValueType::Sign::SIGNED; else if (type->isUnsigned()) diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 66719917b..c9ab0d02e 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -3225,6 +3225,7 @@ private: ASSERT_EQUALS("AB *", typeOf("struct AB {int a; int b;}; AB ab; x=&ab;", "&")); ASSERT_EQUALS("AB *", typeOf("struct AB {int a; int b;}; struct AB ab; x=&ab;", "&")); ASSERT_EQUALS("A::BC *", typeOf("namespace A { struct BC { int b; int c; }; }; struct A::BC abc; x=&abc;", "&")); + ASSERT_EQUALS("A::BC *", typeOf("namespace A { struct BC { int b; int c; }; }; struct A::BC *abc; x=abc+1;", "+")); // Unary arithmetic/bit operators ASSERT_EQUALS("signed int", typeOf("int x; a = -x;", "-"));