ValueType: Better handling of nested types

This commit is contained in:
Daniel Marjamäki 2016-05-08 14:55:10 +02:00
parent 636e97c272
commit 803b4d4cf8
2 changed files with 2 additions and 1 deletions

View File

@ -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())

View File

@ -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;", "-"));