File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -4346,8 +4346,8 @@ bool Parser::isStartOfSwiftDecl(bool allowPoundIfAttributes) {
43464346 if (Tok.is (tok::pound_if) && allowPoundIfAttributes) {
43474347 BacktrackingScope backtrack (*this );
43484348 bool sawAnyAttributes = false ;
4349- return skipIfConfigOfAttributes (sawAnyAttributes) && sawAnyAttributes &&
4350- isStartOfSwiftDecl ();
4349+ return skipIfConfigOfAttributes (sawAnyAttributes) &&
4350+ (Tok. is (tok::eof) || (sawAnyAttributes && isStartOfSwiftDecl ()) );
43514351 }
43524352
43534353 // If we have a decl modifying keyword, check if the next token is a valid
Original file line number Diff line number Diff line change @@ -962,6 +962,10 @@ bool Parser::skipIfConfigOfAttributes(bool &sawAnyAttributes) {
962962 break ;
963963 }
964964
965+ // If we ran out of tokens, say we consumed the rest.
966+ if (Tok.is (tok::eof))
967+ return true ;
968+
965969 return Tok.isAtStartOfLine () && consumeIf (tok::pound_endif);
966970}
967971
You can’t perform that action at this time.
0 commit comments