4picht / include-what-you-use

Automatically exported from code.google.com/p/include-what-you-use
Other
0 stars 0 forks source link

Use information gathered by iwyu in fix_includes.py to determine whether headers are project headers #184

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Projects like boost have a single top-level directory; projects without a 
structure like that may be pulling headers from multiple sub-projects related 
to the overall project.

fix_includes.py allows for a single top-level directory to be specified.  
Quoted headers are [almost?] always assumed to be project headers, but there's 
no facility available to specify more than one.

Changes I would like to see:

* iwyu use -isystem / -I flags to determine whether it's considered a project 
header or not
* have iwyu further distinguish by whether it's a system, 3rd party, or project 
header (eg., if it's specified with -isystem on the command-line and -nostdinc 
is *not* in effect: anything found in default system/compiler search paths is 
system, anything with -isystem is 3rdparty, anything with -I is project)
* alter fix_includes.py's --separate_project_includes to take a list of 
directories
* add an option to iwyu and/or fix_includes.py to automatically prefix project 
headers with a partially qualified path.  This could be used to migrate to a 
more boost-like header directory structure.  For example, supposing 
someHeader.h were found through -I${project_dir}/src/Project/lib:
-#include <someHeader.h>
+#include <src/Project/lib/someHeader.h>

What version of the product are you using? On what operating system?

version: iwyu v 0.3, built against clang/llvm 3.5.1
OS: rhel 6 x86_64

Original issue reported on code.google.com by Phant...@gmail.com on 15 Apr 2015 at 7:28

GoogleCodeExporter commented 9 years ago
To clarify: the main problem I ran into is it currently cannot distinguish 
between project headers and system or 3rd party headers.  I want to keep the 
inclusion order to:

system
3rd party
overall project
sub-project

... but there's currently no facility in these tools to distinguish, unless 
you're using a boost-like hierarchy or they happen to be in the same directory 
as the source being compiled.

Original comment by Phant...@gmail.com on 15 Apr 2015 at 7:35