cpp header organizer
bflat1 at gmx.net
Tue Jan 11 00:41:08 UTC 2005
I started to do some work on a cpp header includer, that is invoked with a
shortcut or from a menu and starts parsing the current file to find out what
classes and functions are used in the file but are not declared there.
The ultimate goal would be to discriminate between cases where it suffices to
use forward declaration and cases where we need to include the header file.
Furthermore one could try to minimize the number of included files if we knew
what they themselves include transitively (Calculate transitive closure).
I imagine the user interface to ressemble Eclipse's "Organize Imports"
interface for java imports. It shows a dialog in case the import is
First question: Is someone else already working on this?
What I've done so far is create a class and provide an action in the edit menu
in the cppsupportpart. When the action is activated I fetch the translation
unit from the backgroundparser and start traversing it.
To find out if a foward declaration suffices I have to go down to statements
to see if a pointer to a class is dereferenced somewhere. I extended
TreeParser to do this. My problem now is, that the statement lists in the
function ASTs seem to be empty. Is this a bug in my code or does the parser
not provide the information? Is it ok to ask the backgroundparser, or should
I create my own KDevDriver instance?
Use Debian GNU/Linux!
More information about the KDevelop-devel