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

Chris Cotter via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 17 17:02:54 PST 2023


ccotter marked an inline comment as done.
ccotter added a comment.

Rebased as well on top of the latest release notes



================
Comment at: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/rvalue-reference-param-not-moved.cpp:45
+template <typename T>
+void never_moves_param_template(Obj&& o, T t) {
+  // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: rvalue reference parameter is never moved from inside the function body [cppcoreguidelines-rvalue-reference-param-not-moved]
----------------
carlosgalvezp wrote:
> Could we add something like this too?
> 
> ```
> template <typename T>
> struct Foo
> {
>   void never_moves(T&& t) {}
> };
> ```
> 
> Here `t` is not a universal reference so the check should warn.
Done in the `AClassTemplate::never_moves` test.


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