[cfe-commits] r127850 - /cfe/trunk/lib/Parse/ParseAST.cpp
Ted Kremenek
kremenek at apple.com
Thu Mar 17 19:06:53 PDT 2011
Author: kremenek
Date: Thu Mar 17 21:06:53 2011
New Revision: 127850
URL: http://llvm.org/viewvc/llvm-project?rev=127850&view=rev
Log:
Use CrashRecoveryContextCleanup objects to release resources associated with Sema during a crash while parsing.
Modified:
cfe/trunk/lib/Parse/ParseAST.cpp
Modified: cfe/trunk/lib/Parse/ParseAST.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseAST.cpp?rev=127850&r1=127849&r2=127850&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseAST.cpp (original)
+++ cfe/trunk/lib/Parse/ParseAST.cpp Thu Mar 17 21:06:53 2011
@@ -21,6 +21,7 @@
#include "clang/AST/ExternalASTSource.h"
#include "clang/AST/Stmt.h"
#include "clang/Parse/Parser.h"
+#include "llvm/Support/CrashRecoveryContext.h"
#include <cstdio>
using namespace clang;
@@ -38,6 +39,12 @@
bool CompleteTranslationUnit,
CodeCompleteConsumer *CompletionConsumer) {
Sema S(PP, Ctx, *Consumer, CompleteTranslationUnit, CompletionConsumer);
+
+ // Recover resources if we crash before exiting this method.
+ llvm::CrashRecoveryContextCleanupRegistrar
+ SemaCleanupInCrash(llvm::CrashRecoveryContextCleanup::
+ create<Sema>(&S));
+
ParseAST(S, PrintStats);
}
More information about the cfe-commits
mailing list