File tree 3 files changed +74
-0
lines changed
3 files changed +74
-0
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ class Demangler {
88
88
void demangleImplPath (InType InType);
89
89
void demangleGenericArg ();
90
90
void demangleType ();
91
+ void demangleFnSig ();
91
92
void demangleConst ();
92
93
void demangleConstInt ();
93
94
void demangleConstBool ();
Original file line number Diff line number Diff line change @@ -472,13 +472,57 @@ void Demangler::demangleType() {
472
472
print (" *mut " );
473
473
demangleType ();
474
474
break ;
475
+ case ' F' :
476
+ demangleFnSig ();
477
+ break ;
475
478
default :
476
479
Position = Start;
477
480
demanglePath (rust_demangle::InType::Yes);
478
481
break ;
479
482
}
480
483
}
481
484
485
+ // <fn-sig> := [<binder>] ["U"] ["K" <abi>] {<type>} "E" <type>
486
+ // <abi> = "C"
487
+ // | <undisambiguated-identifier>
488
+ void Demangler::demangleFnSig () {
489
+ // FIXME demangle binder.
490
+
491
+ if (consumeIf (' U' ))
492
+ print (" unsafe " );
493
+
494
+ if (consumeIf (' K' )) {
495
+ print (" extern \" " );
496
+ if (consumeIf (' C' )) {
497
+ print (" C" );
498
+ } else {
499
+ Identifier Ident = parseIdentifier ();
500
+ for (char C : Ident.Name ) {
501
+ // When mangling ABI string, the "-" is replaced with "_".
502
+ if (C == ' _' )
503
+ C = ' -' ;
504
+ print (C);
505
+ }
506
+ }
507
+ print (" \" " );
508
+ }
509
+
510
+ print (" fn(" );
511
+ for (size_t I = 0 ; !Error && !consumeIf (' E' ); ++I) {
512
+ if (I > 0 )
513
+ print (" , " );
514
+ demangleType ();
515
+ }
516
+ print (" )" );
517
+
518
+ if (consumeIf (' u' )) {
519
+ // Skip the unit type from the output.
520
+ } else {
521
+ print (" -> " );
522
+ demangleType ();
523
+ }
524
+ }
525
+
482
526
// <const> = <basic-type> <const-data>
483
527
// | "p" // placeholder
484
528
// | <backref>
Original file line number Diff line number Diff line change @@ -187,6 +187,35 @@ CHECK: types::<*const _>
187
187
CHECK: types::<*mut _>
188
188
_RIC5typesOpE
189
189
190
+ ; Function signatures
191
+
192
+ CHECK: function::<fn()>
193
+ _RIC8functionFEuE
194
+
195
+ CHECK: function::<fn() -> _>
196
+ _RIC8functionFEpE
197
+
198
+ CHECK: function::<fn(_)>
199
+ _RIC8functionFpEuE
200
+
201
+ CHECK: function::<fn(_, _)>
202
+ _RIC8functionFppEuE
203
+
204
+ CHECK: function::<fn(_, _, _)>
205
+ _RIC8functionFpppEuE
206
+
207
+ CHECK: function::<unsafe fn()>
208
+ _RIC8functionFUEuE
209
+
210
+ CHECK: function::<extern "C" fn()>
211
+ _RIC8functionFKCEuE
212
+
213
+ CHECK: function::<extern "cdecl" fn()>
214
+ _RIC8functionFK5cdeclEuE
215
+
216
+ CHECK: function::<unsafe extern "C-cmse-nonsecure-call" fn()>
217
+ _RIC8functionFUK21C_cmse_nonsecure_callEuE
218
+
190
219
; Integer constants. Test value demangling.
191
220
192
221
CHECK: integer::<0>
You can’t perform that action at this time.
0 commit comments