Skip to content

Commit df2e394

Browse files
committed
[clang-reorder-fields] Support designated initializers
Initializer lists with designators, missing elements or omitted braces can now be rewritten. Any missing designators are added and they get sorted according to the new order. ``` struct Foo { int a; int b; int c; }; struct Foo foo = { .a = 1, 2, 3 } ``` when reordering elements to "b,a,c" becomes: ``` struct Foo { int b; int a; int c; }; struct Foo foo = { .b = 2, .a = 1, .c = 3 } ```
1 parent 76bd5da commit df2e394

File tree

5 files changed

+667
-48
lines changed

5 files changed

+667
-48
lines changed

clang-tools-extra/clang-reorder-fields/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set(LLVM_LINK_COMPONENTS
44
)
55

66
add_clang_library(clangReorderFields STATIC
7+
utils/Designator.cpp
78
ReorderFieldsAction.cpp
89

910
DEPENDS

0 commit comments

Comments
 (0)