libtooling: how to parse #include directive

Hi *,
I would like to match and then rewrite “#include” directives, is it possible via libtooling’s API ?
how can I use ASTMatcher for matching “#include” directives ?

thanks!

Please take a look at this clang-tidy check which uses preprocessor callbacks instead of ASTMatchers.

https://clang.llvm.org/extra/doxygen/IncludeOrderCheck_8cpp_source.html

It just reorders them, but you should be able to use it as template…

hth…
don