summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/cpp11-migrate/ReplaceAutoPtr/Inputs/basic.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/test/cpp11-migrate/ReplaceAutoPtr/Inputs/basic.h')
-rw-r--r--clang-tools-extra/test/cpp11-migrate/ReplaceAutoPtr/Inputs/basic.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/clang-tools-extra/test/cpp11-migrate/ReplaceAutoPtr/Inputs/basic.h b/clang-tools-extra/test/cpp11-migrate/ReplaceAutoPtr/Inputs/basic.h
new file mode 100644
index 00000000000..48b0ee4f67c
--- /dev/null
+++ b/clang-tools-extra/test/cpp11-migrate/ReplaceAutoPtr/Inputs/basic.h
@@ -0,0 +1,56 @@
+#ifndef INPUTS_BASIC_H
+#define INPUTS_BASIC_H
+
+#include "memory_stub.h"
+
+// Instrumentation for auto_ptr_ref test
+// @{
+struct Base {};
+struct Derived : Base {};
+std::auto_ptr<Derived> create_derived_ptr();
+// CHECK: std::unique_ptr<Derived> create_derived_ptr();
+// }
+
+// Test function return values (declaration)
+std::auto_ptr<char> f_5();
+// CHECK: std::unique_ptr<char> f_5()
+
+// Test function parameters
+void f_6(std::auto_ptr<int>);
+// CHECK: void f_6(std::unique_ptr<int>);
+void f_7(const std::auto_ptr<int> &);
+// CHECK: void f_7(const std::unique_ptr<int> &);
+
+// Test on record type fields
+struct A {
+ std::auto_ptr<int> field;
+ // CHECK: std::unique_ptr<int> field;
+
+ typedef std::auto_ptr<int> int_ptr_type;
+ // CHECK: typedef std::unique_ptr<int> int_ptr_type;
+};
+
+// Test template WITH instantiation
+template <typename T> struct B {
+ typedef typename std::auto_ptr<T> created_type;
+ // CHECK: typedef typename std::unique_ptr<T> created_type;
+
+ created_type create() { return std::auto_ptr<T>(new T()); }
+ // CHECK: created_type create() { return std::unique_ptr<T>(new T()); }
+};
+
+// Test 'using' in a namespace (declaration)
+namespace ns_1 {
+// Test multiple using declarations
+using std::auto_ptr;
+using std::auto_ptr;
+// CHECK: using std::unique_ptr;
+// CHECK-NEXT: using std::unique_ptr;
+}
+
+namespace ns_2 {
+template <typename T> struct auto_ptr {};
+// CHECK: template <typename T> struct auto_ptr {};
+}
+
+#endif // INPUTS_BASIC_H
OpenPOWER on IntegriCloud