[PATCH] clang-format Test: Split BackwardCompatibility out of ParsesConfiguration

Jean-Philippe Dufraigne j.dufraigne at gmail.com
Mon Sep 15 05:36:52 PDT 2014


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.

http://reviews.llvm.org/D5346






More information about the cfe-commits mailing list