This is an archive of the discontinued LLVM Phabricator instance.

Make ListScope and DictScope support empty labels
ClosedPublic

Authored by zturner on May 3 2016, 4:21 PM.

Details

Reviewers
rnk
Summary

You might want to label a scope with nothing at all, for example so that you can print out a list of records as:

{
   Field1,
   Field2
}
{
   FieldA,
   FieldB
}

This wasn't possible though, because a space was always being inserted after the label name, even if the label was empty. Rather than duplicate this ugly code in both ListScope and DictScope, I noticed that they were essentially identical except for the scope delimeters. So I made DelimitedScope<Open,Close> and then turned DictScope and ListScope into template aliases

Diff Detail

Event Timeline

zturner updated this revision to Diff 56077.May 3 2016, 4:21 PM
zturner retitled this revision from to Make ListScope and DictScope support empty labels.
zturner updated this object.
zturner added a reviewer: rnk.
zturner added a subscriber: llvm-commits.
rnk accepted this revision.May 3 2016, 4:51 PM
rnk edited edge metadata.

lgtm

This revision is now accepted and ready to land.May 3 2016, 4:51 PM
Eugene.Zelenko added a subscriber: Eugene.Zelenko.

Committed in r268472.