This is an archive of the discontinued LLVM Phabricator instance.

[MS Demangler] Properly handle backreferences of special names
ClosedPublic

Authored by zturner on Aug 7 2018, 9:36 AM.

Details

Summary
Function template names are not stored in the backref table,
but non-template function names are.  The general pattern seems
to be that when you are demangling a symbol name, if the name
starts with '?' it does not go into the backreference table,
otherwise it does.  Note that this even handles the general case
of operator names (template or otherwise) not going into the
back-reference table, anonymous namespaces not going into the
backreference table, and perhaps other yet-to-be-supported kinds
of names.

It's important that we apply this check only for the
*unqualified* portion of a name, and only for *symbol* names.
For example, this does not apply to type names (such as class
templates) and we need to make sure that these still do go
into the backref table.

There is still one remaining backreference test failure, and
although the failure is likely related, this code is complex enough
that I'd rather address it separately.

Diff Detail

Event Timeline

zturner created this revision.Aug 7 2018, 9:36 AM
majnemer accepted this revision.Aug 7 2018, 10:33 AM

LGTM

llvm/lib/Demangle/MicrosoftDemangle.cpp
1416

(NBB & NBB_Simple) == 0 isn't too many more characters and looks less weird.

This revision is now accepted and ready to land.Aug 7 2018, 10:33 AM
majnemer added inline comments.Aug 7 2018, 10:33 AM
llvm/lib/Demangle/MicrosoftDemangle.cpp
1416

Er, that should be (NBB & NBB_Simple) != 0

This revision was automatically updated to reflect the committed changes.