This is an archive of the discontinued LLVM Phabricator instance.

Add a misc-unused-parameters.CommentOutUnusedParameters to clang-tidy
AcceptedPublic

Authored by mehdi_amini on Jan 1 2022, 4:59 PM.

Details

Reviewers
rriddle
jpienaar
Summary

This option allows to eliminate parameter names instead of commenting
them out.

Diff Detail

Event Timeline

mehdi_amini created this revision.Jan 1 2022, 4:59 PM
mehdi_amini requested review of this revision.Jan 1 2022, 4:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 1 2022, 4:59 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jpienaar added inline comments.Jan 2 2022, 4:16 PM
clang-tools-extra/docs/clang-tidy/checks/misc-unused-parameters.rst
25

OOC why the extra space after the type?

mehdi_amini added inline comments.Jan 2 2022, 4:42 PM
clang-tools-extra/docs/clang-tidy/checks/misc-unused-parameters.rst
25

The space is in the original code, the fix only touches the name (clang-format is expected to fix it afterward)

Mogball added inline comments.Jan 3 2022, 8:18 AM
clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp
157

Oh I was thinking that the option would disable editing the parameter at all. I.e. it would leave unused parameters untouched or remove the parameter from the function signature altogether (if it can).

jpienaar accepted this revision.Jan 4 2022, 8:01 AM

Looks reasonable as an option/this is another way to make it explicit that param is unused.

clang-tools-extra/docs/clang-tidy/checks/misc-unused-parameters.rst
48

Could we flip this? ElideUnusedParameterNames with default value false: eliding drops local information and I'd rather that be explicit in the name. CommentOut is still the default with the current naming, but it feels more optional for some reason to me. WDYT?

This revision is now accepted and ready to land.Jan 4 2022, 8:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2022, 3:33 PM