@@ -241,14 +241,11 @@ public func addQueuedSourceFile(
241241public  func  addQueuedDiagnostic( 
242242  queuedDiagnosticsPtr:  UnsafeMutableRawPointer , 
243243  perFrontendDiagnosticStatePtr:  UnsafeMutableRawPointer , 
244-   text:  UnsafePointer < UInt8 > , 
245-   textLength:  Int , 
244+   text:  BridgedStringRef , 
246245  severity:  BridgedDiagnosticSeverity , 
247246  cLoc:  BridgedSourceLoc , 
248-   categoryName:  UnsafePointer < UInt8 > ? , 
249-   categoryLength:  Int , 
250-   documentationPath:  UnsafePointer < UInt8 > ? , 
251-   documentationPathLength:  Int , 
247+   categoryName:  BridgedStringRef , 
248+   documentationPath:  BridgedStringRef , 
252249  highlightRangesPtr:  UnsafePointer < BridgedSourceLoc > ? , 
253250  numHighlightRanges:  Int 
254251)  { 
@@ -349,10 +346,10 @@ public func addQueuedDiagnostic(
349346    } 
350347  } 
351348
352-   let  category :  DiagnosticCategory ?   =  categoryName. flatMap  {  categoryNamePtr in 
349+   let  category :  DiagnosticCategory ?   =  categoryName. data . flatMap  {  categoryNamePtr in 
353350    let  categoryNameBuffer  =  UnsafeBufferPointer ( 
354351      start:  categoryNamePtr, 
355-       count:  categoryLength 
352+       count:  categoryName . count 
356353    ) 
357354    let  categoryName  =  String ( decoding:  categoryNameBuffer,  as:  UTF8 . self) 
358355
@@ -363,10 +360,10 @@ public func addQueuedDiagnostic(
363360      return  nil 
364361    } 
365362
366-     let  documentationURL  =  documentationPath. map  {  documentationPathPtr in 
363+     let  documentationURL  =  documentationPath. data . map  {  documentationPathPtr in 
367364      let  documentationPathBuffer  =  UnsafeBufferPointer ( 
368365        start:  documentationPathPtr, 
369-         count:  documentationPathLength 
366+         count:  documentationPath . count 
370367      ) 
371368
372369      let  documentationPath  =  String ( decoding:  documentationPathBuffer,  as:  UTF8 . self) 
@@ -390,7 +387,11 @@ public func addQueuedDiagnostic(
390387    diagnosticState. pointee. referencedCategories. insert ( category) 
391388  } 
392389
393-   let  textBuffer  =  UnsafeBufferPointer ( start:  text,  count:  textLength) 
390+   guard  let  textPtr =  text. data,  !text. isEmpty else  { 
391+     return 
392+   } 
393+   
394+   let  textBuffer  =  UnsafeBufferPointer ( start:  textPtr,  count:  text. count) 
394395  let  diagnostic  =  Diagnostic ( 
395396    node:  node, 
396397    position:  position, 
0 commit comments