I'm using JetBrains' CLion IDE. I would like to apply the include-what-you-use utility to some C++ code - but not just manually on the command line; rather, I want to go through CLion, and have the results reflected by the IDE somehow. Is that possible? I tried looking for an iwyu plugin for CLion, but no luck.
This feature has been around in CLion for some time (see https://www.jetbrains.com/help/clion/unused-include-directive.html). However, it was apparently not enabled by default in some releases, and may still not be. I believe support for IWYU pragmas was only added in a 2024 CLion release.
Go to Settings > Editor > Inspections > C/C++ > Potential Code Quality Issues
and check the Possibly unused #include directive box. Also make sure that you are using CLion Nova (ReSharper C++ language engine) in Settings > Advanced Settings > CLion.
I'm using CLion 2025.1.3 on macOS 15.5 (Sequoia) and it's working beautifully for me.