From 4721e55a0c2e749cba4f91aa584508284ff67d2c Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Mon, 3 Mar 2014 17:53:30 +0000 Subject: [C++11] Replace LLVM atomics with std::atomic. With C++11 we finally have a standardized way to specify atomic operations. Use them to replace the existing custom implemention. Sadly the translation is not entirely trivial as std::atomic allows more fine-grained control over the atomicity. I tried to preserve the old semantics as well as possible. Differential Revision: http://llvm-reviews.chandlerc.com/D2915 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202730 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/ManagedStatic.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/Support/ManagedStatic.cpp') diff --git a/lib/Support/ManagedStatic.cpp b/lib/Support/ManagedStatic.cpp index 098cccb68d..c19f8cb485 100644 --- a/lib/Support/ManagedStatic.cpp +++ b/lib/Support/ManagedStatic.cpp @@ -13,7 +13,6 @@ #include "llvm/Support/ManagedStatic.h" #include "llvm/Config/config.h" -#include "llvm/Support/Atomic.h" #include using namespace llvm; @@ -28,7 +27,7 @@ void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(), void* tmp = Creator ? Creator() : 0; TsanHappensBefore(this); - sys::MemoryFence(); + std::atomic_thread_fence(std::memory_order_seq_cst); // This write is racy against the first read in the ManagedStatic // accessors. The race is benign because it does a second read after a -- cgit v1.2.3