cpp header organizer

Jens Dagerbo jens.dagerbo at swipnet.se
Thu Jan 6 21:04:06 UTC 2005


Well.. I guess someone should answer, but I'm afraid I can't offer much 

On Sunday 02 January 2005 17.24, Felix Berger wrote:
> Hi,
> 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
> ambiguous.
> First question: Is someone else already working on this?

Sounds like an interesting thing to have, and no, as far as I know no one is 
working on it.

> 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?

Here's where it gets tricky. The only one who truly understands the parser 
code is Roberto, the guy who wrote it, and he isn't around much these days. 
Unless someone else knows I think the code is your only option to figure out 
the answer..


More information about the KDevelop-devel mailing list