diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-18 00:26:59 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-18 00:26:59 +0000 |
commit | 88c2596edc8eb475e20f6033de1ea01669695a0c (patch) | |
tree | 679107546ea3a40c67fda44db856d82616a08b6a /lib/Parse/ParseAST.cpp | |
parent | b395c63b473bf1b3783bff371a993332e8c4c5e3 (diff) |
Change ASTConsumer::HandleTopLevelDecl to return true for the parser to continue
parsing or false to abort parsing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144943 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseAST.cpp')
-rw-r--r-- | lib/Parse/ParseAST.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Parse/ParseAST.cpp b/lib/Parse/ParseAST.cpp index fdd7d0f151..a5c345afe2 100644 --- a/lib/Parse/ParseAST.cpp +++ b/lib/Parse/ParseAST.cpp @@ -79,15 +79,24 @@ void clang::ParseAST(Sema &S, bool PrintStats) { if (ExternalASTSource *External = S.getASTContext().getExternalSource()) External->StartTranslationUnit(Consumer); + bool Abort = false; Parser::DeclGroupPtrTy ADecl; while (!P.ParseTopLevelDecl(ADecl)) { // Not end of file. // If we got a null return and something *was* parsed, ignore it. This // is due to a top-level semicolon, an action override, or a parse error // skipping something. - if (ADecl) - Consumer->HandleTopLevelDecl(ADecl.get()); + if (ADecl) { + if (!Consumer->HandleTopLevelDecl(ADecl.get())) { + Abort = true; + break; + } + } }; + + if (Abort) + return; + // Check for any pending objective-c implementation decl. while ((ADecl = P.FinishPendingObjCActions())) Consumer->HandleTopLevelDecl(ADecl.get()); |