From: Kristof Beyls Date: Fri, 31 Mar 2017 14:26:44 +0000 (+0000) Subject: Remove more name space pollution from .inc files X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a11dbf2c90e0a4926e5ac3d0799be4603e15ae32;p=platform%2Fupstream%2Fllvm.git Remove more name space pollution from .inc files llvm-svn: 299222 --- diff --git a/llvm/lib/Support/Windows/Mutex.inc b/llvm/lib/Support/Windows/Mutex.inc index ab79d07..0af145e 100644 --- a/llvm/lib/Support/Windows/Mutex.inc +++ b/llvm/lib/Support/Windows/Mutex.inc @@ -20,15 +20,14 @@ #include "llvm/Support/Mutex.h" namespace llvm { -using namespace sys; -MutexImpl::MutexImpl(bool /*recursive*/) +sys::MutexImpl::MutexImpl(bool /*recursive*/) { data_ = new CRITICAL_SECTION; InitializeCriticalSection((LPCRITICAL_SECTION)data_); } -MutexImpl::~MutexImpl() +sys::MutexImpl::~MutexImpl() { DeleteCriticalSection((LPCRITICAL_SECTION)data_); delete (LPCRITICAL_SECTION)data_; @@ -36,21 +35,21 @@ MutexImpl::~MutexImpl() } bool -MutexImpl::acquire() +sys::MutexImpl::acquire() { EnterCriticalSection((LPCRITICAL_SECTION)data_); return true; } bool -MutexImpl::release() +sys::MutexImpl::release() { LeaveCriticalSection((LPCRITICAL_SECTION)data_); return true; } bool -MutexImpl::tryacquire() +sys::MutexImpl::tryacquire() { return TryEnterCriticalSection((LPCRITICAL_SECTION)data_); } diff --git a/llvm/lib/Support/Windows/Program.inc b/llvm/lib/Support/Windows/Program.inc index 78fc538..721167d 100644 --- a/llvm/lib/Support/Windows/Program.inc +++ b/llvm/lib/Support/Windows/Program.inc @@ -29,7 +29,6 @@ //===----------------------------------------------------------------------===// namespace llvm { -using namespace sys; ProcessInfo::ProcessInfo() : ProcessHandle(0), Pid(0), ReturnCode(0) {} diff --git a/llvm/lib/Support/Windows/RWMutex.inc b/llvm/lib/Support/Windows/RWMutex.inc index 2d1d25f..ac60c2f 100644 --- a/llvm/lib/Support/Windows/RWMutex.inc +++ b/llvm/lib/Support/Windows/RWMutex.inc @@ -19,7 +19,6 @@ #include "WindowsSupport.h" namespace llvm { -using namespace sys; // Windows has slim read-writer lock support on Vista and higher, so we // will attempt to load the APIs. If they exist, we will use them, and @@ -73,7 +72,7 @@ static bool loadSRW() { return sHasSRW; } -RWMutexImpl::RWMutexImpl() { +sys::RWMutexImpl::RWMutexImpl() { if (loadSRW()) { data_ = calloc(1, sizeof(SRWLOCK)); fpInitializeSRWLock(static_cast(data_)); @@ -83,14 +82,14 @@ RWMutexImpl::RWMutexImpl() { } } -RWMutexImpl::~RWMutexImpl() { +sys::RWMutexImpl::~RWMutexImpl() { if (!sHasSRW) DeleteCriticalSection(static_cast(data_)); // Nothing to do in the case of slim reader/writers except free the memory. free(data_); } -bool RWMutexImpl::reader_acquire() { +bool sys::RWMutexImpl::reader_acquire() { if (sHasSRW) { fpAcquireSRWLockShared(static_cast(data_)); } else { @@ -99,7 +98,7 @@ bool RWMutexImpl::reader_acquire() { return true; } -bool RWMutexImpl::reader_release() { +bool sys::RWMutexImpl::reader_release() { if (sHasSRW) { fpReleaseSRWLockShared(static_cast(data_)); } else { @@ -108,7 +107,7 @@ bool RWMutexImpl::reader_release() { return true; } -bool RWMutexImpl::writer_acquire() { +bool sys::RWMutexImpl::writer_acquire() { if (sHasSRW) { fpAcquireSRWLockExclusive(static_cast(data_)); } else { @@ -117,7 +116,7 @@ bool RWMutexImpl::writer_acquire() { return true; } -bool RWMutexImpl::writer_release() { +bool sys::RWMutexImpl::writer_release() { if (sHasSRW) { fpReleaseSRWLockExclusive(static_cast(data_)); } else { diff --git a/llvm/lib/Support/Windows/ThreadLocal.inc b/llvm/lib/Support/Windows/ThreadLocal.inc index b9cb8ff..8be1c3e 100644 --- a/llvm/lib/Support/Windows/ThreadLocal.inc +++ b/llvm/lib/Support/Windows/ThreadLocal.inc @@ -20,33 +20,32 @@ #include "llvm/Support/ThreadLocal.h" namespace llvm { -using namespace sys; -ThreadLocalImpl::ThreadLocalImpl() : data() { +sys::ThreadLocalImpl::ThreadLocalImpl() : data() { static_assert(sizeof(DWORD) <= sizeof(data), "size too big"); DWORD* tls = reinterpret_cast(&data); *tls = TlsAlloc(); assert(*tls != TLS_OUT_OF_INDEXES); } -ThreadLocalImpl::~ThreadLocalImpl() { +sys::ThreadLocalImpl::~ThreadLocalImpl() { DWORD* tls = reinterpret_cast(&data); TlsFree(*tls); } -void *ThreadLocalImpl::getInstance() { +void *sys::ThreadLocalImpl::getInstance() { DWORD* tls = reinterpret_cast(&data); return TlsGetValue(*tls); } -void ThreadLocalImpl::setInstance(const void* d){ +void sys::ThreadLocalImpl::setInstance(const void* d){ DWORD* tls = reinterpret_cast(&data); int errorcode = TlsSetValue(*tls, const_cast(d)); assert(errorcode != 0); (void)errorcode; } -void ThreadLocalImpl::removeInstance() { +void sys::ThreadLocalImpl::removeInstance() { setInstance(0); }