diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/ASTContext.cpp | 6 | ||||
-rw-r--r-- | lib/Basic/Diagnostic.cpp | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index c9af67c8b6..8f9ab719b9 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -241,6 +241,9 @@ ASTContext::ASTContext(LangOptions& LOpts, SourceManager &SM, LastSDM(0, 0), UniqueBlockByRefTypeID(0) { + // Create a new allocator for partial diagnostics. + DiagAllocator = new (BumpAlloc) PartialDiagnosticStorageAllocator; + if (size_reserve > 0) Types.reserve(size_reserve); TUDecl = TranslationUnitDecl::Create(*this); @@ -285,6 +288,9 @@ ASTContext::~ASTContext() { AEnd = DeclAttrs.end(); A != AEnd; ++A) A->second->~AttrVec(); + + // Destroy the partial diagnostic allocator. + DiagAllocator->~PartialDiagnosticStorageAllocator(); } void ASTContext::AddDeallocation(void (*Callback)(void*), void *Data) { diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index c330215db1..fc7aaebc59 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -842,13 +842,13 @@ bool DiagnosticConsumer::IncludeInDiagnosticCounts() const { return true; } void IgnoringDiagConsumer::anchor() { } -PartialDiagnostic::StorageAllocator::StorageAllocator() { +PartialDiagnosticStorageAllocator::PartialDiagnosticStorageAllocator() { for (unsigned I = 0; I != NumCached; ++I) FreeList[I] = Cached + I; NumFreeListEntries = NumCached; } -PartialDiagnostic::StorageAllocator::~StorageAllocator() { +PartialDiagnosticStorageAllocator::~PartialDiagnosticStorageAllocator() { // 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"); |