This is an archive of the discontinued LLVM Phabricator instance.

Make FormatToken::Type private.
ClosedPublic

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

Details

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.

Diff Detail

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
197–200

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
klimek updated this revision to Diff 263712.May 13 2020, 7:24 AM

Update docs.

klimek closed this revision.May 13 2020, 7:41 AM
klimek marked an inline comment as done.
Harbormaster completed remote builds in B56588: Diff 263707.