mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-03 22:02:51 +01:00
Track the file kind on SourceLocation rather than computing it from the file name. (#2999)
This will be more correct if a user file is named prelude.carbon, and reduces the explorer runtime by about 10% by removing a string comparison from the check for whether trace output is enabled. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
41e357492b
commit
ea60e4f491
@@ -93,7 +93,7 @@ auto ParseAndExecuteFile(std::string_view prelude_path,
|
||||
Nonnull<llvm::raw_ostream*> print_stream)
|
||||
-> ErrorOr<int> {
|
||||
auto parse = [&](Arena* arena) {
|
||||
return Parse(arena, input_file_name, parser_debug);
|
||||
return Parse(arena, input_file_name, FileKind::Main, parser_debug);
|
||||
};
|
||||
return ParseAndExecuteHelper(parse, prelude_path, trace_stream, print_stream);
|
||||
}
|
||||
@@ -104,7 +104,8 @@ auto ParseAndExecute(std::string_view prelude_path,
|
||||
Nonnull<TraceStream*> trace_stream,
|
||||
Nonnull<llvm::raw_ostream*> print_stream) -> ErrorOr<int> {
|
||||
auto parse = [&](Arena* arena) {
|
||||
return ParseFromString(arena, input_file_name, file_contents, parser_debug);
|
||||
return ParseFromString(arena, input_file_name, FileKind::Main,
|
||||
file_contents, parser_debug);
|
||||
};
|
||||
return ParseAndExecuteHelper(parse, prelude_path, trace_stream, print_stream);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user