Comment #1 on pull request 953 by salman-javed-nz: Add `--force_comments` option to make IWYU always print the 'why' #in…
https://github.com/include-what-you-use/include-what-you-use/pull/953
Here is my first pass at implementing a `--force-comments` feature.
The reason for implementing this is because IWYU does not update the `// for xyz` include comments if there are no contentful changes (e.g. a #include being added or removed).
As the code changes, the reason stated in the comment for including a header may no longer be true.
For a while I have been deliberately adding "dummy" #includes to coax IWYU into removing them and printing an up-to-date list of include comments. While this workaround has worked fine for me, it's probably better if IWYU just had the proper support for it. So this pull request is how I see what that proper support would look like.
I would love to get feedback from others on what they would like from such a feature, and if there is another way to implement this that fits better with IWYU's established ways of doing things.