================
@@ -8217,11 +8217,18 @@ NamedDecl *Sema::ActOnVariableDeclarator(
if (NewVD->hasLocalStorage() &&
(SCSpec != DeclSpec::SCS_unspecified ||
TSCS != DeclSpec::TSCS_thread_local ||
- !DC->isFunctionOrMethod()))
- Diag(D.getDeclSpec().getThreadStorageClassSpecLoc(),
- diag::err_thread_non_global)
- << DeclSpec::getSpecifierName(TSCS);
- else if (!Context.getTargetInfo().isTLSSupported()) {
+ !DC->isFunctionOrMethod())) {
+ if (TSCS == DeclSpec::TSCS__Thread_local &&
----------------
ChenMiaoi wrote:
Would it be better to write it this way?
``` cc
unsigned DiagID =
TSCS == DeclSpec::TSCS__Thread_local && DC->isFunctionOrMethod()
? diag::err_thread_local_block_scope
: diag::err_thread_non_global;
Diag(D.getDeclSpec().getThreadStorageClassSpecLoc(), DiagID)
<< DeclSpec::getSpecifierName(TSCS);
```
https://github.com/llvm/llvm-project/pull/234704
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits