Only evaluate __has_feature(c_thread_local) and __has_feature(cxx_thread_local) true when the target supports thread-local storage.
llvm-svn: 180909
This commit is contained in:
parent
bca31a3d64
commit
a7130bfed6
|
@ -751,7 +751,8 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
|
|||
.Case("c_atomic", LangOpts.C11)
|
||||
.Case("c_generic_selections", LangOpts.C11)
|
||||
.Case("c_static_assert", LangOpts.C11)
|
||||
.Case("c_thread_local", LangOpts.C11)
|
||||
.Case("c_thread_local",
|
||||
LangOpts.C11 && PP.getTargetInfo().isTLSSupported())
|
||||
// C++11 features
|
||||
.Case("cxx_access_control_sfinae", LangOpts.CPlusPlus11)
|
||||
.Case("cxx_alias_templates", LangOpts.CPlusPlus11)
|
||||
|
@ -783,7 +784,8 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
|
|||
.Case("cxx_rvalue_references", LangOpts.CPlusPlus11)
|
||||
.Case("cxx_strong_enums", LangOpts.CPlusPlus11)
|
||||
.Case("cxx_static_assert", LangOpts.CPlusPlus11)
|
||||
.Case("cxx_thread_local", LangOpts.CPlusPlus11)
|
||||
.Case("cxx_thread_local",
|
||||
LangOpts.CPlusPlus11 && PP.getTargetInfo().isTLSSupported())
|
||||
.Case("cxx_trailing_return", LangOpts.CPlusPlus11)
|
||||
.Case("cxx_unicode_literals", LangOpts.CPlusPlus11)
|
||||
.Case("cxx_unrestricted_unions", LangOpts.CPlusPlus11)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// RUN: %clang_cc1 -E -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-0X %s
|
||||
// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-0X %s
|
||||
// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-0X %s
|
||||
// RUN: %clang_cc1 -E -triple armv7-apple-darwin -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-NO-TLS %s
|
||||
// RUN: %clang_cc1 -E -triple x86_64-linux-gnu %s -o - | FileCheck --check-prefix=CHECK-NO-0X %s
|
||||
|
||||
#if __has_feature(cxx_atomic)
|
||||
int has_atomic();
|
||||
|
@ -290,3 +291,4 @@ int no_thread_local();
|
|||
|
||||
// CHECK-0X: has_thread_local
|
||||
// CHECK-NO-0X: no_thread_local
|
||||
// CHECK-NO-TLS: no_thread_local
|
||||
|
|
Loading…
Reference in New Issue