[libcxx] r263507 - Missed this file in previous checkin

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 14 16:07:58 PDT 2016


Author: marshall
Date: Mon Mar 14 18:07:58 2016
New Revision: 263507

URL: http://llvm.org/viewvc/llvm-project?rev=263507&view=rev
Log:
Missed this file in previous checkin

Modified:
    libcxx/trunk/test/support/nasty_containers.hpp

Modified: libcxx/trunk/test/support/nasty_containers.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/nasty_containers.hpp?rev=263507&r1=263506&r2=263507&view=diff
==============================================================================
--- libcxx/trunk/test/support/nasty_containers.hpp (original)
+++ libcxx/trunk/test/support/nasty_containers.hpp Mon Mar 14 18:07:58 2016
@@ -7,9 +7,10 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef NASTY_VECTOR_H
-#define NASTY_VECTOR_H
+#ifndef NASTY_CONTAINERS_H
+#define NASTY_CONTAINERS_H
 
+#include <cassert>
 #include <vector>
 #include <list>
 
@@ -124,8 +125,8 @@ public:
     void swap(nasty_vector &nv) _NOEXCEPT_(std::__is_nothrow_swappable<nested_container>::value)
     { v_.swap(nv.v_); }
     
-    nasty_vector *operator &()             { return nullptr; }  // nasty
-    const nasty_vector *operator &() const { return nullptr; }  // nasty
+    nasty_vector *operator &()             { assert(false); return nullptr; }  // nasty
+    const nasty_vector *operator &() const { assert(false); return nullptr; }  // nasty
     
     nested_container v_;
 };
@@ -270,8 +271,8 @@ public:
 //         void sort(Compare comp);
 //     void reverse() noexcept;
 
-    nasty_list *operator &()             { return nullptr; }  // nasty
-    const nasty_list *operator &() const { return nullptr; }  // nasty
+    nasty_list *operator &()             { assert(false); return nullptr; }  // nasty
+    const nasty_list *operator &() const { assert(false); return nullptr; }  // nasty
 
     nested_container l_;
 };
@@ -279,4 +280,30 @@ public:
 template <class T>
 bool operator==(const nasty_list<T>& x, const nasty_list<T>& y) { return x.l_ == y.l_; }
 
+// Not really a mutex, but can play one in tests
+class nasty_mutex
+{
+public:
+     nasty_mutex() _NOEXCEPT {}
+     ~nasty_mutex() {}
+
+	nasty_mutex *operator& ()   { assert(false); }
+	template <typename T>
+	void operator, (const T &) { assert(false); }
+
+private:
+    nasty_mutex(const nasty_mutex&)            { assert(false); }
+    nasty_mutex& operator=(const nasty_mutex&) { assert(false); return *this; }
+
+public:
+    void lock()               {}
+    bool try_lock() _NOEXCEPT { return true; }
+    void unlock() _NOEXCEPT   {}
+
+    // Shared ownership
+    void lock_shared()     {}
+    bool try_lock_shared() { return true; }
+    void unlock_shared()   {}
+};
+
 #endif




More information about the cfe-commits mailing list