Skip to content

Commit 5f3625d

Browse files
committed
Address review feedback to avoid pointer arithmetic
1 parent 7159e72 commit 5f3625d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/ASTGen/Sources/ASTGen/Regex.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
//import AST
14-
//import Basic
13+
import CBasicBridging
1514
import CASTBridging
1615

1716
#if canImport(_CompilerRegexParser)
@@ -114,9 +113,9 @@ public func _RegexLiteralParsingFn(
114113
return false
115114
} catch let error as CompilerParseError {
116115
var diagLoc = bridgedDiagnosticBaseLoc
117-
if let _diagLoc = diagLoc.raw, let errorLoc = error.location {
116+
if diagLoc.raw != nil, let errorLoc = error.location {
118117
let offset = str.utf8.distance(from: str.startIndex, to: errorLoc)
119-
diagLoc = BridgedSourceLoc(raw: _diagLoc.advanced(by: offset))
118+
diagLoc = SourceLoc_advanced(diagLoc, SwiftInt(offset))
120119
}
121120

122121
var message = error.message

0 commit comments

Comments
 (0)