[PATCH] D141569: [clang-tidy] Implement CppCoreGuideline F.18

Chris Cotter via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 13 07:41:57 PST 2023


ccotter added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/rvalue-reference-param-not-moved.cpp:3-35
+// NOLINTBEGIN
+namespace std {
+template <typename>
+struct remove_reference;
+
+template <typename _Tp>
+struct remove_reference {
----------------
ccotter wrote:
> njames93 wrote:
> > You can just declare these methods and the base struct, no need to do anything fancy in here and put definitions in there
> Ah, I picked a different test to copy/paste from which does define them 😛. Will fix.
Note, I think all but one existing checks end up defining a more thorough definition of remove_reference:

```
 git grep 'struct remove_ref' | sed -r 's/:.*//' | sort | uniq -c | sort -n
   1 modernize/use-transparent-functors.cpp
   2 cppcoreguidelines/rvalue-reference-param-not-moved.cpp
   3 bugprone/Inputs/unchecked-optional-access/absl/types/optional.h
   3 bugprone/forwarding-reference-overload.cpp
   3 misc/throw-by-value-catch-by-reference.cpp
   3 misc/unconventional-assign-operator.cpp
   3 modernize/use-emplace.cpp
   3 performance/for-range-copy.cpp
   3 performance/move-constructor-init.cpp
   4 bugprone/move-forwarding-reference.cpp
   4 bugprone/use-after-move.cpp
   4 performance/move-const-arg-const-ref.cpp
   4 performance/move-const-arg-trivially-copyable.cpp
   4 performance/move-const-arg.cpp
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141569



More information about the cfe-commits mailing list