aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/IR/ValueMapTest.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2014-06-17 00:17:38 +0000
committerZachary Turner <zturner@google.com>2014-06-17 00:17:38 +0000
commit814a49385ce96ec18eb3b2f3f6be5e96cd71cca8 (patch)
tree866c423a146e0948ca04013b80b2f83c008b8a4e /llvm/unittests/IR/ValueMapTest.cpp
parent852c346ad24334f6e65b57331cb43f651219d5d8 (diff)
downloadllvm-814a49385ce96ec18eb3b2f3f6be5e96cd71cca8.zip
llvm-814a49385ce96ec18eb3b2f3f6be5e96cd71cca8.tar.gz
llvm-814a49385ce96ec18eb3b2f3f6be5e96cd71cca8.tar.bz2
Expose ValueMap's mutex type as a typedef instead of a sys::Mutex.
This enables static polymorphism of the mutex type, which is necessary in order to replace the standard mutex implementation with a different type. llvm-svn: 211080
Diffstat (limited to 'llvm/unittests/IR/ValueMapTest.cpp')
-rw-r--r--llvm/unittests/IR/ValueMapTest.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/unittests/IR/ValueMapTest.cpp b/llvm/unittests/IR/ValueMapTest.cpp
index 3427c91..d480865 100644
--- a/llvm/unittests/IR/ValueMapTest.cpp
+++ b/llvm/unittests/IR/ValueMapTest.cpp
@@ -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();