This is an archive of the discontinued LLVM Phabricator instance.

Remove the ThreadLocal template from LLVM.
ClosedPublic

Authored by resistor on Jan 9 2023, 8:29 PM.

Details

Summary

This has been obsoleted by C++ thread_local for a long time.
As far as I know, Xcode was the last supported toolchain to add
support for C++ thread_local in 2016.

As a precaution, use LLVM_THREAD_LOCAL which provides even greater
backwards compatibility, allowing this to function even pre-C++11
versions of GCC.

Diff Detail

Event Timeline

resistor created this revision.Jan 9 2023, 8:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 9 2023, 8:29 PM
resistor requested review of this revision.Jan 9 2023, 8:29 PM
Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptJan 9 2023, 8:29 PM

Incorporated build fixes for GCC. Waiting for buildbots to complete.

nikic accepted this revision.Jan 10 2023, 1:33 AM
nikic added a subscriber: nikic.

LGTM

As a precaution, use LLVM_THREAD_LOCAL which provides even greater
backwards compatibility, allowing this to function even pre-C++11
versions of GCC.

I don't think backwards compatibility is still relevant given our minimum version requirements. We can probably drop the __thread fallback. What LLVM_THREAD_LOCAL does though is fall back to a normal variable if !LLVM_ENABLE_THREADS.

This revision is now accepted and ready to land.Jan 10 2023, 1:33 AM
This revision was landed with ongoing or failed builds.Jan 10 2023, 8:08 PM
This revision was automatically updated to reflect the committed changes.
llvm/lib/Support/Windows/ThreadLocal.inc