Page MenuHomePhabricator

Make FormatToken::Type private.
AcceptedPublic

Authored by klimek on Sep 10 2019, 9:07 AM.

Details

Reviewers
sammccall
Summary

This enables us to intercept changes to the token type via setType(), which
is a precondition for being able to use multi-pass formatting for macro
arguments.

Event Timeline

klimek created this revision.Sep 10 2019, 9:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 10 2019, 9:07 AM
sammccall accepted this revision.Sep 13 2019, 1:22 AM

This looks fine as it is, adding a side-effect to a function that's called setType and is called in lots of places may be hard to reason about.

You haven't mentioned how the interception will be used - if it's possible to express as a simple assignment an then some later operation, it might be clearer.

clang/lib/Format/FormatToken.h
185

Hooray for adding documentation! While here... ;-)

consider moving this documentation to the enum, and elaborating slightly on the relationship between TokenType and TokenKind

This revision is now accepted and ready to land.Sep 13 2019, 1:22 AM