3 # Look for headers inside include/ that can be moved into their respective modules.
10 a
= subprocess
.Popen("git ls-files include/", stdout
=subprocess
.PIPE
, shell
=True)
13 header
= line
[8:].strip();
14 if "README" in header
: continue
15 if header
== "version.hrc": continue
17 if header
.startswith("IwyuFilter_include.yaml"): continue
18 if header
.startswith("cppu/"): continue
19 if header
.startswith("cppuhelper/"): continue
20 if header
.startswith("osl/"): continue
21 if header
.startswith("sal/"): continue
22 if header
.startswith("salhelper/"): continue
23 if header
.startswith("uno/"): continue
24 # these are direct copies of mozilla code
25 if header
.startswith("onlineupdate/mozilla/"): continue
28 headerSetUnused
= headerSet
.copy()
29 headerSetOnlyInOwnModule
= headerSet
.copy()
30 a
= subprocess
.Popen("git grep '^#include <'", stdout
=subprocess
.PIPE
, shell
=True)
33 idx1
= line
.find("#include <")
34 idx2
= line
.find(">", idx1
+ 10)
35 include
= line
[idx1
+ 10 : idx2
]
36 headerSetUnused
.discard(include
)
39 includedFromModule
= line
[0 : idx1
]
40 idx1
= include
.find("/")
41 module
= include
[0 : idx1
]
42 if module
!= includedFromModule
:
43 headerSetOnlyInOwnModule
.discard(include
)
45 print "completely unused"
46 print "----------------------------"
47 for x
in sorted(headerSetUnused
):
50 print "only used in own module"
51 print "----------------------------"
52 for x
in sorted(headerSetOnlyInOwnModule
):