aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/CrashRecoveryContext.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-03-19 00:59:33 +0000
committerTed Kremenek <kremenek@apple.com>2011-03-19 00:59:33 +0000
commit794a0714ad459bb971c038e544867d106ec43264 (patch)
tree41d6088d95aa51101eda0e04d66e2e49f319f0b4 /llvm/lib/Support/CrashRecoveryContext.cpp
parent0f2f30b241ee6cc4a0929ca89631b88161cb33be (diff)
downloadllvm-794a0714ad459bb971c038e544867d106ec43264.zip
llvm-794a0714ad459bb971c038e544867d106ec43264.tar.gz
llvm-794a0714ad459bb971c038e544867d106ec43264.tar.bz2
Tweak CrashRecoveryContext::GetCurrent() to return quickly if 'gCrsahRecoveryEnabled' is false. This avoids us needing to go to thread local storage for
the performance sensitive case where we are compiling code. llvm-svn: 127928
Diffstat (limited to 'llvm/lib/Support/CrashRecoveryContext.cpp')
-rw-r--r--llvm/lib/Support/CrashRecoveryContext.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Support/CrashRecoveryContext.cpp b/llvm/lib/Support/CrashRecoveryContext.cpp
index e190051..d4e21a3 100644
--- a/llvm/lib/Support/CrashRecoveryContext.cpp
+++ b/llvm/lib/Support/CrashRecoveryContext.cpp
@@ -74,6 +74,9 @@ CrashRecoveryContext::~CrashRecoveryContext() {
}
CrashRecoveryContext *CrashRecoveryContext::GetCurrent() {
+ if (!gCrashRecoveryEnabled)
+ return 0;
+
const CrashRecoveryContextImpl *CRCI = CurrentContext.get();
if (!CRCI)
return 0;