This is an archive of the discontinued LLVM Phabricator instance.

clang-format Test: Split BackwardCompatibility out of ParsesConfiguration
ClosedPublic

Authored by jeanphilippeD on Sep 14 2014, 1:04 AM.

Details

Reviewers
djasper
Summary

Add some missing test to ParsesConfiguration and ParsesConfigurationBools.
Make explicit the backward compatibility test following the example of SpaceBeforeParens.

Split ConstructorInitializerIndentWidth into BreakConstructorInitializersBeforeComma.
This should ease a possible extension of the supported style for the Initializers.

Updated lines were ran through clang-format.
Built debug 'FormatTest' with VS2013 express and ran the test.

Diff Detail

Event Timeline

jeanphilippeD retitled this revision from to clang-format Test: Split BackwardCompatibility out of ParsesConfiguration.
jeanphilippeD updated this object.
jeanphilippeD edited the test plan for this revision. (Show Details)
jeanphilippeD added a subscriber: Unknown Object (MLST).Sep 14 2014, 1:06 AM

I like breaking out the BreakConstructorInitializerBeforeComma tests and of course the missing tests, but I don't think it is a good idea to split out the backward-compatibility tests. I'd rather have all the tests for a single style flag in a single place.

Thank you for your feedback.

The following can only be added in ParsesConfigurationBools under DerivePointerAlignment if the CHECK_PARSE macro is moved above.

Style.DerivePointerAlignment = true;
CHECK_PARSE("DerivePointerBinding: false", DerivePointerAlignment, false);
CHECK_PARSE("DerivePointerBinding: true", DerivePointerAlignment, true);

In order to keep all the test for a single flag in the same place, would it be better define a second macro instead?CHECK_PARSE_BOOL_COMPATIBLE (or CHECK_PARSE_BOOL_LEGACY) defined and undefined with CHECK_PARSE_BOOL.

Would it also make sense to have a similar set of function for ParsesConfiguration?
CHECK_PARSE_ITEM and CHECK_PARSE to have:

Style.PointerAlignment = FormatStyle::PAS_Middle;
CHECK_PARSE_ITEM("Left", PointerAlignment, FormatStyle::PAS_Left);
CHECK_PARSE_ITEM("Right", PointerAlignment, FormatStyle::PAS_Right);
CHECK_PARSE_ITEM("Middle", PointerAlignment, FormatStyle::PAS_Middle);
// For backward compatibility:
CHECK_PARSE("PointerBindsToType: Left", PointerAlignment,
            FormatStyle::PAS_Left);
CHECK_PARSE("PointerBindsToType: Right", PointerAlignment,
            FormatStyle::PAS_Right);
CHECK_PARSE("PointerBindsToType: Middle", PointerAlignment,
            FormatStyle::PAS_Middle);

Since CHECK_PARSE is also used in ParsesConfigurationWithLanguages, I would avoid rename it to CHECK_PARSE_ITEM_COMPATIBLE.

I'll work on addressing the issue this evening.

jeanphilippeD updated this object.

Updated patch as per review comments: Keept backward compatible tests with their flag tests.
Rebased patch on top of snv:r217804 and merge.
Compile and run FormatTest.exe.

djasper accepted this revision.Sep 16 2014, 5:52 AM
djasper edited edge metadata.

Looks good. Do you have commit access or do you want me to submit this for you?

This revision is now accepted and ready to land.Sep 16 2014, 5:52 AM

This is my first patch, I do not have commit access, I would prefer if you
submit it for me.
Thank you very much.

2014-09-16 13:52 GMT+01:00 Daniel Jasper <djasper@google.com>:

Looks good. Do you have commit access or do you want me to submit this for
you?

http://reviews.llvm.org/D5346

djasper closed this revision.Sep 16 2014, 9:32 AM

Submitted as r217880. Thank you!