Expose ValueMap's mutex type as a typedef instead of a sys::Mutex.
[oota-llvm.git] / unittests / IR / ValueMapTest.cpp
index 3427c913328952218a25deb2995b763a55f849e5..d480865805c1346d9ff08ad84bf7265d0543e8d5 100644 (file)
@@ -177,10 +177,10 @@ TYPED_TEST(ValueMapTest, ConfiguredCollisionBehavior) {
   // TODO: Implement this when someone needs it.
 }
 
-template<typename KeyT>
-struct LockMutex : ValueMapConfig<KeyT> {
+template<typename KeyT, typename MutexT>
+struct LockMutex : ValueMapConfig<KeyT, MutexT> {
   struct ExtraData {
-    sys::Mutex *M;
+    mutex_type *M;
     bool *CalledRAUW;
     bool *CalledDeleted;
   };
@@ -192,15 +192,15 @@ struct LockMutex : ValueMapConfig<KeyT> {
     *Data.CalledDeleted = true;
     EXPECT_FALSE(Data.M->tryacquire()) << "Mutex should already be locked.";
   }
-  static sys::Mutex *getMutex(const ExtraData &Data) { return Data.M; }
+  static mutex_type *getMutex(const ExtraData &Data) { return Data.M; }
 };
 #if LLVM_ENABLE_THREADS
 TYPED_TEST(ValueMapTest, LocksMutex) {
   sys::Mutex M(false);  // Not recursive.
   bool CalledRAUW = false, CalledDeleted = false;
-  typename LockMutex<TypeParam*>::ExtraData Data =
-    {&M, &CalledRAUW, &CalledDeleted};
-  ValueMap<TypeParam*, int, LockMutex<TypeParam*> > VM(Data);
+  typedef LockMutex<TypeParam*, sys::Mutex> ConfigType;
+  typename ConfigType::ExtraData Data = {&M, &CalledRAUW, &CalledDeleted};
+  ValueMap<TypeParam*, int, ConfigType> VM(Data);
   VM[this->BitcastV.get()] = 7;
   this->BitcastV->replaceAllUsesWith(this->AddV.get());
   this->AddV.reset();