diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-03-18 03:44:21 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-03-18 03:44:21 +0000 |
commit | 934a57194c9ee3db2dc38fc0222296621c4d2c8a (patch) | |
tree | 3f4dbecb3d725bdbc0243a1398bf68f41d88e10b /lib/Parse/ParseAST.cpp | |
parent | da0f45de179d96373af17734c164019cf12de41f (diff) |
Construct 'Sema' object on the stack, so that crash recovery can recovery it's associated resources without walking over dead stack space.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127864 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseAST.cpp')
-rw-r--r-- | lib/Parse/ParseAST.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Parse/ParseAST.cpp b/lib/Parse/ParseAST.cpp index 97e5b60f52..bca0fa7ba5 100644 --- a/lib/Parse/ParseAST.cpp +++ b/lib/Parse/ParseAST.cpp @@ -21,6 +21,7 @@ #include "clang/AST/ExternalASTSource.h" #include "clang/AST/Stmt.h" #include "clang/Parse/Parser.h" +#include "llvm/ADT/OwningPtr.h" #include "llvm/Support/CrashRecoveryContext.h" #include <cstdio> @@ -38,14 +39,17 @@ void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer, ASTContext &Ctx, bool PrintStats, bool CompleteTranslationUnit, CodeCompleteConsumer *CompletionConsumer) { - Sema S(PP, Ctx, *Consumer, CompleteTranslationUnit, CompletionConsumer); + + llvm::OwningPtr<Sema> S(new Sema(PP, Ctx, *Consumer, + CompleteTranslationUnit, + CompletionConsumer)); // Recover resources if we crash before exiting this method. llvm::CrashRecoveryContextCleanupRegistrar SemaCleanupInCrash(llvm::CrashRecoveryContextCleanup:: - create<Sema>(&S)); + create<Sema>(S.get())); - ParseAST(S, PrintStats); + ParseAST(*S.get(), PrintStats); } void clang::ParseAST(Sema &S, bool PrintStats) { |