Re: GCC plugins: mapping AST back to source files, missing locations.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 18 October 2012 11:06:24 Ian Lance Taylor wrote:
> On Thu, Oct 18, 2012 at 9:34 AM, mefyl <mefyl@xxxxxxxxxxxx> wrote:
> > I fear that due to the compiler nature of GCC, the AST I'm working on is
> > altered, with some processing and simplification already applied,
> > preventing source-to-source code transformation since one cannot map ast
> > chunks back to source files. Could anyone confirm or point me in some
> > direction if I'm wrong ? In the case it's indeed impossible, is there any
> > intent to improve this aspect, like giving access to earlier stages of
> > the AST (freshly parsed, with only variable bindings for instance) ? This
> > would enable to write extremely powerfull analysis & refactoring tools.
> 
> Unfortunately the GCC AST almost certainly does not retain enough
> information for the kind of transformations you want to do.  This is a
> deficiency in the AST, but I can't even estimate how difficult it
> would be to fix.

Thank you for your answer, that saved me a lot of time and struggle. Digging a 
bit further I see that some other constructions are already simplified or even 
trimmed in the AST, so mapping back to source seems indeed not reasonably 
feasible. This perfectly make sense given GCC's background and primary goals, 
though. I'll give it a try with CLang plugins.

Cheers,

-- 
mefyl



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux