This is an archive of the discontinued LLVM Phabricator instance.

[demangler] Reorder parseNestedName loop
ClosedPublic

Authored by urnathan on Feb 11 2022, 4:59 AM.

Details

Reviewers
bruno
ChuanqiXu
iains
Group Reviewers
Restricted Project
Commits
rG6244730e29f6: [demangler] Reorder parseNestedName loop
Summary

parseNestedName's main loop allowed parsing a grammar that was more flexible than the actual grammar. This refactors that to rule out some more incorrect manglings.

  1. The 'L' extension only applies to unqualified-name components, so check it just there.
  1. The 'M' suffix is, AFAICT, removed from the grammar. Rather than eliminate it, let's parse it after we've parsed a component.

Added some additional bad mangling tests, which are now rejected.

I don't break the 'T' and 'D[tT]' cases out of the loop, even though they can only appear at first position, as it seems simpler to just check there is nothing SoFar.

Diff Detail

Event Timeline

urnathan requested review of this revision.Feb 11 2022, 4:59 AM
urnathan created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 11 2022, 4:59 AM
ChuanqiXu accepted this revision.Feb 15 2022, 7:23 PM

Given the background knowledge in the summary is correct, I've checked the implementation is consistent with the description in the summary.

This revision is now accepted and ready to land.Feb 15 2022, 7:23 PM
This revision was landed with ongoing or failed builds.Feb 16 2022, 4:31 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2022, 4:32 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript