Skip to content
Snippets Groups Projects
Commit fa7d53fa authored by Ed Schouten's avatar Ed Schouten
Browse files

Make __has_extension(c_thread_local) work.

Unlike C++11's "thread_local" keyword, C11's "_Thread_local" is in the
reserved namespace, meaning we provide it unconditionally; it is marked
as KEYALL in TokenKinds.def.

This means that like all the other C11 keywords, we can expose its
presence through __has_extension().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190755 91177308-0d34-0410-b5e6-96231b3b80d8
parent 3225b9c9
No related branches found
No related tags found
No related merge requests found
...@@ -921,8 +921,8 @@ enabled. ...@@ -921,8 +921,8 @@ enabled.
C11 ``_Thread_local`` C11 ``_Thread_local``
^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
Use ``__has_feature(c_thread_local)`` to determine if support for Use ``__has_feature(c_thread_local)`` or ``__has_extension(c_thread_local)``
``_Thread_local`` variables is enabled. to determine if support for ``_Thread_local`` variables is enabled.
Checks for Type Traits Checks for Type Traits
====================== ======================
......
...@@ -1045,6 +1045,7 @@ static bool HasExtension(const Preprocessor &PP, const IdentifierInfo *II) { ...@@ -1045,6 +1045,7 @@ static bool HasExtension(const Preprocessor &PP, const IdentifierInfo *II) {
.Case("c_atomic", true) .Case("c_atomic", true)
.Case("c_generic_selections", true) .Case("c_generic_selections", true)
.Case("c_static_assert", true) .Case("c_static_assert", true)
.Case("c_thread_local", PP.getTargetInfo().isTLSSupported())
// C++11 features supported by other languages as extensions. // C++11 features supported by other languages as extensions.
.Case("cxx_atomic", LangOpts.CPlusPlus) .Case("cxx_atomic", LangOpts.CPlusPlus)
.Case("cxx_deleted_functions", LangOpts.CPlusPlus) .Case("cxx_deleted_functions", LangOpts.CPlusPlus)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment