================
@@ -3903,8 +3914,7 @@ CIRGenModule::getAddrOfGlobalTemporary(const 
MaterializeTemporaryExpr *mte,
     errorNYI(mte->getSourceRange(),
              "Global temporary with comdat/weak linkage");
   if (varDecl->getTLSKind())
-    errorNYI(mte->getSourceRange(),
-             "Global temporary with thread local storage");
+    setTLSMode(gv, *varDecl);
----------------
andykaylor wrote:

In this case `varDecl` is coming from `cast<VarDecl>(mte->getExtendingDecl());` 
That is, it's the decl that is extending the lifetime of this temporary, so I 
think it needs to copy its TLS behavior from the extending decl. Near as I can 
tell, there is no VarDecl for the temporary and classic codegen doesn't create 
a thread-local wrapper for it, but it does mark it as a thread-local variable. 
Here's that in isolation:

https://godbolt.org/z/Y1Y78so1r

On closer inspection, I'm less confident that the alias case would hit this, 
and I'm inclined to just add something like an `isExtendingDecl` parameter to 
setTlsMode.

https://github.com/llvm/llvm-project/pull/200227
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to