mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
In location -> source file mapping, handle empty buffers gracefully
This commit is contained in:
@@ -640,7 +640,7 @@ SourceFile *ModuleDecl::getSourceFileContainingLocation(SourceLoc loc) {
|
||||
|
||||
auto foundSourceFile = *found;
|
||||
auto foundRange = sourceMgr.getRangeForBuffer(*foundSourceFile->getBufferID());
|
||||
if (!foundRange.contains(adjustedLoc))
|
||||
if (!foundRange.contains(adjustedLoc) && adjustedLoc != foundRange.getStart())
|
||||
return nullptr;
|
||||
|
||||
// Update the last source file.
|
||||
|
||||
Reference in New Issue
Block a user