Open Bug 1682477 Opened 2 years ago Updated 9 days ago

[meta] Identify include directives that are rendered unused by a patch


(Developer Infrastructure :: Source Code Analysis, task, P4)


(Not tracked)


(Reporter: sg, Unassigned)



(Keywords: meta)

It would be helpful if the reviewbot showed a warning when a patch renders an include directive unused in a modified file. Identifying such include directives could be done based on include-what-you-use. Due to the nature of include-what-you-use, this will definitely produce false negatives in the current state. But that wouldn't be a blocker for reducing the number of unnecessary include directives to some degree. However, false negatives would need to be ruled out almost entirely in order not to make this check an annoyance to developers. This will probably require some work in adding annotating include-what-you-use pragmas to the code base, and adding some postprocessing.

Summary: [meta] Identify → [meta] Identify include directives that are rendered unused by a patch
See Also: → 1677549, 1676346
See Also: → 1651951
See Also: → iwyu
Severity: -- → S4
Priority: -- → P4

Note that clangd now (I think as of version 14) warns about unused includes, and there is a proposal to lift the functionality that enables this warning (called "include cleaner", in the future intended to also suggest missing headers) out of clangd and into a reusable library within LLVM; that might come in handy.

Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.