15 lines · c
1// RUN: clang-reorder-fields -record-name Foo -fields-order y,x %s -- | FileCheck %s2 3struct Foo {4 int x; // CHECK: {{^ int y;}}5 int y; // CHECK-NEXT: {{^ int x;}}6};7 8int main() {9 // The idiomatic zero initializer should remain the same.10 struct Foo foo0 = { 0 }; // CHECK: {{^ struct Foo foo0 = { 0 };}}11 struct Foo foo1 = { 1 }; // CHECK: {{^ struct Foo foo1 = { .x = 1 };}}12 13 return 0;14}15