[libcxxabi] [llvm] [ItaniumDemangle] Add customizable printLeft/printRight APIs to OutputBuffer (PR #133249)

Michael Buch via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 15 01:44:03 PDT 2025


Michael137 wrote:

> Looks good.
> 
> However: for your use case, I think you'll likely also need to add a couple more hooks to `OutputBuffer` in order to properly track the locations of parts of the demangled name. Specifically:
> 
> * For `prepend` and `insert`, some virtual function call to indicate that an insertion has happened in the buffer (eg, specifying the insertion position and size).
> * For `setCurrentPosition`, some virtual function call to indicate that an erase is about to happen in the buffer (eg, specifying the position and size) -- right now the only kind of erase we perform here is a truncation, but it may be a bit more future-proof for the extension mechanism to support an arbitrary erase.
> 
> If you don't handle those, any locations that you are tracking on the lldb side may be wrong when they happen.

Makes sense! Yea looks like insert/prepend are only used for D and Rust, but I'll add a hook for future-proofing. `setCurrentPosition` seems like it could already break our LLDB tracking when parameter packs are involved. I'll try to test this

https://github.com/llvm/llvm-project/pull/133249


More information about the llvm-commits mailing list