[cfe-dev] [RFC] Dynamic AST Matcher library

Sean Silva silvas at purdue.edu
Wed Dec 5 12:08:16 PST 2012


On Wed, Dec 5, 2012 at 12:09 PM, Samuel Benzaquen <sbenza at google.com> wrote:
> Full C++ expression support for predicates. Values are going to be limited
> to literals (eg. 1, “foo”). Expressions like 1+2 will not be parsed. Some
> useful constants (like INT_MAX) might be available

This almost seems like an indictment of clang. Isn't the whole point
of clang that we have a library which is capable of doing this?

It seems like the fundamental issue that the dynamic matchers are
trying to address is the long iteration time required by recompile.
Effectively, the dynamic matcher infrastructure would then simply be
special purpose compiler for a subset of C++ with hardcoded semantics
just enough to support the ASTMatchers. That really seems like a
band-aid.

There has been quite a bit of work around speeding up this iteration
loop using clang. The big one I can think of is cling
<http://root.cern.ch/drupal/content/cling>. There is also an IDE (I
think intended for game development) which uses Clang+JIT to
dynamically run and recompile programs (e.g. you can change a constant
in the source which represents a color, and in real time the running
program reflects this change). There is even the relatively
unmaintained examples/clang-interpreter which, while being quite crude
and not feature-complete, is a remarkably short proof of concept.

Is there currently some unacceptable "minimum time" needed to process
C++ with Clang? If so, that sounds like a bug :)

-- Sean Silva




More information about the cfe-dev mailing list