-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Track source locations more accurately.
This replaces the "file" member of token_pos_t with a SourceLocation. A source location is an index plus offset into a list of text streams representing source files and macro expansions. In theory, SourceLocation could fully replace token_pos_t. However, decoding a SourceLocation back to a line number is very expensive, and we need the line number extremely frequently. During lexing, we must retain the line number in addition to the source location. There are a few major benefits of this approach, versus the old "file, line, col" tuple. First, SourceLocations are tiny. We can use them in way more places, which makes the AST easier to annotate. Second, they are way more accurate. We can now trace a token back to the macro that defined it, and where that macro was defined, and what line included that file. But most importantly, this is a precursor to caching tokens. The built-in lint checker needs to convert a token position back to the source text stream, which was not easily possible in the old model. NOTE: This bumps the minimum C++ standard to C++17, which means we now require macOS 10.15 or higher, and Visual Studio 2017 or higher.
- Loading branch information
Showing
12 changed files
with
287 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.