[cfe-commits] r127931 - /cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
Ted Kremenek
kremenek at apple.com
Fri Mar 18 18:00:36 PDT 2011
Author: kremenek
Date: Fri Mar 18 20:00:36 2011
New Revision: 127931
URL: http://llvm.org/viewvc/llvm-project?rev=127931&view=rev
Log:
Recover memory from RecordLayoutBuilders during crashes.
Modified:
cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=127931&r1=127930&r2=127931&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Fri Mar 18 20:00:36 2011
@@ -19,7 +19,7 @@
#include "llvm/Support/Format.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/Support/MathExtras.h"
-#include <map>
+#include "llvm/Support/CrashRecoveryContext.h"
using namespace clang;
@@ -1708,6 +1708,11 @@
case CXXABI_Microsoft:
Builder.reset(new MSRecordLayoutBuilder(*this, &EmptySubobjects));
}
+ // Recover resources if we crash before exiting this method.
+ llvm::CrashRecoveryContextCleanupRegistrar
+ RecordBuilderCleanup(llvm::CrashRecoveryContextCleanup::
+ create<RecordLayoutBuilder>(Builder.get()));
+
Builder->Layout(RD);
// FIXME: This is not always correct. See the part about bitfields at
More information about the cfe-commits
mailing list