[cfe-dev] Get full source of multiple macro definitions using libtooling
Manuel Klimek via cfe-dev
cfe-dev at lists.llvm.org
Mon May 9 07:29:55 PDT 2016
On Mon, May 9, 2016 at 4:13 PM John Bartelme <bartelme at gmail.com> wrote:
> 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
>
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160509/e915663e/attachment.html>
More information about the cfe-dev
mailing list