Mercurial > hg > CbC > CbC_llvm
comparison unittests/IR/ValueMapTest.cpp @ 148:63bd29f05246
merged
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 14 Aug 2019 19:46:37 +0900 |
parents | c2174574ed3a |
children |
comparison
equal
deleted
inserted
replaced
146:3fc4d5c3e21e | 148:63bd29f05246 |
---|---|
1 //===- llvm/unittest/ADT/ValueMapTest.cpp - ValueMap unit tests -*- C++ -*-===// | 1 //===- llvm/unittest/ADT/ValueMapTest.cpp - ValueMap unit tests -*- C++ -*-===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 // | 4 // See https://llvm.org/LICENSE.txt for license information. |
5 // This file is distributed under the University of Illinois Open Source | 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 // License. See LICENSE.TXT for details. | |
7 // | 6 // |
8 //===----------------------------------------------------------------------===// | 7 //===----------------------------------------------------------------------===// |
9 | 8 |
10 #include "llvm/IR/ValueMap.h" | 9 #include "llvm/IR/ValueMap.h" |
11 #include "llvm/Config/llvm-config.h" | 10 #include "llvm/Config/llvm-config.h" |
193 EXPECT_FALSE(Data.M->try_lock()) << "Mutex should already be locked."; | 192 EXPECT_FALSE(Data.M->try_lock()) << "Mutex should already be locked."; |
194 } | 193 } |
195 static MutexT *getMutex(const ExtraData &Data) { return Data.M; } | 194 static MutexT *getMutex(const ExtraData &Data) { return Data.M; } |
196 }; | 195 }; |
197 // FIXME: These tests started failing on Windows. | 196 // FIXME: These tests started failing on Windows. |
198 #if LLVM_ENABLE_THREADS && !defined(LLVM_ON_WIN32) | 197 #if LLVM_ENABLE_THREADS && !defined(_WIN32) |
199 TYPED_TEST(ValueMapTest, LocksMutex) { | 198 TYPED_TEST(ValueMapTest, LocksMutex) { |
200 sys::Mutex M(false); // Not recursive. | 199 std::mutex M; |
201 bool CalledRAUW = false, CalledDeleted = false; | 200 bool CalledRAUW = false, CalledDeleted = false; |
202 typedef LockMutex<TypeParam*, sys::Mutex> ConfigType; | 201 typedef LockMutex<TypeParam*, std::mutex> ConfigType; |
203 typename ConfigType::ExtraData Data = {&M, &CalledRAUW, &CalledDeleted}; | 202 typename ConfigType::ExtraData Data = {&M, &CalledRAUW, &CalledDeleted}; |
204 ValueMap<TypeParam*, int, ConfigType> VM(Data); | 203 ValueMap<TypeParam*, int, ConfigType> VM(Data); |
205 VM[this->BitcastV.get()] = 7; | 204 VM[this->BitcastV.get()] = 7; |
206 this->BitcastV->replaceAllUsesWith(this->AddV.get()); | 205 this->BitcastV->replaceAllUsesWith(this->AddV.get()); |
207 this->AddV.reset(); | 206 this->AddV.reset(); |