[PATCH] Inject unique_ptr/shared_ptr into the test instead of using <memory>

Samuel Benzaquen sbenza at google.com
Wed Apr 9 09:54:09 PDT 2014


Hi klimek,

Inject unique_ptr/shared_ptr into the test instead of using <memory>
Libraries might not be present on tests.

http://reviews.llvm.org/D3330

Files:
  test/clang-tidy/redundant-smartptr-get-fix.cpp
  test/clang-tidy/redundant-smartptr-get.cpp

Index: test/clang-tidy/redundant-smartptr-get-fix.cpp
===================================================================
--- test/clang-tidy/redundant-smartptr-get-fix.cpp
+++ test/clang-tidy/redundant-smartptr-get-fix.cpp
@@ -1,6 +1,22 @@
 // RUN: $(dirname %s)/check_clang_tidy_fix.sh %s misc-redundant-smartptr-get %t
 
-#include <memory>
+namespace std {
+
+template <typename T>
+class unique_ptr {
+  T& operator*() const;
+  T* operator->() const;
+  T* get() const;
+};
+
+template <typename T>
+class shared_ptr {
+  T& operator*() const;
+  T* operator->() const;
+  T* get() const;
+};
+
+}  // namespace std
 
 struct Bar {
   void Do();
Index: test/clang-tidy/redundant-smartptr-get.cpp
===================================================================
--- test/clang-tidy/redundant-smartptr-get.cpp
+++ test/clang-tidy/redundant-smartptr-get.cpp
@@ -2,7 +2,23 @@
 
 // CHECK-NOT: warning
 
-#include <memory>
+namespace std {
+
+template <typename T>
+class unique_ptr {
+  T& operator*() const;
+  T* operator->() const;
+  T* get() const;
+};
+
+template <typename T>
+class shared_ptr {
+  T& operator*() const;
+  T* operator->() const;
+  T* get() const;
+};
+
+}  // namespace std
 
 struct int_ptr {
   int* get();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3330.1.patch
Type: text/x-patch
Size: 1239 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140409/b4ced9ff/attachment.bin>


More information about the cfe-commits mailing list