This is an archive of the discontinued LLVM Phabricator instance.

[clang-format][NFC] Store FormatToken::Type as an enum instead of bitfield
ClosedPublic

Authored by arichardson on Sep 2 2020, 5:10 AM.

Details

Summary

This improves the debugging experience since LLDB will print the enumerator
name instead of a decimal number. This changes TokenType to have uint8_t
as the underlying type and moves it after the remaining bitfields to avoid
increasing the size of FormatToken.

Diff Detail

Event Timeline

arichardson created this revision.Sep 2 2020, 5:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 2 2020, 5:10 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
arichardson requested review of this revision.Sep 2 2020, 5:10 AM
  • remove unncessary cast+check

I'm not a C++ language lawyer so I'm not sure which standard introduce enum inheritance? (maybe its something we could always do?), if its a recent change we just need to ensure we are conforming to the C++ version that is needed to build clang.

Apart from that it looks good.

MyDeveloperDay accepted this revision.Sep 4 2020, 10:21 AM

Assuming it builds with minimum required c++ compiler

This revision is now accepted and ready to land.Sep 4 2020, 10:21 AM
This revision was landed with ongoing or failed builds.Oct 7 2020, 9:18 AM
This revision was automatically updated to reflect the committed changes.