DECL_RESULT not available for declared (but not defined) function?
Gabriel Dos Reis
gdr@integrable-solutions.net
Tue Sep 23 09:36:00 GMT 2003
Alexandre Courbot <Alexandre.Courbot@lifl.fr> writes:
| Hi everybody,
|
| Every time I make a function call I need to know the return type of the
| callee. Fonction calls on my target can only happen on declared functions
| (not function pointers), so to get the return type I simply get the tree of
| the symbol_ref with SYMBOL_REF_DECL and the result node with DECL_RESULT.
|
| However, consider the following code:
|
| int tstfunc();
|
| void boo()
| {
| int i = tstfunc();
| }
for C, C++ (and probably any C-like front-end), the return type of a
function is given by the TREE_TYPE of its TREE_TYPE. If you have a
call, therefore an expression, then you can just look at its TREE_TYPE
just like for any expression.
If you have a funuction descriptor, e.g. tstfunc, then
TREE_TYPE (TREE_TYPE (tstfunc))
should return int.
Have a look at doc/c-tree.texi.
-- Gaby
More information about the Gcc
mailing list