mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +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
@@ -275,8 +275,10 @@ void ActionStack::PushCleanUpActions(
|
||||
while (!actions.empty()) {
|
||||
auto& act = actions.top();
|
||||
if (act->scope()) {
|
||||
// TODO: Provide a real source location.
|
||||
std::unique_ptr<Action> cleanup_action = std::make_unique<CleanUpAction>(
|
||||
std::move(*act->scope()), SourceLocation("stack cleanup", 1));
|
||||
std::move(*act->scope()),
|
||||
SourceLocation("stack cleanup", 1, FileKind::Unknown));
|
||||
todo_.Push(std::move(cleanup_action));
|
||||
}
|
||||
actions.pop();
|
||||
@@ -286,8 +288,10 @@ void ActionStack::PushCleanUpActions(
|
||||
void ActionStack::PushCleanUpAction(std::unique_ptr<Action> act) {
|
||||
auto& scope = act->scope();
|
||||
if (scope && act->kind() != Action::Kind::CleanUpAction) {
|
||||
// TODO: Provide a real source location.
|
||||
std::unique_ptr<Action> cleanup_action = std::make_unique<CleanUpAction>(
|
||||
std::move(*scope), SourceLocation("stack cleanup", 1));
|
||||
std::move(*scope),
|
||||
SourceLocation("stack cleanup", 1, FileKind::Unknown));
|
||||
todo_.Push(std::move(cleanup_action));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user