Recovery memory from TypeLocBuilders during crashes.

llvm-svn: 127932
This commit is contained in:
Ted Kremenek 2011-03-19 01:00:38 +00:00
parent f75d089679
commit a872326929
1 changed files with 6 additions and 1 deletions

View File

@ -18,6 +18,7 @@
#include "clang/AST/TypeLoc.h"
#include "llvm/ADT/SmallVector.h"
#include "clang/AST/ASTContext.h"
#include "llvm/Support/CrashRecoveryContext.h"
namespace clang {
@ -42,9 +43,13 @@ class TypeLocBuilder {
/// The inline buffer.
char InlineBuffer[InlineCapacity];
llvm::CrashRecoveryContextCleanupRegistrar cleanupBuffer;
public:
TypeLocBuilder()
: Buffer(InlineBuffer), Capacity(InlineCapacity), Index(InlineCapacity)
: Buffer(InlineBuffer), Capacity(InlineCapacity), Index(InlineCapacity),
cleanupBuffer(llvm::CrashRecoveryContextCleanup::create<TypeLocBuilder>(
this, llvm::CrashRecoveryContextCleanup::DestructorCleanup))
{}
~TypeLocBuilder() {