include-tidy Tool Tackles Complex Include-What-You-Use Rules for C++
A developer has shared findings from extending include-tidy, a tool that enforces the include-what-you-use (IWYU) principle, to C++ codebases after previously testing it mainly on C code. The work was prompted by a bug report for SWISH++, a decade-old C++ project, which revealed several dozen IWYU violations upon analysis. Unlike C, C++ features such as nested types, inheritance, and operator overloading create legitimate exceptions to strict IWYU enforcement that naive rule application fails to handle correctly. For instance, a derived class source file that transitively includes a base class header through its own header should not be required to explicitly include the base header again. These findings highlight that codifying intuitive C++ include practices into automated tooling is significantly more complex than it first appears.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in