[clang-format][NFCish] Alphabetical sort Format.(h|pp)

I've:
- Sorted the members of FormatStyle alphabetical. The enums and structs
  are kept close to the member.
- Sorted the yaml io functions, based on the type they operate on.
- Sorted the initializers in getLLVMStyle(), except that penalities are
  kept at the end.
- Sorted the io of FormatStyle, this changes the --dump-config behavior.
- Moved the deprecated options into the only input case, this also
  changes --dump-config, it does not put the not directly used options
  in the .clang-format anymore.
- Sorted the comparisons in operator==.
- Added WhiteSpaceMacros in operator==, I've not actively looked if all
  other members are compared.
- This showed flawed tests (or in my opinion a flawed io operation, but
  that is another discussion and change).

Differential Revision: https://reviews.llvm.org/D137409
This commit is contained in:
Björn Schäpers 2022-11-04 12:38:06 +01:00
parent 2e30d326de
commit 41a09a07ce
4 changed files with 1165 additions and 1169 deletions

View File

@ -3583,8 +3583,7 @@ the configuration (without a prefix: ``Auto``).
(counted relative to leading non-whitespace column). (counted relative to leading non-whitespace column).
**PenaltyReturnTypeOnItsOwnLine** (``Unsigned``) :versionbadge:`clang-format 3.7` **PenaltyReturnTypeOnItsOwnLine** (``Unsigned``) :versionbadge:`clang-format 3.7`
Penalty for putting the return type of a function onto its own Penalty for putting the return type of a function onto its own line.
line.
**PointerAlignment** (``PointerAlignmentStyle``) :versionbadge:`clang-format 3.7` **PointerAlignment** (``PointerAlignmentStyle``) :versionbadge:`clang-format 3.7`
Pointer and reference alignment style. Pointer and reference alignment style.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -23320,7 +23320,10 @@ TEST(FormatStyle, GetStyleOfFile) {
llvm::MemoryBuffer::getMemBuffer( llvm::MemoryBuffer::getMemBuffer(
"BasedOnStyle: InheritParentConfig\n" "BasedOnStyle: InheritParentConfig\n"
"WhitespaceSensitiveMacros: ['FOO', 'BAR']"))); "WhitespaceSensitiveMacros: ['FOO', 'BAR']")));
std::vector<std::string> NonDefaultWhiteSpaceMacros{"FOO", "BAR"}; std::vector<std::string> NonDefaultWhiteSpaceMacros =
Style9->WhitespaceSensitiveMacros;
NonDefaultWhiteSpaceMacros[0] = "FOO";
NonDefaultWhiteSpaceMacros[1] = "BAR";
ASSERT_NE(Style9->WhitespaceSensitiveMacros, NonDefaultWhiteSpaceMacros); ASSERT_NE(Style9->WhitespaceSensitiveMacros, NonDefaultWhiteSpaceMacros);
Style9 = getStyle("file", "/e/sub/sub/code.cpp", "none", "", &FS); Style9 = getStyle("file", "/e/sub/sub/code.cpp", "none", "", &FS);
@ -23376,8 +23379,8 @@ TEST(FormatStyle, GetStyleOfFile) {
ASSERT_EQ(*Style9, SubSubStyle); ASSERT_EQ(*Style9, SubSubStyle);
// Test 9.6: use command line style with inheritance // Test 9.6: use command line style with inheritance
Style9 = getStyle("{BasedOnStyle: InheritParentConfig}", "/e/sub/code.cpp", Style9 = getStyle("{BasedOnStyle: InheritParentConfig}",
"none", "", &FS); "/e/sub/sub/code.cpp", "none", "", &FS);
ASSERT_TRUE(static_cast<bool>(Style9)); ASSERT_TRUE(static_cast<bool>(Style9));
ASSERT_EQ(*Style9, SubSubStyle); ASSERT_EQ(*Style9, SubSubStyle);