SymbolDatabase: fix ValueType for '&array[x]'
This commit is contained in:
parent
ecb2938e7e
commit
e45e5f9f15
|
@ -6211,8 +6211,6 @@ void SymbolDatabase::setValueType(Token* tok, const ValueType& valuetype, Source
|
||||||
for (const Token* child = parent->astOperand1(); child;) {
|
for (const Token* child = parent->astOperand1(); child;) {
|
||||||
if (Token::Match(child, ".|::"))
|
if (Token::Match(child, ".|::"))
|
||||||
child = child->astOperand2();
|
child = child->astOperand2();
|
||||||
else if (Token::simpleMatch(child, "["))
|
|
||||||
child = child->astOperand1();
|
|
||||||
else {
|
else {
|
||||||
isArrayToPointerDecay = child->variable() && child->variable()->isArray();
|
isArrayToPointerDecay = child->variable() && child->variable()->isArray();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -7602,6 +7602,7 @@ private:
|
||||||
ASSERT_EQUALS("", typeOf("a = x[\"hello\"];", "[", "test.cpp"));
|
ASSERT_EQUALS("", typeOf("a = x[\"hello\"];", "[", "test.cpp"));
|
||||||
ASSERT_EQUALS("const char", typeOf("a = x[\"hello\"];", "[", "test.c"));
|
ASSERT_EQUALS("const char", typeOf("a = x[\"hello\"];", "[", "test.c"));
|
||||||
ASSERT_EQUALS("signed int *", typeOf("int x[10]; a = &x;", "&"));
|
ASSERT_EQUALS("signed int *", typeOf("int x[10]; a = &x;", "&"));
|
||||||
|
ASSERT_EQUALS("signed int *", typeOf("int x[10]; a = &x[1];", "&"));
|
||||||
|
|
||||||
// cast..
|
// cast..
|
||||||
ASSERT_EQUALS("void *", typeOf("a = (void *)0;", "("));
|
ASSERT_EQUALS("void *", typeOf("a = (void *)0;", "("));
|
||||||
|
|
Loading…
Reference in New Issue