We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8963056 commit 55c4d16Copy full SHA for 55c4d16
clang-tools-extra/test/clang-tidy/checkers/performance/lost-std-move-nonstrict.cpp
@@ -0,0 +1,30 @@
1
+// RUN: %check_clang_tidy %s performance-lost-std-move %t -- -config='{CheckOptions: {performance-lost-std-move.StrictMode: false}}'
2
+
3
+namespace std {
4
5
+template<typename T>
6
+class shared_ptr {
7
+public:
8
+ T& operator*() { return reinterpret_cast<T&>(*this); }
9
+ shared_ptr() {}
10
+ shared_ptr(const shared_ptr<T>&) {}
11
+};
12
13
14
+T&& move(T&)
15
+{
16
+}
17
18
+} // namespace std
19
20
+int f(std::shared_ptr<int>);
21
22
+void f_copy_after_ref()
23
24
+ std::shared_ptr<int> ptr;
25
+ auto& ref = ptr;
26
+ f(ptr);
27
+ // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: could be std::move() [performance-lost-std-move]
28
+ // CHECK-FIXES: f(std::move(ptr));
29
+ *ref = 1;
30
0 commit comments