[lldb-dev] LLDB Demangling

Pavel Labath via lldb-dev lldb-dev at lists.llvm.org
Thu Jul 26 03:01:45 PDT 2018

On Wed, 25 Jul 2018 at 19:15, Stefan Gränitz <stefan.graenitz at gmail.com> wrote:
> > right now the Symtab class builds a table containing all
> > demangled names. This is mostly unnecessary, and
> What exact table are you referring to here? The m_name_to_index map does
> store both, demangled and mangled strings. Not sure to what extend the
> demangled ones are necessary. It's a little hard to judge, but I can try
> and check. Or do you mean a different one?

Yes, that's the table I meant. You might also be interested in this
lldb-dev thread from May, which discussed a similar table in
SymbolFileDWARF and a couple of my commits from around that time
(which removed it).

> There is one more follow-up task here: Now that FastDemangle isn't used
> anymore in Mangled::GetDemangledName(), its last remaining usage is
> SubsPrimitiveParmItanium() in CPlusPlusLanguage.cpp. I will try to
> figure out if we still need it or if we can switch it to the IPD too.
> Then we could consider to get rid of FastMangle altogether.
> Any objections here?

The SubsPrimitiveParmItanium function has bugged me too. It does some
questionable manipulations of the mangled names, and it would be nice
to get rid of it. However, I have no idea how critical that
functionality is, nor I was able to find a reason for its existence
via a quick history search.

> With both demangle implementations, the old one and IPD, annotations
> cause demangling to fail/return empty name. I assume this branch has its
> right to exist and I would just keep it, but it would also be great to
> find an explanation and a repro to cover it.

I am going to assume you've already figured what the "linker
annotations" are in general (if not let me know). It looks to me like
this could be triggered if the symtab contained a name with linker
annotations, but the name itself was *not* mangled (e.g. something
like puts at GLIBC_2.5). In that case, it seems like the
Mangled::GetMangledName should return nothing, and the actual name
should be in Mangled::GetDemangledName. Have you tried something like


More information about the lldb-dev mailing list