aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--contrib/llvm-project/clang/lib/Parse/ParseDecl.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/contrib/llvm-project/clang/lib/Parse/ParseDecl.cpp b/contrib/llvm-project/clang/lib/Parse/ParseDecl.cpp
index 43b2a32cce71..cf1e3a94de7f 100644
--- a/contrib/llvm-project/clang/lib/Parse/ParseDecl.cpp
+++ b/contrib/llvm-project/clang/lib/Parse/ParseDecl.cpp
@@ -3998,8 +3998,15 @@ void Parser::ParseDeclarationSpecifiers(
case tok::kw_thread_local:
if (getLangOpts().C2x)
Diag(Tok, diag::warn_c2x_compat_keyword) << Tok.getName();
- isInvalid = DS.SetStorageClassSpecThread(DeclSpec::TSCS_thread_local, Loc,
- PrevSpec, DiagID);
+ // We map thread_local to _Thread_local in C23 mode so it retains the C
+ // semantics rather than getting the C++ semantics.
+ // FIXME: diagnostics will show _Thread_local when the user wrote
+ // thread_local in source in C23 mode; we need some general way to
+ // identify which way the user spelled the keyword in source.
+ isInvalid = DS.SetStorageClassSpecThread(
+ getLangOpts().C2x ? DeclSpec::TSCS__Thread_local
+ : DeclSpec::TSCS_thread_local,
+ Loc, PrevSpec, DiagID);
isStorageClass = true;
break;
case tok::kw__Thread_local: