Visual Studio IntelliSense for VC++ includes the "complete" EDG C++ parser (also used by Intel and others). Since the C# Code DOM is accessible to addons (correct me if I'm wrong), is the C++ Code DOM also accessible? Can this be used to analyse an open VC++ project within the VS environment?
The Visual C++ Refactoring extension is able to rename a member project-wide. Its built by MS but obviously they used the internal Code DOM to achieve this. So it is possible, I just don't know how, yet.
The CppLister extension is able to read the intellisense databases created by VS to list the various members within a class.
You can always use the open source Clang C++ parser (actually compiler) and read the AST into a C# Object Model. See CppSharp and ClangSharp for C# bindings to Clang.
I'm not sure what the "C++ Code DOM" is, if it even exists. What matters is that MSVS is using the EDG front end to parse and determine meaning of symbols, to support MSVS IDE actions. EDG IIRC builds its own internal data structures representing the program; I have no reason to believe that those data structures are the "C++ Code DOM", or that they are visible to you or you'd be able to find out about them at MSDN.
Your real stated problem is you want to analyze C++ source code. I agree, having the EDG front end information would be a significant aid to do that; you really really don't want to attempt to write your own C++ parser (and you need lots of stuff past parsing, google my essay on "life after parsing").
So you kind of have the following choices:
- Find a door into the EDG machinery in MSVS. Since you haven't had a lot of luck and there appears to be nothing documented from MS saying this is available, you probably won't have a lot of luck this way. If I were in MS's shoes, I wouldn't make it public; it would just be another support headache, and on a piece of software that isn't even theirs.
- Use the commercial EDG front end, directly from EDG. My understanding is they offer individual use licenses at no charge. (My understanding may be wrong). This way you skip any restrictions that MS may have on access... at the price of having to configure the EDG front end yourself. A downside: EDG wants to be the front end of a compiler, not the front end of an analyzer. That distinction may seem subtle but it will probably bite you. For instance, I suspect EDG throws away comments; compiler front ends don't need them. If you want to inspect comments in your analyzer, this might be a real problem.
- Use Clang. This is an open source C++ parser, designed to use for a wide variety of program analysis purposes as well as for front ending a C++ compiler. I have no experience with this, but it seems pretty well thought out, and appears to offer lots of facilities. I don't know if it has specific support for the MS dialect of C++.
- Use another commercial front end, our (DMS) C++ Front End. Being the architect of this, I'm pretty sure it is well thought out (including support for MS Visual C++); there is specific experience with using this to carry out complex C++ analysis and transformation tasks. Unlike EDG, it is designed to support analysis, transformation and generation (e.g., it captures comments and even the radix of literals so they can be regenerated correctly). The foundation, DMS, has lots of machinery built in to support custom analysis: AST and symbol table construction, attribute grammars, data flow frameworks, intraprocedural control and data flow analysis at the AST level, BDD management, source pattern matches, source-to-source transformations. Clang and EDG offers AST and symbol table construction; Clang (but I don't think EDG) has it has flow analysis (at the LLVM level), but not flow analysis at the AST level (AFAIK). Neither Clang nor EDG offer the source pattern/transformation capability, so which is better depends on your long term tasks. Compared to the other options, our C++ front end isn't open source or free; one can get research licenses.