@@ -626,6 +626,12 @@ void Parser::ParseLexedMethodDef(LexedMethod &LM) {
626626 Actions.ActOnStartOfFunctionDef (getCurScope (), LM.D );
627627
628628 auto _ = llvm::make_scope_exit ([&]() {
629+ while (Tok.isNot (tok::eof))
630+ ConsumeAnyToken ();
631+
632+ if (Tok.is (tok::eof) && Tok.getEofData () == LM.D )
633+ ConsumeAnyToken ();
634+
629635 if (auto *FD = dyn_cast_or_null<FunctionDecl>(LM.D ))
630636 if (isa<CXXMethodDecl>(FD) ||
631637 FD->isInIdentifierNamespace (Decl::IDNS_OrdinaryFriend))
@@ -634,12 +640,6 @@ void Parser::ParseLexedMethodDef(LexedMethod &LM) {
634640
635641 if (Tok.is (tok::kw_try)) {
636642 ParseFunctionTryBlock (LM.D , FnScope);
637-
638- while (Tok.isNot (tok::eof))
639- ConsumeAnyToken ();
640-
641- if (Tok.is (tok::eof) && Tok.getEofData () == LM.D )
642- ConsumeAnyToken ();
643643 return ;
644644 }
645645 if (Tok.is (tok::colon)) {
@@ -649,12 +649,6 @@ void Parser::ParseLexedMethodDef(LexedMethod &LM) {
649649 if (!Tok.is (tok::l_brace)) {
650650 FnScope.Exit ();
651651 Actions.ActOnFinishFunctionBody (LM.D , nullptr );
652-
653- while (Tok.isNot (tok::eof))
654- ConsumeAnyToken ();
655-
656- if (Tok.is (tok::eof) && Tok.getEofData () == LM.D )
657- ConsumeAnyToken ();
658652 return ;
659653 }
660654 } else
@@ -668,12 +662,6 @@ void Parser::ParseLexedMethodDef(LexedMethod &LM) {
668662 " current template being instantiated!" );
669663
670664 ParseFunctionStatementBody (LM.D , FnScope);
671-
672- while (Tok.isNot (tok::eof))
673- ConsumeAnyToken ();
674-
675- if (Tok.is (tok::eof) && Tok.getEofData () == LM.D )
676- ConsumeAnyToken ();
677665}
678666
679667// / ParseLexedMemberInitializers - We finished parsing the member specification
0 commit comments