Move #line state into the Parser and out of the SourceManager.

As part of this change, allow #line directives to extend to the end of the
file, rather than requiring a reset.

Note that #line regions that start or end within function bodies will not
behave correctly when in delayed parsing modes. This was true before and
after this commit. (#line regions contained entirely within a function and
not within any other #line regions should be fine.)

Swift SVN r20571
This commit is contained in:
Jordan Rose
2014-07-25 23:01:43 +00:00
parent 071291003b
commit 29f8c25d63
8 changed files with 116 additions and 64 deletions

View File

@@ -284,6 +284,7 @@ Parser::Parser(std::unique_ptr<Lexer> Lex, SourceFile &SF,
SourceMgr.findBufferContainingLoc(ParserPos.Loc) == L->getBufferID()) {
auto BeginParserPosition = getParserPosition(ParserPos);
restoreParserPosition(BeginParserPosition);
InPoundLineEnvironment = State->InPoundLineEnvironment;
}
}