[all-commits] [llvm/llvm-project] 889dad: [ItaniumDemangle] Add customizable printLeft/print...

Michael Buch via All-commits all-commits at lists.llvm.org
Thu Apr 17 13:53:53 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 889dad7f40932ea68c9e287e62441507f4f0f261
      https://github.com/llvm/llvm-project/commit/889dad7f40932ea68c9e287e62441507f4f0f261
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2025-04-17 (Thu, 17 Apr 2025)

  Changed paths:
    M libcxxabi/src/demangle/ItaniumDemangle.h
    M libcxxabi/src/demangle/Utility.h
    M llvm/include/llvm/Demangle/ItaniumDemangle.h
    M llvm/include/llvm/Demangle/Utility.h
    M llvm/unittests/Demangle/ItaniumDemangleTest.cpp
    M llvm/unittests/Demangle/OutputBufferTest.cpp

  Log Message:
  -----------
  [ItaniumDemangle] Add customizable printLeft/printRight APIs to OutputBuffer (#133249)

This patch includes the necessary changes for the LLDB feature proposed
in
https://discourse.llvm.org/t/rfc-lldb-highlighting-function-names-in-lldb-backtraces/85309.
The TL;DR is that we want to track where certain parts of a demangled
name begin/end so we can highlight them in backtraces.

We introduce a new `printLeft`/`printRight` API on `OutputBuffer` that a
client (in our case LLDB) can implement to track state while printing
the demangle tree. This requires redirecting all calls to to
`printLeft`/`printRight` to the `OutputBuffer`. One quirk with the new
API is that `Utility.h` would now depend on `ItaniumDemangle.h` and
vice-versa. To keep these files header-only I made the definitions
`inline` and implement the new APIs in `ItaniumDemangle.h` (so the
definition of `Node` is available to them).

Also introduces `notifyInsertion`/`notifyDeletion` APIs that a client can override to respond to cases where the `OutputBuffer` changes arbitrary parts of the name.



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