MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / demangle_names

Function demangle_names

tools/wasm-sourcemap.py:251–272  ·  view source on GitHub ↗
(names)

Source from the content-addressed store, hash-verified

249
250
251def demangle_names(names):
252 # Only demangle names that look mangled
253 mangled_names = sorted({n for n in names if n.startswith('_Z')})
254 if not mangled_names:
255 return {}
256 if not os.path.exists(LLVM_CXXFILT):
257 logger.warning('llvm-cxxfilt does not exist')
258 return {}
259
260 # Gather all mangled names and call llvm-cxxfilt only once for all of them
261 input_str = '\n'.join(mangled_names)
262 proc = shared.check_call([LLVM_CXXFILT], input=input_str, stdout=shared.PIPE, stderr=shared.PIPE, text=True)
263 if proc.returncode != 0:
264 logger.warning('llvm-cxxfilt failed: %s' % proc.stderr)
265 return {}
266
267 demangled_list = proc.stdout.splitlines()
268 if len(demangled_list) != len(mangled_names):
269 logger.warning('llvm-cxxfilt output length mismatch')
270 return {}
271
272 return dict(zip(mangled_names, demangled_list, strict=True))
273
274
275class FuncRange:

Callers 1

extract_func_rangesFunction · 0.85

Calls 3

existsMethod · 0.80
warningMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected