[cfe-commits] [PATCH] Enabling externals tools to diffentiate quoted/angled/system dirs
Paul at mediamolecule.com
Mon May 23 14:05:16 PDT 2011
A while back I submitted a patch, applied in r127122, to expose HeaderSearch::SearchDirs for use by external tools.
Include-what-you-use (http://code.google.com/p/include-what-you-use/) now makes use of this to help it figure out whether a given include file is a 'system' or 'user' include.
I believed that HeaderSearch::SystemDirIdx would allow us to differentiate between search dirs specified with -I and with -system, but it seems that it's slightly inaccurately named. I'd assumed that it delimited the boundary between IncludeDirGroup::Angled and IncludeDirGroup::System, but it actually delimits the boundary between IncludeDirGroup::Quoted and IncludeDirGroup::Angled.
This means that HeaderSearch::system_dir_begin()/end() actually enumerates directories specified with -I. Include-what-you-use has no way of distinguishing these dirs from those specified with -isystem. There are more details here: http://code.google.com/p/include-what-you-use/issues/detail?id=16#c24
The attached patch resolves that problem, and exposes HeaderSearch::quoted_dir_begin()/end() and HeaderSearch::angled_dir_begin()/end().
A couple of notes about the patch (I'm not sure if any of these are contentious):
* I've changed the meaning of SystemDirIdx to delimit Angled/System dirs. AngleDirIdx now does this job. I think this is clearer.
* system_dir_begin()/end() now returns different results. I suspect IWYU is the only tool using this however.
* InitHeaderSearch::Realize() now performs an additional call to RemoveDuplicates(). I shouldn't think this is a performance issue however.
Any feedback greatly appreciated.
Please consider the environment before printing this email :-)
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender immediately then delete this email. Any views expressed in this email are solely that of the individual and not representative of the company as a whole.
Media Molecule Limited
Company Reg No 5665849
Registered in England.
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3918 bytes
More information about the cfe-commits