This is an archive of the discontinued LLVM Phabricator instance.

[Asm] Refactor debug printing of AsmToken
ClosedPublic

Authored by olista01 on Mar 1 2018, 3:45 AM.

Details

Summary
  • Move printing from llvm-mc to the AsmToken class, so that it can be used elsewhere.
  • Add 5 cases which were missed: BigNum, Comment, HashDirective, Space and BackSlash, and remove the default case so that -Wswitch will catch this error in future.

This is almost NFC, except for the fact that llvm-mc can now print those 5 tokens in -as-lex mode.

Diff Detail

Repository
rL LLVM

Event Timeline

olista01 created this revision.Mar 1 2018, 3:45 AM
SjoerdMeijer accepted this revision.Mar 6 2018, 5:36 AM

Looks like a sensible change to me.

lib/MC/MCParser/MCAsmLexer.cpp
99 ↗(On Diff #136492)

Nit: I see this code is copy-pasted here, but I was wondering why from this
case the style is different, i.e. single line vs. multiple lines.

This revision is now accepted and ready to land.Mar 6 2018, 5:36 AM
olista01 added inline comments.Mar 6 2018, 5:46 AM
lib/MC/MCParser/MCAsmLexer.cpp
99 ↗(On Diff #136492)

I assume that this was done because a lot of these are too long to keep the alignment with the ones above. I'll re-format this in a more consistent way before committing.

This revision was automatically updated to reflect the committed changes.