aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-02-04 12:30:46 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-02-04 12:30:46 +0000
commitef9b60ffed980864a8db26ad30344be429e58ff5 (patch)
tree9b046bec7746470eb8ed8b59492414353f134cb6 /lib/AST/ASTContext.cpp
parentc6c090d2722dbae27c7623184bed668f7f29fa4b (diff)
Move Storage and StorageAllocator out of the PartialDiagnostic class so we can forward declare them.
Let ASTContext allocate the storage in its BumpPtrAllocator. This will help us remove ASTContext's depedency on PartialDiagnostic.h soon. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149780 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r--lib/AST/ASTContext.cpp6
1 files changed, 6 insertions, 0 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) {