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 b
"README" in header
: continue
15 if header
== b
"version.hrc": continue
17 if header
.startswith(b
"IwyuFilter_include.yaml"): continue
18 if header
.startswith(b
"cppu/"): continue
19 if header
.startswith(b
"cppuhelper/"): continue
20 if header
.startswith(b
"osl/"): continue
21 if header
.startswith(b
"sal/"): continue
22 if header
.startswith(b
"salhelper/"): continue
23 if header
.startswith(b
"uno/"): continue
24 # these are direct copies of mozilla code
25 if header
.startswith(b
"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(b
"#include <")
34 idx2
= line
.find(b
">", idx1
+ 10)
35 include
= line
[idx1
+ 10 : idx2
]
36 headerSetUnused
.discard(include
)
38 idx1
= line
.find(b
"/")
39 includedFromModule
= line
[0 : idx1
]
40 idx1
= include
.find(b
"/")
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
):