This is an archive of the discontinued LLVM Phabricator instance.

PostfixExpression: move parser out of NativePDB internals
ClosedPublic

Authored by labath on Apr 23 2019, 5:11 AM.

Details

Summary

The postfix expressions in PDB and breakpad symbol files are similar
enough that they can be parsed by the same parser. This patch
generalizes the parser in the NativePDB plugin and moves it into the
PostfixExpression file created in the previous commit (r358976).

The generalization consists of treating any unrecognised token as a
"symbol" node (previously these would only be created for tokens
starting with "$", and other token would abort the parse). This is
needed because breakpad symbols can also contain ".cfa" tokens, which
refer to the frame's CFA.

The cosmetic changes include:

  • using a factory function instead of a class for creating nodes (this is more generic as it allows the same BumpPtrAllocator to be used for other things too)
  • using dedicated function for parsing operator tokens instead of a DenseMap (more efficient as we don't need to create the DenseMap every time).

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Apr 23 2019, 5:11 AM
aleksandr.urakov accepted this revision.Apr 23 2019, 9:38 AM

LGTM, thanks!

This revision is now accepted and ready to land.Apr 23 2019, 9:38 AM
amccarth accepted this revision.Apr 23 2019, 3:47 PM

Nice. Thanks for adding the test, too!

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 24 2019, 12:25 AM