Make gCrashRecoveryEnabled thread local
authorJacques Pienaar <jpienaar@google.com>
Wed, 10 Feb 2021 20:44:18 +0000 (12:44 -0800)
committerJacques Pienaar <jpienaar@google.com>
Wed, 10 Feb 2021 20:44:18 +0000 (12:44 -0800)
commit5e77ea04f214c7a18bd5c782c8b8a7b7c828ad7a
tree7ec5bae21d3b8871fb62c88a931aa84e4000510c
parent1cb47a063e2bbb04375ab52ed7377e8d555ef97d
Make gCrashRecoveryEnabled thread local

If context is enabled/disabled and queried concurrently then this
results in a data race/TSAN failure with RunSafely (where boolean
variable was not locked).

There doesn't seem to be a reasonable way to enable threads that enable
and disable recovery in parallel (without also keeping
gCrashRecoveryEnabled's lock held during Fn execution which seems
undesirable). This makes enable checking if enabled thread local and
consistent with other thread local usage of crash context here.

Differential Revision: https://reviews.llvm.org/D93907
llvm/lib/Support/CrashRecoveryContext.cpp