This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Fixed misc-unused-parameters omitting parameters square brackets
ClosedPublic

Authored by PriMee on Sep 14 2017, 1:48 AM.

Details

Summary

Bug: https://bugs.llvm.org/show_bug.cgi?id=34449

Problem:

Clang-tidy check misc-unused-parameters comments out parameter name omitting following characters (e.g. square brackets) what results in its complete removal. Compilation errors might occur after clang-tidy fix as well.

Patch description:

Changed removal range. The range should end after parameter name, not after whole parameter declarator (which might be followed by e.g. square brackets).

Diff Detail

Event Timeline

PriMee created this revision.Sep 14 2017, 1:48 AM

It turned out that removal range has to be even shorter than in https://reviews.llvm.org/D37566

alexfh edited edge metadata.Sep 14 2017, 5:03 AM

Once we got that far, could you also ensure this works for function pointer arguments (e.g. void f(void (*fn)()) {})?

alexfh added inline comments.Sep 14 2017, 5:11 AM
clang-tidy/misc/UnusedParametersCheck.cpp
141

BTW, can we just remove a single token representing the parameter name? E.g. SourceRange RemovalRange(Param->getLocation());.

Diff will be updated as soon as possible.

clang-tidy/misc/UnusedParametersCheck.cpp
141

Yes, you're right :)

alexfh accepted this revision.Sep 15 2017, 4:11 AM

LG. I'll commit the patch for you.

This revision is now accepted and ready to land.Sep 15 2017, 4:11 AM
This revision was automatically updated to reflect the committed changes.