[PATCH] D95736: [clang-tidy] Extend 'bugprone-easily-swappable-parameters' with `typedef` and `const &` diagnostics
Whisperity via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 16 10:29:17 PDT 2021
whisperity added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp:706
+ UniqueBindPower({LType, RType})) {
+ // FIXME: Don't emit multiple combinations here either.
+ StringRef DiagText = "a call site binds an expression to '%0' and "
----------------
This is a stale FIXME, the uniqueing of the emission is in the line right above...
================
Comment at: clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp:707-708
+ // FIXME: Don't emit multiple combinations here either.
+ StringRef DiagText = "a call site binds an expression to '%0' and "
+ "'%1' with the same force";
+ diag(M.Second->getOuterLocStart(), DiagText, DiagnosticIDs::Note)
----------------
aaron.ballman wrote:
> I think "with the same force" is going to be hard for users to make sense of. I'm at a bit of a loss for how to word it though. The issue is that `T` and `const T&` parameters *might* be easily swapped, so maybe it's best to call it out that way?
This is a note tag to explain the reason behind the mix. The warning itself has been emitted before. How about
> a `T` and `const T&` parameter accepts all values of `T`
?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95736/new/
https://reviews.llvm.org/D95736
More information about the cfe-commits
mailing list