Index: tools/clang/move_raw/tests/test-expected.cc |
diff --git a/tools/clang/move_raw/tests/test-expected.cc b/tools/clang/move_raw/tests/test-expected.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1432d33a91f16ee6a3bf5cea44a736df046e6c19 |
--- /dev/null |
+++ b/tools/clang/move_raw/tests/test-expected.cc |
@@ -0,0 +1,40 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+namespace std { |
+ |
+// This is the move that should be flagged. Representes the unary std::move. |
+template <typename T> |
+T move(T t) { |
+ return t; |
+} |
+ |
+// This represents the algorithm std::move, it should not be flagged. |
+template <class InputIt, class OutputIt> |
+OutputIt move(InputIt first, InputIt last, OutputIt d_first) { |
+ return d_first; |
+} |
+ |
+} // namespace std |
+ |
+// This represents some non-std move. It should not be flagged. |
+template <typename T> |
+T move(T t) { |
+ return t; |
+} |
+ |
+void Test() { |
+ int x = 3; |
+ |
+ // Should not be flagged: x is not a pointer. |
+ int y = std::move(x); |
+ |
+ int* p = &x; |
+ |
+ // Calling std::move on a raw pointer should be flagged. |
+ int* q = /*This tries to move a raw pointer!*/ std::move(p); |
+ |
+ // Calling non-std move should not be flagged. |
+ q = move(p); |
+} |