mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Switch GeneratedSourceInfo ranges over to CharSourceRange.
Macro expansion buffers, along with other generated source buffers, need more precise "original source ranges" that can be had with the token-based `SourceRange`. Switch over to `CharSourceRange` and provide more thoughtfully-determined original source ranges.
This commit is contained in:
@@ -918,11 +918,11 @@ static void setLocationInfo(const ValueDecl *VD,
|
||||
// function body and which we created while reusing the ASTContext for
|
||||
// the rest of the file. Map the location back to the original file.
|
||||
unsigned OriginalBufID = SM.findBufferContainingLoc(
|
||||
GeneratedSourceInfo->originalSourceRange.Start);
|
||||
GeneratedSourceInfo->originalSourceRange.getStart());
|
||||
auto OriginalStartOffset = SM.getLocOffsetInBuffer(
|
||||
GeneratedSourceInfo->originalSourceRange.Start, OriginalBufID);
|
||||
GeneratedSourceInfo->originalSourceRange.getStart(), OriginalBufID);
|
||||
auto GeneratedStartOffset = SM.getLocOffsetInBuffer(
|
||||
GeneratedSourceInfo->generatedSourceRange.Start, DeclBufID);
|
||||
GeneratedSourceInfo->generatedSourceRange.getStart(), DeclBufID);
|
||||
Location.Offset += OriginalStartOffset - GeneratedStartOffset;
|
||||
assert(SM.findBufferContainingLoc(Loc) == DeclBufID);
|
||||
std::tie(Location.Line, Location.Column) =
|
||||
|
||||
Reference in New Issue
Block a user