Skip to content

Commit c824be3

Browse files
authored
Merge pull request #80352 from hamishknight/bail
2 parents 2bb098c + a0c3632 commit c824be3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Diff for: lib/Basic/SourceLoc.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -829,9 +829,14 @@ static bool isBeforeInSource(
829829
auto [firstMismatch, secondMismatch] = std::mismatch(
830830
firstAncestors.begin(), firstAncestors.end(),
831831
secondAncestors.begin(), secondAncestors.end());
832-
assert(firstMismatch != firstAncestors.begin() &&
833-
secondMismatch != secondAncestors.begin() &&
834-
"Ancestors don't have the same root source file");
832+
if (firstMismatch == firstAncestors.begin() ||
833+
secondMismatch == secondAncestors.begin()) {
834+
// FIXME: This is currently being hit for code completion
835+
// (rdar://134522702), possibly due to an invalid ASTScope node range. For
836+
// now, let's bail with `false` in non-asserts builds.
837+
assert(false && "Ancestors don't have the same root source file");
838+
return false;
839+
}
835840

836841
SourceLoc firstLocInLCA = firstMismatch == firstAncestors.end()
837842
? firstLoc

0 commit comments

Comments
 (0)