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

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 24 05:47:54 PST 2023


carlosgalvezp added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/RvalueReferenceParamNotMovedCheck.cpp:13
+
+#include <queue>
+
----------------
Not sure if this is allowed in the repo or if we should use something equivalent from ADT.


================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/RvalueReferenceParamNotMovedCheck.h:14-15
+
+namespace clang {
+namespace tidy {
+namespace cppcoreguidelines {
----------------
Update namespace to C++17


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/rvalue-reference-param-not-moved.cpp:1
+// RUN: %check_clang_tidy -std=c++14-or-later %s cppcoreguidelines-rvalue-reference-param-not-moved %t -- -- -fno-delayed-template-parsing
+
----------------
You specified C++11 in the LangOpts, but test against C++14 or later in the test, maybe change it here to c++11-or-later?


================
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]
----------------
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.


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