[PATCH] D80417: Fix Darwin 'constinit thread_local' variables.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 22 20:53:32 PDT 2020


rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:4145
+  // referenced directly, without calling the thread-wrapper, so the linkage
+  // must not be changed.
+  //
----------------
hubert.reinterpretcast wrote:
> rjmccall wrote:
> > Is this a good idea?  It seems to be making `constinit` part of the interface of a declaration, when it seems like it should strictly part of the implementation.
> @rsmith, fyi. My understanding is that `constinit` is as much part of the interface as `__thread` or `_Thread_local`.
Oh, heh.  My impression had been an informal one, that it was purely a matter of enforcing static initialization, but I see that the committee did indeed sneak in the thread-local optimization.  I guess all it means is that you can never take away `constinit` from an extern declaration once you've added it if you need a stable ABI.

Anyway, nevermind.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80417/new/

https://reviews.llvm.org/D80417





More information about the cfe-commits mailing list