[cfe-dev] Recursive ASTMatcher expressions

Luke Titley luke.titley at gmail.com
Tue Aug 26 03:38:17 PDT 2014


Hi my name is Luke Titley,

I'm a c++ developer based in London and I'm experimenting with clang
libtooling.
It's really a lot of fun and already I can see the power of using AST
matchers for automatic re-factoring.

clang, really does provide a top notch set of tools.

There's one thing I'm not 100 % clear on.
Is is possible to create recursive/(self referential) ASTMatcher
expressions?

For example, if I wanted a matcher to match this scenario.

int var = 1;
int * foo = &var;
int * bar = foo;
int * baz = bar;
... Add infinitum ...

I'd like my matcher to match
foo
bar
and baz

I want to track every pointer that is initialized with a reference to a
variable that is initialized with a value of 1.

I imagine this would be done with some sort of self referential definition.
Is that correct ?

Thanks in advance,
and thanks for all the hard work!

Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140826/1f7d79d1/attachment.html>


More information about the cfe-dev mailing list