This is an archive of the discontinued LLVM Phabricator instance.

[demangler] Adjust unqualified name parsing

Authored by urnathan on Feb 7 2022, 9:32 AM.



The unqualified name grammar includes <ctor-dtor-name>, but we handle that specially in parseNestedName. This is a little awkward. We can pass in the current scope and have parseUnqualifiedName deal with cdtors too. That also allows a couple of other simplifications:

  1. parseUnqualifiedName can also build up the NestedName, when the provided scope is non-null. Which means ...
  1. parseUnscopedName can pass a "std" scope in (and tailcall).
  1. ... and also parseNestedName need not construct the nestedname itself.
  1. also parseNestedName's detection of a cdtor-name doesn't have to rule out a decomposition name anymore.

This change also makes adding module demangling more straight-forwards, btw.

Diff Detail

Event Timeline

urnathan requested review of this revision.Feb 7 2022, 9:32 AM
urnathan created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 7 2022, 9:32 AM
ChuanqiXu added inline comments.Feb 7 2022, 6:34 PM

The original version would try to consume 'L' all the way. Is this a intentional difference?

urnathan added inline comments.Feb 10 2022, 4:44 AM

Once we've reached an error condition (failing to create Std node), it doesn't matter what we leave unconsumed.

ChuanqiXu accepted this revision.Feb 10 2022, 5:52 PM
This revision is now accepted and ready to land.Feb 10 2022, 5:52 PM
This revision was landed with ongoing or failed builds.Feb 11 2022, 4:22 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 11 2022, 4:22 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript