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
:
15 if header
== b
"version.hrc":
18 if header
.startswith(b
"IwyuFilter_include.yaml"):
20 if header
.startswith(b
"cppu/"):
22 if header
.startswith(b
"cppuhelper/"):
24 if header
.startswith(b
"osl/"):
26 if header
.startswith(b
"sal/"):
28 if header
.startswith(b
"salhelper/"):
30 if header
.startswith(b
"uno/"):
34 headerSetUnused
= headerSet
.copy()
35 headerSetOnlyInOwnModule
= headerSet
.copy()
36 a
= subprocess
.Popen("git grep '^#include <'", stdout
=subprocess
.PIPE
, shell
=True)
39 idx1
= line
.find(b
"#include <")
40 idx2
= line
.find(b
">", idx1
+ 10)
41 include
= line
[idx1
+ 10 : idx2
]
42 headerSetUnused
.discard(include
)
44 idx1
= line
.find(b
"/")
45 includedFromModule
= line
[0 : idx1
]
46 idx1
= include
.find(b
"/")
47 module
= include
[0 : idx1
]
48 if module
!= includedFromModule
:
49 headerSetOnlyInOwnModule
.discard(include
)
51 print("completely unused")
52 print("----------------------------")
53 for x
in sorted(headerSetUnused
):
56 print("only used in own module")
57 print("----------------------------")
58 for x
in sorted(headerSetOnlyInOwnModule
):