Make PrettyStackTraceEntry use ManagedStatic for its ThreadLocal.
authorFilip Pizlo <fpizlo@apple.com>
Fri, 13 Sep 2013 22:59:47 +0000 (22:59 +0000)
committerFilip Pizlo <fpizlo@apple.com>
Fri, 13 Sep 2013 22:59:47 +0000 (22:59 +0000)
commite94e0984dfd22ede6211080d1f3e47138f1ea857
tree1539ee84c9d712f6e657ee21790f26ed635b46d7
parent98bae99266d8e527e7399c717a79c6dc9a073331
Make PrettyStackTraceEntry use ManagedStatic for its ThreadLocal.

This was somewhat tricky because ~PrettyStackTraceEntry() may run after
llvm_shutdown() has been called. This is rare and only happens for a common idiom
used in the main() functions of command-line tools. This works around the idiom by
skipping the stack clean-up if the PrettyStackTraceHead ManagedStatic is not
constructed (i.e. llvm_shutdown() has been called).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190730 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/ManagedStatic.h
lib/Support/PrettyStackTrace.cpp