[all-commits] [llvm/llvm-project] 0b554d: [llvm-cxxfilt][macOS] Don't strip underscores on m...

Michael Buch via All-commits all-commits at lists.llvm.org
Wed Aug 28 00:15:03 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0b554dd9b1932c76225afded64d5f4cc7bb2933f
      https://github.com/llvm/llvm-project/commit/0b554dd9b1932c76225afded64d5f4cc7bb2933f
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2024-08-28 (Wed, 28 Aug 2024)

  Changed paths:
    M llvm/lib/Demangle/Demangle.cpp
    M llvm/test/tools/llvm-cxxfilt/invalid.test
    R llvm/test/tools/llvm-cxxfilt/strip-underscore-default-darwin.test
    R llvm/test/tools/llvm-cxxfilt/strip-underscore-default.test
    M llvm/test/tools/llvm-cxxfilt/strip-underscore.test
    M llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp

  Log Message:
  -----------
  [llvm-cxxfilt][macOS] Don't strip underscores on macOS by default (#106233)

Currently, `llvm-cxxfilt` will strip the leading underscore of its input
on macOS. Historically MachO symbols were prefixed with an extra
underscore and this is why this default exists. However, nowadays, the
`ItaniumDemangler` supports all of the following mangling prefixes:
`_Z`, `__Z`, `___Z`, `____Z`. So really `llvm-cxxfilt` can simply
forward the mangled name to the demangler and let the library decide
whether it's a valid encoding.

Compiling C++ on macOS nowadays will generate symbols with `_Z` and
`___Z` prefixes. So users trying to demangle these symbols will have to
know that they need to add the `-n` prefix. This routinely catches
people off-guard.

This patch removes the `-n` default for macOS and allows calling into
the `ItaniumDemangler` with all the `_Z` prefixes that the demangler
supports (1-4 underscores).

rdar://132714940



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list