I'm looking for a way to parse c++ code to retrieve some basic information about classes. I don't actually need much information from the code itself, but I do need it to handle things like macros and templates. In short, I want to extract the "structure" of the code, what you would show in a UML diagram.
For each class/struct/union/enum/typedef in the code base, all I need (after templates & macros have been handled) is:
The actual instructions in the code are irrelevant for my purposes.
I'm anticipating a lot of people saying I should just use a regex for this (or even Flex & Bison), but these aren't really valid, as I do need the preprocessor and template stuff handled properly.
Sounds like a job for gcc-xml in combination with the c++ xml-library or xml-friendly scripting language of your choice.
See also Ira Baxter here, where he cites his own product.
Warning: mind you, only Elsa "..I hear does a fairly good job.." at constructing a symbol table, which according to Ira Baxter is necessary for OP's original intent (see comments to this answer - I quote him because he is an expert in the field).
Running Doxygen on the code would give you most of that, wouldn't it?
In what format do you want the output?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With