[cfe-dev] How to rewrite a header file?
Miklos Vajna via cfe-dev
cfe-dev at lists.llvm.org
Thu Sep 7 05:28:13 PDT 2017
Hi,
On Wed, Sep 06, 2017 at 08:01:30PM +0200, Marcel Schaible via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> my tool changes the signatures of some annotated C functions in .c files.
>
> Now I am facing the problem that I have to propaged this changes into
> the corresponding
>
> header file.
>
> How can I do this? Can I use something like ASTConsumer/RecursiveAstVisitor?
>
> Any hint and/or idea is welcome. Is there some example code available?
Look at clang-tools-extra for examples. Rewriting in header files
happens out of the box, but if you want to check if your location is in
the "main" file or in a header file, you can use the source manager's
isInMainFile() for that purpose. See e.g.
tools/clang/tools/extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp:55
for a place where that happens.
Regards,
Miklos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170907/f4588799/attachment.sig>
More information about the cfe-dev
mailing list