Andrew Sutton <andrew.n.sut...@gmail.com> writes:

| > Internally, we want to always store the canonical form of a decl, not the
| > source-level form -- the current g++ AST isn't prepared for that (I wish
| > it was, but it isn't.)  This allows for simple comparison and other
| > semantics processing.
| 
| Agreed. But without some source-level annotations in the tree, I don't
| think I can generate the diagnostics that programmer's might otherwise
| expect. I'd have to emit the internal representation.

Do you have examples where we don't do or we can't do the obvious thing
in terms of diagnostics?

The source-level information has to sit above the current AST
representation; not mixed with it -- it doesn't expect and isn't
prepared for redundancy.

| >> I think we want constraints for:
| >>
| >>   * FUNCTION_DECL
| >>   * TEMPLATE_DECL
| >>   * TYPE_DECL
| >>   * TEMPLATE_PARM_DECL
| >
| > Well, thinking more about it, I believe we want it only for
| >    * TEMPLATE_DECL
| >    * TEMPLATE_PARM_DECL.
| >
| > The FUNCTION_DECL and the TYPE_DECL gets their constraints
| > from the abstract instantiation of the associated TEMPLATE_DECL.
| 
| If those constraints are cached, I don't see any other place to put
| them except in the template info.

Exactly.

| On the other hand, it seems like the only place we actually need to
| worry about is with non-template member functions.

Member function of templates are temploids, so no worry there either.
(Internally, they act and are represented like templates.)

| I think I can just grab the requirements and arguments and check them
| without caching them in the template_info.

I think we need to remember them for duplicate_decls or other routines
that either check or use ODR-derived properties.

| I'll have to experiment.
| 
| We still don't have nodes specific to TEMPLTAE_DECL or
| TEMPLATE_PARM_DECL though.

A tree with TREE_CODE equal to TEMPLATE_DECL or TEMPLATE_PARM_DECL is
just that.  What we do is to use all unused- tree slots.  Or are you
suggesting we have exhausted all available pre-defined slots on such nodes?

| It seems like lang_decl_min is the only
| place to put this where it will be avilable to both.

We have to try hard to avoid growing lang_decl_min.

-- Gaby

Reply via email to