On 01/24/2013 08:55 PM, Diego Novillo wrote:

I do see, however, a few areas where Clang/LLVM have gone that I do
not think GCC is currently thinking of entering: "toolability" (for
the lack of a better term).  Clang's design follows a different path
than g++.  It's not just a code generating parser, it is a pure parser
that also generates code.  The difference makes it suitable for any
kind of tool that needs to understand C++: static analyzers, code
re-formatters, syntax highlighters, and other similar tools.
Additionally, it is designed as a library, so it can be embedded into
applications.

I'm not quite sure that this clean split is possible, even after making amends for template instantiation. It's great for syntax-driven tools, but once you move beyond that, you tend to ignore stuff like destructors (or the cleanup attribute), life-times of temporaries etc., things which are just not visible in an AST. You have to reimplement many program analysis algorithms typically part of compiler optimizers, after lowering the AST to a less elaborate intermediate representation (a step which requires a fair amount of knowledge about the language in question).

--
Florian Weimer / Red Hat Product Security Team

Reply via email to