ValueType: function return type

This commit is contained in:
Daniel Marjamäki 2015-10-11 08:42:31 +02:00
parent cf179f82b6
commit 9738cc66eb
2 changed files with 10 additions and 0 deletions

View File

@ -3834,6 +3834,13 @@ void SymbolDatabase::setValueTypeInTokenList(Token *tokens)
if (Token::simpleMatch(parsedecl(tok->next(), &valuetype), ")"))
::setValueType(tok, valuetype);
}
// function
if (tok->previous() && tok->previous()->function() && tok->previous()->function()->retDef) {
ValueType valuetype;
if (Token::simpleMatch(parsedecl(tok->previous()->function()->retDef, &valuetype), "("))
::setValueType(tok, valuetype);
}
} else if (tok->variable()) {
const Variable *var = tok->variable();
ValueType valuetype;

View File

@ -3009,6 +3009,9 @@ private:
ASSERT_EQUALS("const int *", typeOf("const int *a; x = a + 1;", "a +"));
ASSERT_EQUALS("int * const", typeOf("int * const a; x = a + 1;", "+"));
ASSERT_EQUALS("const int *", typeOf("const int a[20]; x = a + 1;", "+"));
// function call..
ASSERT_EQUALS("int", typeOf("int a(int); a(5);", "( 5"));
}
};