On 2009-04-27, at 14:28, Tom Tromey wrote: > > Tom> I am curious how you handle locations on shared bits of the AST. > Tom> I needed some disturbing hacks to make this work well for C. > > Oliver> I'm not sure what you mean; could you explain? > > In the server, the global line map is reset for each compile job (and > it sounds like this is true for your patch as well). So, suppose a > compilation reuses a declaration that was parsed during an earlier > job. The location_t values in this declaration will no longer be > valid; if the compiler emits a diagnostic using this declaration, then > the location will be incorrect. > > In the C compiler I worked around this by resetting locations on > shared decls. The details of this are tied to how the C compiler > implements sharing. > > I was curious to know how you handled this situation. If you re-lower > AST bits to trees for each job, or something like that, then it > probably is not as big a problem for you. >
Ah, yes. There's a GNAT to GNU tree transformation pass (gigi) which is called afresh each time thus I haven't needed to worry about that (AFAIK the line info is filled in from the GNAT tree.) IMHO it would be much more demanding to try to optimize away (parts of) this pass. Certainly beyond me :) Oliver