There is a lot of duplicated code in the hooks implementation in the
various front ends. I am trying to factor it a little bit.

I started with the builtin_function hook. Doing a mostly mechanical
work I came up with the attached patch. The patch doesn't touches the
C++ front end because it is organised a little differently and would
require more work.

I don't want to apply this patch right now because I think that it can
be made a little better. To do this I need some clarifications:

*) Why does a front end needs to know when a new builtin is added?
*) If the internal representation used is language independent, can we
change the signature of builtin_function to receive just the decl
node?

The next thing I will try to do is wrap all calls to
lang_hooks.builtin_function in a add_builtin_function (in which file
should it be?) and move the common code into it.

Any comments?

Thanks,
Rafael

Attachment: builtin.patch
Description: Binary data

Reply via email to