[PATCH] D75041: [clang-tidy] Approximate implicit conversion issues in 'experimental-cppcoreguidelines-avoid-adjacent-parameters-of-the-same-type'

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 8 06:48:34 PST 2021


whisperity updated this revision to Diff 315384.
whisperity added a comment.
Herald added a subscriber: shchenz.

**Ignore one-way implicit conversions**

One-way implicit conversions introduce too much noise, and except in very odd circumstances, do not provide a meaningful result.

The stalwart example

  void f(const Base& bp, const Derived& dp)

contains just one conversion, `dp -> bp`, which, if called in a swapped way, will 99.9...% of the cases will result in a compile error (*)

  Base b;
  Derived d;
  f(d, b);

Thus, there is no reason to model this, at all.

(*): Unless an `operator Derived()` exists in `Base`.


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

https://reviews.llvm.org/D75041

Files:
  clang-tools-extra/clang-tidy/experimental/CppcoreguidelinesAvoidAdjacentParametersOfTheSameTypeCheck.cpp
  clang-tools-extra/clang-tidy/experimental/CppcoreguidelinesAvoidAdjacentParametersOfTheSameTypeCheck.h
  clang-tools-extra/docs/clang-tidy/checks/experimental-cppcoreguidelines-avoid-adjacent-parameters-of-the-same-type.rst
  clang-tools-extra/test/clang-tidy/checkers/experimental-cppcoreguidelines-avoid-adjacent-parameters-of-the-same-type-cvr-on.cpp
  clang-tools-extra/test/clang-tidy/checkers/experimental-cppcoreguidelines-avoid-adjacent-parameters-of-the-same-type-implicits.c
  clang-tools-extra/test/clang-tidy/checkers/experimental-cppcoreguidelines-avoid-adjacent-parameters-of-the-same-type-implicits.cpp
  clang-tools-extra/test/clang-tidy/checkers/experimental-cppcoreguidelines-avoid-adjacent-parameters-of-the-same-type-minlen3.cpp
  clang-tools-extra/test/clang-tidy/checkers/experimental-cppcoreguidelines-avoid-adjacent-parameters-of-the-same-type.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75041.315384.patch
Type: text/x-patch
Size: 73597 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210108/3477b0d7/attachment-0001.bin>


More information about the cfe-commits mailing list