Pull request 953 in include-what-you-use: Add `--force comments` option to make IWYU always print the 'why' #in…

1 view
Skip to first unread message

notifi...@include-what-you-use.org

unread,
Sep 25, 2021, 4:55:10 AM9/25/21
to include-wh...@googlegroups.com
New 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

…clude comments, regardless of whether any include lines need to be added or removed.

Fixes #75 and #494.

With this change, IWYU will update the "// for xyz" comments as the code changes, preventing the comments from becoming stale.


notifi...@include-what-you-use.org

unread,
Sep 25, 2021, 4:58:19 AM9/25/21
to include-wh...@googlegroups.com
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.


notifi...@include-what-you-use.org

unread,
Sep 25, 2021, 9:19:36 AM9/25/21
to include-wh...@googlegroups.com
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 over time, the reason stated in the comment for including a header may no longer be true.

notifi...@include-what-you-use.org

unread,
Sep 25, 2021, 1:06:02 PM9/25/21
to include-wh...@googlegroups.com
Comment #1 on pull request 953 by kimgr: 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

Very nice, thanks! I'll try to take some time tomorrow to work through the diff in detail, but on first pass it looks great.


Reply all
Reply to author
Forward
0 new messages