Skip to content

Commit ee3bcf2

Browse files
committed
In location -> source file mapping, handle empty buffers gracefully
1 parent 45a0979 commit ee3bcf2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/AST/Module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ SourceFile *ModuleDecl::getSourceFileContainingLocation(SourceLoc loc) {
640640

641641
auto foundSourceFile = *found;
642642
auto foundRange = sourceMgr.getRangeForBuffer(*foundSourceFile->getBufferID());
643-
if (!foundRange.contains(adjustedLoc))
643+
if (!foundRange.contains(adjustedLoc) && adjustedLoc != foundRange.getStart())
644644
return nullptr;
645645

646646
// Update the last source file.

0 commit comments

Comments
 (0)