[cfe-commits] r127932 - /cfe/trunk/lib/Sema/TypeLocBuilder.h

Ted Kremenek kremenek at apple.com
Fri Mar 18 18:00:38 PDT 2011


Author: kremenek
Date: Fri Mar 18 20:00:38 2011
New Revision: 127932

URL: http://llvm.org/viewvc/llvm-project?rev=127932&view=rev
Log:
Recovery memory from TypeLocBuilders during crashes.

Modified:
    cfe/trunk/lib/Sema/TypeLocBuilder.h

Modified: cfe/trunk/lib/Sema/TypeLocBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TypeLocBuilder.h?rev=127932&r1=127931&r2=127932&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TypeLocBuilder.h (original)
+++ cfe/trunk/lib/Sema/TypeLocBuilder.h Fri Mar 18 20:00:38 2011
@@ -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 @@
   /// 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() {





More information about the cfe-commits mailing list