Browse Source

Shorten itanium_demangler module import name

nosoop 10 months ago
parent
commit
13afe01632
1 changed files with 7 additions and 7 deletions
  1. 7 7
      src/smgdc/vtable.py

+ 7 - 7
src/smgdc/vtable.py

@@ -8,7 +8,7 @@ import itertools
 import operator
 import typing
 
-import itanium_demangler
+import itanium_demangler as demangler
 from cle.backends.symbol import Symbol
 
 from . import demangler_helpers as dh
@@ -20,7 +20,7 @@ if typing.TYPE_CHECKING:
 VTable = list[Symbol]
 
 # hotfix for demangler
-itanium_demangler._is_ctor_or_dtor = itanium_demangler.is_ctor_or_dtor
+demangler._is_ctor_or_dtor = demangler.is_ctor_or_dtor
 
 
 def reorder_vfns_windows_estimate(symbols: list[Symbol], start_pos) -> list[Symbol]:
@@ -28,7 +28,7 @@ def reorder_vfns_windows_estimate(symbols: list[Symbol], start_pos) -> list[Symb
     name_buckets = collections.defaultdict(list)
     for n, symbol in enumerate(symbols):
         # collect overrides into buckets based on function name
-        dmsym = itanium_demangler.parse(symbol.name)
+        dmsym = demangler.parse(symbol.name)
         if dmsym:
             name_buckets[dh.extract_method_fname(dmsym)].append(symbol)
         else:
@@ -62,7 +62,7 @@ def get_windows_vtables_from(
     thunk_fns = set()
     for vt_other in vt_others:
         for sym in vt_other:
-            dmsym = itanium_demangler.parse(sym.name)
+            dmsym = demangler.parse(sym.name)
             if dmsym.kind == "nonvirt_thunk":
                 thunk_fns.add(dh.extract_method_signature(dmsym))
 
@@ -74,10 +74,10 @@ def get_windows_vtables_from(
 
         for sym in vt_first[vt_low:vt_high]:
             # filter MI thunks
-            dmsym = itanium_demangler.parse(sym.name)
+            dmsym = demangler.parse(sym.name)
             if dmsym:
                 if (
-                    not itanium_demangler.is_ctor_or_dtor(dmsym)
+                    not demangler.is_ctor_or_dtor(dmsym)
                     and dh.extract_method_signature(dmsym) in thunk_fns
                 ):
                     continue
@@ -128,7 +128,7 @@ def get_vtables_from_address(
                 function_list.append(VTableFunction(table_index, matched_overload))
                 continue
         # TODO: we need to resolve a symbol here; otherwise we can't correctly handle this
-        vt_name = itanium_demangler.parse(vt.name)
+        vt_name = demangler.parse(vt.name)
         candidate_names = set(sym.name for sym in fnsyms)
         raise Exception(f"Ambiguity in {vt_name} position {n}; candidates {candidate_names}")