<p dir="ltr"><br>
On May 10, 2016 8:54 AM, "John Bartelme" <<a href="mailto:bartelme@gmail.com">bartelme@gmail.com</a>> wrote:<br>
><br>
><br>
> On May 9, 2016 10:30 AM, "Manuel Klimek" <<a href="mailto:klimek@google.com">klimek@google.com</a>> wrote:<br>
> ><br>
> > On Mon, May 9, 2016 at 4:13 PM John Bartelme <<a href="mailto:bartelme@gmail.com">bartelme@gmail.com</a>> wrote:<br>
> >><br>
> >> Thanks for the response.  As I alluded to in the opening paragraph I have thousands of legacy header files that are a various mix of linkages and interdependencies.  I have a need to strip out various structures and typedefs and all structures/enums etc. they depend on from these files and make just one small cohesive header.  I looked around a lot to try and see what various technologies I could leverage for this end and ultimately decided that libtooling would give me the best shot at it.  I was able to get everything pulled out except for the statements that have multiple macros as described earlier.  I’m using Lexer::getSourceText to access the source for the given range.  Perhaps there is a way to print out the source after it has already been preprocessed and macros expanded?  I’m very open to switching gears if it is believed there is an easier way to do this.  Thanks, john<br>
> ><br>
> > Ok, yea, in that case just running it past -E first seems like that might make things considerably easier; generally, clang tries to preserve all the macro expansion history, but in your case, it sounds like you'd actually prefer a completely flat view. <br>
><br>
> Thank you for the suggestion.  I had actually thought of it earlier in the process but then moved away from it as at the time I thought the macro definitions had to stay in the source.  Given that you say it's challenging or impossible to get at the multiple macro SourceLocations in a statement I'll continue forward with preprocessing first.  If you or any else can think of a way or approach to potentially get at all the expandable SourceLocations in a statement I'd love to here about it as I'll probably come back at a later date and try and tackle this again.   Thanks again for all the help.</p>
<p dir="ltr">After going through more and more structures I've found a case where I really need to retain the macro definition.  If anyone can think of an idea to try and pull out the multiple expansion locations with their spelling locations I'd be grateful.  Thanks.  <br>
</p>