diff options
Diffstat (limited to 'Sema/ASTStreamer.cpp')
-rw-r--r-- | Sema/ASTStreamer.cpp | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/Sema/ASTStreamer.cpp b/Sema/ASTStreamer.cpp index 5a372da088..b51874ca35 100644 --- a/Sema/ASTStreamer.cpp +++ b/Sema/ASTStreamer.cpp @@ -24,10 +24,9 @@ ASTConsumer::~ASTConsumer() {} namespace { class ASTStreamer { Parser P; - std::vector<Decl*> TopLevelDeclList; public: ASTStreamer(Preprocessor &pp, ASTContext &ctxt, unsigned MainFileID) - : P(pp, *new Sema(pp, ctxt, TopLevelDeclList)) { + : P(pp, *new Sema(pp, ctxt)) { pp.EnterMainSourceFile(MainFileID); // Initialize the parser. @@ -51,30 +50,14 @@ namespace { Decl *ASTStreamer::ReadTopLevelDecl() { Parser::DeclTy *Result; - /// If the previous time through we read something like 'int X, Y', return - /// the next declarator. - if (!TopLevelDeclList.empty()) { - Result = TopLevelDeclList.back(); - TopLevelDeclList.pop_back(); - return static_cast<Decl*>(Result); - } - do { - if (P.ParseTopLevelDecl()) + if (P.ParseTopLevelDecl(Result)) return 0; // End of file. // If we got a null return and something *was* parsed, try again. This // is due to a top-level semicolon, an action override, or a parse error // skipping something. - } while (TopLevelDeclList.size() == 0); - - // If we parsed a declspec with multiple declarators, reverse the list and - // return the first one. - if (TopLevelDeclList.size() > 1) - std::reverse(TopLevelDeclList.begin(), TopLevelDeclList.end()); - - Result = TopLevelDeclList.back(); - TopLevelDeclList.pop_back(); + } while (Result == 0); return static_cast<Decl*>(Result); } |