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) {
4346
4346
if (Tok.is (tok::pound_if) && allowPoundIfAttributes) {
4347
4347
BacktrackingScope backtrack (*this );
4348
4348
bool sawAnyAttributes = false ;
4349
- return skipIfConfigOfAttributes (sawAnyAttributes) && sawAnyAttributes &&
4350
- isStartOfSwiftDecl ();
4349
+ return skipIfConfigOfAttributes (sawAnyAttributes) &&
4350
+ (Tok. is (tok::eof) || (sawAnyAttributes && isStartOfSwiftDecl ()) );
4351
4351
}
4352
4352
4353
4353
// 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) {
962
962
break ;
963
963
}
964
964
965
+ // If we ran out of tokens, say we consumed the rest.
966
+ if (Tok.is (tok::eof))
967
+ return true ;
968
+
965
969
return Tok.isAtStartOfLine () && consumeIf (tok::pound_endif);
966
970
}
967
971
You can’t perform that action at this time.
0 commit comments