@@ -2,12 +2,10 @@ mod function_type;
22mod name;
33mod type_reconstruction;
44
5- use binaryninja:: architecture:: CoreArchitecture ;
65use binaryninja:: binary_view:: BinaryView ;
7- use binaryninja:: demangle:: CustomDemangler ;
8- use binaryninja:: rc:: Ref ;
6+ use binaryninja:: demangle:: { CustomDemangler , DemanglerConfig , DemanglerResult } ;
97use binaryninja:: settings:: { QueryOptions , Settings } ;
10- use binaryninja:: types:: { QualifiedName , Type } ;
8+ use binaryninja:: types:: QualifiedName ;
119
1210fn should_extract_types ( view : Option < & BinaryView > ) -> bool {
1311 let mut opts = match view {
@@ -32,26 +30,27 @@ impl CustomDemangler for SwiftDemangler {
3230
3331 fn demangle (
3432 & self ,
35- arch : & CoreArchitecture ,
3633 name : & str ,
37- view : Option < Ref < BinaryView > > ,
38- _simplify : bool ,
39- ) -> Option < ( QualifiedName , Option < Ref < Type > > ) > {
34+ config : & DemanglerConfig ,
35+ ) -> Option < DemanglerResult > {
4036 let ctx = swift_demangler:: Context :: new ( ) ;
4137 let symbol = swift_demangler:: Symbol :: parse ( & ctx, name) ?;
4238
43- if should_extract_types ( view. as_deref ( ) ) {
44- let ty = function_type:: build_function_type ( & symbol, arch) ;
39+ if should_extract_types ( config. view . as_deref ( ) ) {
40+ let ty = config
41+ . platform
42+ . as_ref ( )
43+ . and_then ( |platform| function_type:: build_function_type ( & symbol, & platform. arch ( ) ) ) ;
4544 let qname = if ty. is_some ( ) {
4645 name:: build_short_name ( & symbol)
4746 } else {
4847 None
4948 }
5049 . unwrap_or_else ( || QualifiedName :: from ( symbol. display ( ) ) ) ;
51- Some ( ( qname, ty) )
50+ Some ( DemanglerResult :: new ( qname, ty) )
5251 } else {
5352 let qname = QualifiedName :: from ( symbol. display ( ) ) ;
54- Some ( ( qname, None ) )
53+ Some ( DemanglerResult :: new ( qname, None ) )
5554 }
5655 }
5756}
0 commit comments