ValueType: Better handling of nested types
This commit is contained in:
parent
636e97c272
commit
803b4d4cf8
|
@ -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())
|
||||
|
|
|
@ -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;", "-"));
|
||||
|
|
Loading…
Reference in New Issue