mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AST] Merge BridgedDiagnosticEngine + BridgedDiagEngine
Introduce a macro that can stamp out wrapper classes for underlying C++ pointers, and use it to define BridgedDiagnosticEngine in ASTBridging. Then, migrate users of BridgedDiagEngine onto it.
This commit is contained in:
@@ -52,16 +52,16 @@ public struct DiagnosticFixIt {
|
||||
}
|
||||
|
||||
public struct DiagnosticEngine {
|
||||
private let bridged: BridgedDiagEngine
|
||||
private let bridged: BridgedDiagnosticEngine
|
||||
|
||||
public init(bridged: BridgedDiagEngine) {
|
||||
public init(bridged: BridgedDiagnosticEngine) {
|
||||
self.bridged = bridged
|
||||
}
|
||||
public init?(bridged: BridgedOptionalDiagnosticEngine) {
|
||||
guard let object = bridged.object else {
|
||||
public init?(bridged: BridgedNullableDiagnosticEngine) {
|
||||
guard let raw = bridged.raw else {
|
||||
return nil
|
||||
}
|
||||
self.bridged = BridgedDiagEngine(object: object)
|
||||
self.bridged = BridgedDiagnosticEngine(raw: raw)
|
||||
}
|
||||
|
||||
public func diagnose(_ position: SourceLoc?,
|
||||
|
||||
@@ -46,7 +46,7 @@ private func _RegexLiteralLexingFn(
|
||||
_ curPtrPtr: UnsafeMutablePointer<UnsafePointer<CChar>>,
|
||||
_ bufferEndPtr: UnsafePointer<CChar>,
|
||||
_ mustBeRegex: CBool,
|
||||
_ bridgedDiagnosticEngine: BridgedOptionalDiagnosticEngine
|
||||
_ bridgedDiagnosticEngine: BridgedNullableDiagnosticEngine
|
||||
) -> /*CompletelyErroneous*/ CBool {
|
||||
let inputPtr = curPtrPtr.pointee
|
||||
|
||||
@@ -92,7 +92,7 @@ public func _RegexLiteralParsingFn(
|
||||
_ captureStructureOut: UnsafeMutableRawPointer,
|
||||
_ captureStructureSize: CUnsignedInt,
|
||||
_ bridgedDiagnosticBaseLoc: BridgedSourceLoc,
|
||||
_ bridgedDiagnosticEngine: BridgedDiagEngine
|
||||
_ bridgedDiagnosticEngine: BridgedDiagnosticEngine
|
||||
) -> Bool {
|
||||
let str = String(cString: inputPtr)
|
||||
let captureBuffer = UnsafeMutableRawBufferPointer(
|
||||
|
||||
Reference in New Issue
Block a user