Skip to content

Commit

Permalink
Clarify != nullptr explicitly to make logic clearer, and add not-em…
Browse files Browse the repository at this point in the history
…pty check

Addresses comment hsutter@d136153#r142724776
  • Loading branch information
hsutter committed Jun 9, 2024
1 parent 37299f2 commit 853238d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions source/sema.h
Original file line number Diff line number Diff line change
Expand Up @@ -2449,11 +2449,17 @@ class sema
}

// All the scope-local names stay active for lookup until the end of their scope
while (current_declarations.back()) {
while (
!current_declarations.empty()
&& current_declarations.back() != nullptr
)
{
current_declarations.pop_back();
}
if (!current_declarations.empty()) {
assert(current_declarations.back() == nullptr); // we're popping a lifetime scope
current_declarations.pop_back();
}
assert(!current_declarations.back()); // we're popping a lifetime scope
current_declarations.pop_back();

indices_of_uses_per_scope.pop_back();
indices_of_activations_per_scope.pop_back();
Expand Down

0 comments on commit 853238d

Please sign in to comment.