[all-commits] [llvm/llvm-project] 54c9dd: [libcxxabi][ItaniumDemangle] Separate GtIsGt count...

Michael Buch via All-commits all-commits at lists.llvm.org
Thu Nov 6 23:52:25 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 54c9ddddd1da353b0303df1e86cf444c5363733d
      https://github.com/llvm/llvm-project/commit/54c9ddddd1da353b0303df1e86cf444c5363733d
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2025-11-07 (Fri, 07 Nov 2025)

  Changed paths:
    M libcxxabi/src/demangle/ItaniumDemangle.h
    M libcxxabi/src/demangle/Utility.h
    M lldb/source/Core/DemangledNameInfo.cpp
    M lldb/unittests/Core/MangledTest.cpp
    M llvm/include/llvm/Demangle/ItaniumDemangle.h
    M llvm/include/llvm/Demangle/Utility.h

  Log Message:
  -----------
  [libcxxabi][ItaniumDemangle] Separate GtIsGt counter into more states (#166578)

Currently `OutputBuffer::GtIsGt` is used to tell us if we're inside
template arguments and have printed a '(' without a closing ')'. If so,
we don't need to quote '<' when printing it as part of a binary
expression inside a template argument. Otherwise we need to. E.g.,
```
foo<a<(b < c)>> // Quotes around binary expression needed.
```

LLDB's `TrackingOutputBuffer` has heuristics that rely on checking
whether we are inside template arguments, regardless of the current
parentheses depth. We've been using `isGtInsideTemplateArgs` for this,
but that isn't correct. Resulting in us incorrectly tracking the
basename of function like:
```
void func<(foo::Enum)1>()
```
Here `GtIsGt > 0` despite us being inside template arguments (because we
incremented it when seeing '(').

This patch adds a `isInsideTemplateArgs` API which LLDB will use to more
accurately track parts of the demangled name.

To make sure this API doesn't go untested in the actual libcxxabi
test-suite, I changed the existing `GtIsGt` logic to use it. Also
renamed the various variables/APIs involved to make it (in my opinion)
more straightforward to understand what's going on. But happy to rename
it back if people disagree.

Also adjusted LLDB to use the newly introduced API (and added a
unit-test that would previously fail).



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