[cfe-dev] Using AST nodes with clang dynamic matchers

David Come via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 8 09:22:08 PST 2017


Hello,

I'm building a tool to find AST nodes according to an user provided file 
using a custom language. I'm also using clang dynamic matchers to find 
interesting nodes within functions CFG and do a bunch of thing. I would 
like to re-use one of the node I found previously in one of the clang 
matchers.


There is equalsNode for static matchers but it obviously does not work 
with clang dynamic matchers.


My idea would be to circumvent the problem by introducing into the 
matcher (once created from the string) already bounded nodes and use 
equalsBoundNode. But I can't find a way to do it.


This could be handy to re-use in clang-query one match result into 
another one (some kind of persistent matching)


Do you see another way to achieve what I wish to ?


My last resort will be to change clang source code (assuming I'm 
successful) and let my tool rely on it but I would really like to stick 
to vanilla clang.


Thanks,

David.




More information about the cfe-dev mailing list