3 # Look for headers inside include/ that can be moved into their respective modules.
9 a
= subprocess
.Popen("git ls-files include/", stdout
=subprocess
.PIPE
, shell
=True)
12 header
= line
[8:].strip()
13 if b
"README" in header
: continue
14 if header
== b
"version.hrc": continue
16 if header
.startswith(b
"IwyuFilter_include.yaml"): continue
17 if header
.startswith(b
"cppu/"): continue
18 if header
.startswith(b
"cppuhelper/"): continue
19 if header
.startswith(b
"osl/"): continue
20 if header
.startswith(b
"sal/"): continue
21 if header
.startswith(b
"salhelper/"): continue
22 if header
.startswith(b
"uno/"): continue
25 headerSetUnused
= headerSet
.copy()
26 headerSetOnlyInOwnModule
= headerSet
.copy()
27 a
= subprocess
.Popen("git grep '^#include <'", stdout
=subprocess
.PIPE
, shell
=True)
30 idx1
= line
.find(b
"#include <")
31 idx2
= line
.find(b
">", idx1
+ 10)
32 include
= line
[idx1
+ 10 : idx2
]
33 headerSetUnused
.discard(include
)
35 idx1
= line
.find(b
"/")
36 includedFromModule
= line
[0 : idx1
]
37 idx1
= include
.find(b
"/")
38 module
= include
[0 : idx1
]
39 if module
!= includedFromModule
:
40 headerSetOnlyInOwnModule
.discard(include
)
42 print("completely unused")
43 print("----------------------------")
44 for x
in sorted(headerSetUnused
):
47 print("only used in own module")
48 print("----------------------------")
49 for x
in sorted(headerSetOnlyInOwnModule
):