Re: Generating a parseable #include dependency graph from a project?
Re: Generating a parseable #include dependency graph from a project?
- Subject: Re: Generating a parseable #include dependency graph from a project?
- From: Doug Hill <email@hidden>
- Date: Tue, 16 Mar 2010 15:11:49 -0700
I spent a couple of hours parsing the the preprocessed output from GCC via the -E option or the Preprocess command in Xcode. I was able to create a pretty good dependency tree using this information. Note that this is strictly a tree not a graph. I didn't spend time to determine potential dependencies between sourcefiles. That is, it parses a single .i, .mi, etc.
Here is some sample output:
http://www.breaqz.com/docs/Dependencies_no_pch.txt
The only issue is that when using a precompiled header (Prefix file), the dependencies get messed up because include files aren't listed twice. So, they are only listed when included the first time in the PCH. It will then look like your source file doesn't have direct includes. Nothing I can do about this since it depends on the Preprocessor, not a parser. But after turning off the PCH the tree I generated seemed to have all the correct headers. Even with a PCH, the dependencies will be correct within the PCH.
http://www.breaqz.com/docs/Dependencies_with_pch.txt
Also, I noticed that the Preprocess menu item will ignore the Prefix file setting in the Project and Target settings and always use a PCH. This seems to be a bug. Not hard to get around using #if 0 but it required some extra parsing in my code.
If anyone's interested in what I have, let me know and I can send you something.
Doug Hill
On Mar 15, 2010, at 6:28 PM, Jim Wintermyre wrote:
>> On Fri, 12 Mar 2010 12:01:30 -0800, Jens Alfke <email@hidden> asks
>>
>>> Is there a way to get a textual representation of which files in a project transitively #include which other files? For example, a text file where each line lists a source file path and the the paths of all the headers it depends on.
>>
>> See if ctags <http://ctags.sourceforge.net/> might help you along your path.
>
> Speaking of this, I swear I remember at one point hearing about some setting (I want to say it was an undocumented plist thing) that would cause Xcode to actually create a graphic image file showing the dependency graph for a file when compiling. Anyone know what that setting is? I searched the archives but can't seem to find it.
>
> Jim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden