aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/Diagnostic.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-03-21 18:40:07 +0000
committerTed Kremenek <kremenek@apple.com>2011-03-21 18:40:07 +0000
commit03201fbbdeb3eb7f465610b09c281ee6aa84e3ca (patch)
tree5d39781da3bf1f4fa960a00d5bb94c494d012462 /lib/Basic/Diagnostic.cpp
parentc70e193052660f08f7897057b19b12b39dc57cc6 (diff)
Use CrashRecoveryContextCleanup objects to reclaim resources from CompilerInstance objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128009 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Diagnostic.cpp')
-rw-r--r--lib/Basic/Diagnostic.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index 31e33315cc..f654ede49d 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -16,6 +16,8 @@
#include "clang/Basic/PartialDiagnostic.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/CrashRecoveryContext.h"
+
using namespace clang;
static void DummyArgToStringFn(Diagnostic::ArgumentKind AK, intptr_t QT,
@@ -683,5 +685,9 @@ PartialDiagnostic::StorageAllocator::StorageAllocator() {
}
PartialDiagnostic::StorageAllocator::~StorageAllocator() {
- assert(NumFreeListEntries == NumCached && "A partial is on the lamb");
+ // Don't assert if we are in a CrashRecovery context, as this
+ // invariant may be invalidated during a crash.
+ assert((NumFreeListEntries == NumCached ||
+ llvm::CrashRecoveryContext::isRecoveringFromCrash())
+ && "A partial is on the lamb");
}