[PATCH] D75041: [clang-tidy] Extend 'bugprone-easily-swappable-parameters' with mixability because of implicit conversions

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 3 05:31:08 PST 2021


whisperity updated this revision to Diff 327743.
whisperity retitled this revision from "[clang-tidy] Approximate implicit conversion issues in 'experimental-cppcoreguidelines-avoid-adjacent-parameters-of-the-same-type'" to "[clang-tidy] Extend 'bugprone-easily-swappable-parameters' with mixability because of implicit conversions".
whisperity edited the summary of this revision.
whisperity added reviewers: hokein, alexfh, njames93.
whisperity set the repository for this revision to rG LLVM Github Monorepo.
whisperity added a comment.

- Rebased over updated, rewritten, newer base patch version, vastly increased the quality of the code.
- Tidied the tests and made them more self-explanatory.
- Implemented handling //function pointer conversion// (implicit losing of `noexcept`). This was missing from the previous uploaded patch.
- Ensured that implicit conversion sequences are diagnosed properly, even when typedefs are involved. This means that if the conversion takes 4-5-6 logical steps (e.g. instead of //`SomeFancyIntTypedef` -> `DoubleBoxingType`//, emit //`SomeFancyIntTypedef` -> `int` -> `double` -> `const double` -> `DoubleBoxingType` (user defined ctor)//) it's all explained properly.
- Respect the user's decision about the mixability of `T` and `const T` (the previous patch D96355 <https://reviews.llvm.org/D96355>) even in the context of implicit conversions (i.e. if the user did not allow that, do not consider a user-defined type which constructor takes a const mixable with a non-const other parameter).
- Put a diagnostic note to the location of the `FuntionDecl` of the conversion method involved in the mixability.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75041/new/

https://reviews.llvm.org/D75041

Files:
  clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.h
  clang-tools-extra/docs/clang-tidy/checks/bugprone-easily-swappable-parameters.rst
  clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-ignore.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-implicit-qualifiers.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-implicits.c
  clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-implicits.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-len2.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-len3.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters-qualifiermixing.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone-easily-swappable-parameters.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75041.327743.patch
Type: text/x-patch
Size: 90012 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210303/816104ad/attachment-0001.bin>


More information about the cfe-commits mailing list