What you did not indicate is what โanalyzesโ you wanted to do. Most C ++ analyzes require that you have exact character table data, so when you come across a foo character, you have an idea of โโwhat it is. (Technically, you donโt even know that + without such a character table!) You also need general type information; if you have the expression "a * b", what is the type of result? Having "name and type" information is the key to almost everything you want to do for analysis.
If you insist on clang, then there are other answers. I do not know that it provides name and type resolution.
If you need name and type resolution, then another solution would be the DMS Software Reengineering Toolkit . DMS provides a universal compiler, such as an infrastructure for parsing, analyzing, converting, and parsing (regenerating source code from compiler data structures). DMS Industrial-strength C ++ front end (also has many other interfaces) provides the full name and type resolution in accordance with the ANSI standard, as well as the GCC and MS VC ++ dialogs.
Code conversions can be implemented through the abstract syntax tree interface provided by DMS, or by program control rules controlled by patterns written in the surface syntax of your target language (in this case, C ++). Here's a simple conversion using the rule language:
domain Cpp~GCC3; -- says we want patterns for C++ in the GCC3 dialect rule optimize_to_increment(lhs:left_hand_side):expression -> expression " \lhs = \lhs + 1 " -> " \lhs++" if no_side_effects(lhs).
This implicitly affects ASTs built by DMS to modify them. The conditional allows you to learn about arbitrary properties of template variables (in this case, lhs), including name and type restrictions, if you wish.
DMS has been used many times for very complex program analysis and C ++ code conversion. We are creating C ++ testing tools using the C ++ code toolkit in a fairly obvious way using DMS. The website has a documentary library describing how DMS was used to restructure the architecture of a large line of military aircraft software. This type of activity literally pours C ++ into one architectural form in another, using a large number of patterns of directional transformations, such as above.
Most likely, it will be very easy for you to implement your toolkit. And you do not have to wait until it ripens.