using AstMatchers to identify user defined pragmas

Hello,

I am trying to use AstMatchers to identify a custom user defined pragma(say “#pragma myPragma”) in my source code. But when I dumped the AST for my source code, I do not see the pragma as part of the AST. Is it possible to use AstMatcher to figure out the user defined Pragmas using astMatchers??

regards,
deepak

In article <CALLs9tteox05gFLZDyNJ6OyiN6kF4J3OjTC2jVxKU_UAcGrVvg@mail.gmail.com>,
    Deepak Rajendrakumaran <deepak3@vt.edu> writes:

I am trying to use AstMatchers to identify a custom user defined pragma(say
"#pragma myPragma") in my source code. But when I dumped the AST for my
source code, I do not see the pragma as part of the AST. Is it possible to
use AstMatcher to figure out the user defined Pragmas using astMatchers??

#pragma is a directive to the preprocessor and those aren't recorded
in the AST and therefore not seen by matchers. However, you can hook
into preprocessing through the PPCallbacks class:
<http://clang.llvm.org/doxygen/classclang_1_1PPCallbacks.html>