diff options
author | Russell Gallop <russell.gallop@sony.com> | 2020-01-08 14:48:21 +0000 |
---|---|---|
committer | Russell Gallop <russell.gallop@sony.com> | 2020-01-15 11:15:25 +0000 |
commit | 884a65af5ceebce76519749ed6eb9a86d0596771 (patch) | |
tree | f6795c88b6f57ba3e36d67ec07cab1af001bb8eb | |
parent | 93a4dede3a5ecb110dd7cdfd7faa48e3448844d8 (diff) | |
download | bcm5719-llvm-884a65af5ceebce76519749ed6eb9a86d0596771.tar.gz bcm5719-llvm-884a65af5ceebce76519749ed6eb9a86d0596771.zip |
[Support] Replace Windows __declspec(thread) with thread_local for LLVM_THREAD_LOCAL
Windows minimum host tools version is now VS2017, which supports C++11
thread_local so use this for LLVM_THREAD_LOCAL instead of
declspec(thread). According to [1], thread_local is implemented with
declspec(thread) so this should be NFC.
[1] https://docs.microsoft.com/en-us/cpp/cpp/thread?view=vs-2017
Differential Revision: https://reviews.llvm.org/D72399
-rw-r--r-- | llvm/include/llvm/Support/Compiler.h | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h index 913353cd8a0..6f6f65cad6f 100644 --- a/llvm/include/llvm/Support/Compiler.h +++ b/llvm/include/llvm/Support/Compiler.h @@ -512,19 +512,15 @@ void AnnotateIgnoreWritesEnd(const char *file, int line); /// extern globals, and static globals. /// /// This is essentially an extremely restricted analog to C++11's thread_local -/// support, and uses that when available. However, it falls back on -/// platform-specific or vendor-provided extensions when necessary. These -/// extensions don't support many of the C++11 thread_local's features. You -/// should only use this for PODs that you can statically initialize to -/// some constant value. In almost all circumstances this is most appropriate -/// for use with a pointer, integer, or small aggregation of pointers and -/// integers. +/// support. It uses thread_local if available, falling back on gcc __thread +/// if not. __thread doesn't support many of the C++11 thread_local's +/// features. You should only use this for PODs that you can statically +/// initialize to some constant value. In almost all circumstances this is most +/// appropriate for use with a pointer, integer, or small aggregation of +/// pointers and integers. #if LLVM_ENABLE_THREADS -#if __has_feature(cxx_thread_local) +#if __has_feature(cxx_thread_local) || defined(_MSC_VER) #define LLVM_THREAD_LOCAL thread_local -#elif defined(_MSC_VER) -// MSVC supports this with a __declspec. -#define LLVM_THREAD_LOCAL __declspec(thread) #else // Clang, GCC, and other compatible compilers used __thread prior to C++11 and // we only need the restricted functionality that provides. |