[all-commits] [llvm/llvm-project] 4d5079: [libcxxabi][ItaniumDemangle] Demangle explicitly n...

Michael Buch via All-commits all-commits at lists.llvm.org
Tue Nov 28 13:24:33 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4d5079c4dc0ce30ba36315a7c822255cd1eeb9fb
      https://github.com/llvm/llvm-project/commit/4d5079c4dc0ce30ba36315a7c822255cd1eeb9fb
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2023-11-28 (Tue, 28 Nov 2023)

  Changed paths:
    M libcxxabi/src/demangle/ItaniumDemangle.h
    M libcxxabi/src/demangle/ItaniumNodes.def
    M libcxxabi/test/test_demangle.pass.cpp
    M llvm/include/llvm/Demangle/ItaniumDemangle.h
    M llvm/include/llvm/Demangle/ItaniumNodes.def

  Log Message:
  -----------
  [libcxxabi][ItaniumDemangle] Demangle explicitly named object parameters (#72881)

The mangling for an explicitly named object was introduced in
https://reviews.llvm.org/D140828

See following discussion for why a new mangling had to be introduced:
https://github.com/itanium-cxx-abi/cxx-abi/issues/148

Since clang started emitting names with the new mangling, this patch
implements support for demangling such names.

The approach this patch takes is to add a new `ExplicitObjectParameter`
node that will print the first parameter of a function declaration with
a `this ` prefix, to reflect what was spelled out in source.

Example:
```
void MyClass::func(this MyClass const& self); // _ZNH7MyClass4funcERKS_
```
With this patch, the above demangles to:
```
_ZNH7MyClass4funcERKS_ -> MyClass::func(this MyClass const&)
```

Note that `func` is not marked as `const &`, since the
function-qualifiers are now encoded as part of the explicit `this`. C++
doesn't allow specifying the function-qualifiers in the presence of an
explicit object parameter, so this demangling is consistent with the
source spelling.




More information about the All-commits mailing list