This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Putting C++ code into gcc front end
Geoff Keating wrote:
Yes, I completely agree. In particular, we currently represent types
and statements/expressions using trees, and I believe it's never the
case that you can substitute one for the other (and what would that
mean, anyway?); so why don't we have completely distinct type_tree and
expr_tree data structures?
Agree in principle, but there are some complications.
For example decls can be expressions, which means expr_tree
and decl_tree have to be the same. If you have "unresolved
identifier" in the tree, then identifier has to be an expr_tree.
You can solve both of these cleanly by adding a DECL_REFERENCE
expression type.
> Of course, this has been mentioned several times before, and no-one's
> produced a patch...
Is there a way to make this change incrementally, such that
you could use type_tree in a variable or parameter declaration,
without having to fix everywhere at once? Of course C++ would
make that too easier ... For C, I can't think of any way,
except making type_tree just be a typedef for tree, which might
still be worthwhile for documentation purposes.
--
--Per Bothner
per at bothner dot com http://www.bothner.com/per/