Skip to content

Commit d600d5c

Browse files
authored
Merge pull request #2903 from rintaro/virtualfile-comment
[SourceLocation] Add some doc-comments to VirtualFile type
2 parents e3f2ca0 + 9894db5 commit d600d5c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/SwiftSyntax/SourceLocation.swift

+5-1
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,9 @@ private struct SortedArray<Element>: RandomAccessCollection {
477477
extension SortedArray: Sendable where Element: Sendable {}
478478

479479
/// Represent a virtual file region in the source file.
480+
///
481+
/// This type corresponds to `swift::SourceManager::VirtualFile` in the compiler,
482+
/// and is used for populating the virtual file information in it.
480483
@_spi(Compiler)
481484
public struct VirtualFile: Sendable {
482485
/// Start position of the virtual file region
@@ -487,7 +490,8 @@ public struct VirtualFile: Sendable {
487490
public var fileName: String
488491
/// Line number offset from the physical line number.
489492
public var lineOffset: Int
490-
/// The position of the filename literal.
493+
/// The position of the file name string literal in the `#sourceLocation` directive.
494+
/// This can be used to diagnose the file name in the compiler.
491495
public var fileNamePosition: AbsolutePosition
492496
}
493497

0 commit comments

Comments
 (0)