ValueType: Handle function pointers
This commit is contained in:
parent
abf59af87d
commit
c12cb69cc2
|
@ -4297,6 +4297,12 @@ static void setValueType(Token *tok, const ValueType &valuetype, bool cpp, Value
|
|||
setValueType(parent, vt, cpp, defaultSignedness, settings);
|
||||
return;
|
||||
}
|
||||
if (Token::Match(parent->previous(), "%name% (") && parent->astOperand1() == tok && valuetype.pointer > 0U) {
|
||||
ValueType vt(valuetype);
|
||||
vt.pointer -= 1U;
|
||||
setValueType(parent, vt, cpp, defaultSignedness, settings);
|
||||
return;
|
||||
}
|
||||
if (parent->str() == "*" && !parent->astOperand2() && valuetype.pointer > 0U) {
|
||||
ValueType vt(valuetype);
|
||||
vt.pointer -= 1U;
|
||||
|
|
|
@ -4016,6 +4016,7 @@ private:
|
|||
ASSERT_EQUALS("signed int", typeOf("int a(int); a(5);", "( 5"));
|
||||
ASSERT_EQUALS("signed int", typeOf("auto a(int) -> int; a(5);", "( 5"));
|
||||
ASSERT_EQUALS("unsigned long", typeOf("sizeof(x);", "("));
|
||||
ASSERT_EQUALS("signed int", typeOf("int (*a)(int); a(5);", "( 5"));
|
||||
|
||||
// struct member..
|
||||
ASSERT_EQUALS("signed int", typeOf("struct AB { int a; int b; } ab; x = ab.a;", "."));
|
||||
|
|
Loading…
Reference in New Issue