File tree Expand file tree Collapse file tree 5 files changed +19
-17
lines changed
SwiftCompilerSources/Sources Expand file tree Collapse file tree 5 files changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -50,12 +50,12 @@ public struct DiagnosticFixIt {
5050 self . text = text
5151 }
5252
53- func withBridgedDiagnosticFixIt( _ fn: ( BridgedDiagnosticFixIt ) -> Void ) {
53+ func withBridgedDiagnosticFixIt( _ fn: ( swift . DiagnosticInfo . FixIt ) -> Void ) {
5454 text. withBridgedStringRef { bridgedTextRef in
55- let bridgedDiagnosticFixIt = BridgedDiagnosticFixIt (
56- start: start . bridged,
57- byteLength : byteLength ,
58- text : bridgedTextRef )
55+ let bridgedDiagnosticFixIt = swift . DiagnosticInfo . FixIt (
56+ swift . CharSourceRange ( start. bridged, UInt32 ( byteLength ) ) ,
57+ llvm . StringRef ( bridgedTextRef ) ,
58+ llvm . ArrayRef < swift . DiagnosticArgument > ( ) )
5959 fn ( bridgedDiagnosticFixIt)
6060 }
6161 }
@@ -83,7 +83,7 @@ public struct DiagnosticEngine {
8383 let bridgedSourceLoc : swift . SourceLoc = position. bridged
8484 let bridgedHighlightRange : swift . CharSourceRange = highlight. bridged
8585 var bridgedArgs : [ BridgedDiagnosticArgument ] = [ ]
86- var bridgedFixIts : [ BridgedDiagnosticFixIt ] = [ ]
86+ var bridgedFixIts : [ swift . DiagnosticInfo . FixIt ] = [ ]
8787
8888 // Build a higher-order function to wrap every 'withBridgedXXX { ... }'
8989 // calls, so we don't escape anything from the closure. 'bridgedArgs' and
Original file line number Diff line number Diff line change @@ -48,6 +48,12 @@ extension BridgedStringRef {
4848 }
4949}
5050
51+ extension llvm . StringRef {
52+ public init ( _ bridged: BridgedStringRef ) {
53+ self . init ( bridged. data, bridged. length)
54+ }
55+ }
56+
5157extension String {
5258 public func withBridgedStringRef< T> ( _ c: ( BridgedStringRef ) -> T ) -> T {
5359 var str = self
Original file line number Diff line number Diff line change @@ -51,12 +51,6 @@ typedef struct {
5151 } value ;
5252} BridgedDiagnosticArgument ;
5353
54- typedef struct {
55- swift ::SourceLoc start ;
56- SwiftInt byteLength ;
57- BridgedStringRef text ;
58- } BridgedDiagnosticFixIt ;
59-
6054typedef struct {
6155 void * _Nonnull object ;
6256} BridgedDiagnosticEngine ;
Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ module BasicBridging {
66
77module ASTBridging {
88 header "AST/ASTBridging.h"
9+ header "AST/DiagnosticEngine.h"
10+ header "AST/DiagnosticConsumer.h"
11+ requires cplusplus
912 export *
1013}
1114
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ void DiagnosticEngine_diagnose(
4242 BridgedDiagID bridgedDiagID,
4343 BridgedArrayRef /* BridgedDiagnosticArgument*/ bridgedArguments,
4444 CharSourceRange highlight,
45- BridgedArrayRef /* BridgedDiagnosticFixIt */ bridgedFixIts) {
45+ BridgedArrayRef /* DiagnosticInfo::FixIt */ bridgedFixIts) {
4646 auto *D = getDiagnosticEngine (bridgedEngine);
4747
4848 auto diagID = static_cast <DiagID>(bridgedDiagID);
@@ -59,10 +59,9 @@ void DiagnosticEngine_diagnose(
5959 }
6060
6161 // Add fix-its.
62- for (auto bridgedFixIt : getArrayRef<BridgedDiagnosticFixIt>(bridgedFixIts)) {
63- auto range = CharSourceRange (bridgedFixIt.start ,
64- bridgedFixIt.byteLength );
65- auto text = getStringRef (bridgedFixIt.text );
62+ for (auto bridgedFixIt : getArrayRef<DiagnosticInfo::FixIt>(bridgedFixIts)) {
63+ auto range = bridgedFixIt.getRange ();
64+ auto text = bridgedFixIt.getText ();
6665 inflight.fixItReplaceChars (range.getStart (), range.getEnd (), text);
6766 }
6867}
You can’t perform that action at this time.
0 commit comments