From 9894db51779e5731d9c23017cc8077b3e7ef4711 Mon Sep 17 00:00:00 2001 From: Rintaro Ishizaki Date: Thu, 21 Nov 2024 12:40:02 -0800 Subject: [PATCH] [SourceLocation] Add some doc-comments to VirtualFile type --- Sources/SwiftSyntax/SourceLocation.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sources/SwiftSyntax/SourceLocation.swift b/Sources/SwiftSyntax/SourceLocation.swift index 57d0944939c..dcca9d2a74f 100644 --- a/Sources/SwiftSyntax/SourceLocation.swift +++ b/Sources/SwiftSyntax/SourceLocation.swift @@ -477,6 +477,9 @@ private struct SortedArray: RandomAccessCollection { extension SortedArray: Sendable where Element: Sendable {} /// Represent a virtual file region in the source file. +/// +/// This type corresponds to `swift::SourceManager::VirtualFile` in the compiler, +/// and is used for populating the virtual file information in it. @_spi(Compiler) public struct VirtualFile: Sendable { /// Start position of the virtual file region @@ -487,7 +490,8 @@ public struct VirtualFile: Sendable { public var fileName: String /// Line number offset from the physical line number. public var lineOffset: Int - /// The position of the filename literal. + /// The position of the file name string literal in the `#sourceLocation` directive. + /// This can be used to diagnose the file name in the compiler. public var fileNamePosition: AbsolutePosition }