[compiler-rt] [hwasan][Fuchsia] Use GetCurrentThread (PR #180602)

Roland McGrath via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 9 12:45:59 PST 2026


================
@@ -159,7 +159,10 @@ static void FinishThreadInitialization(Thread *thread) {
 }
 
 static void ThreadExitHook(void *hook, thrd_t self) {
-  Thread *thread = static_cast<Thread *>(hook);
----------------
frobtech wrote:

Since the rest of the machinery still relies on the hook value, it seems appropriate not to just ignore it here.  When it's non-null, then it's cheaper to just use it rather than do all the work that `GetCurrentThread()` does.  OTOH, it seems like a good self-consistency check to ensure that when it's non-null, it is indeed the same pointer that `GetCurrentThread()` would compute.

So I think this should check for a null hook, and either:
 * Only use `GetCurrentThread()` when the hook is null.
 * Or: `CHECK(hook == thread);` after using it.

https://github.com/llvm/llvm-project/pull/180602


More information about the llvm-commits mailing list