aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/test/clang-reorder-fields/IdiomaticZeroInitializer.c
blob: 59c12e81afc0a50a19f8986759d37a60e36fcc5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// RUN: clang-reorder-fields -record-name Foo -fields-order y,x %s -- | FileCheck %s

struct Foo {
  int x;  // CHECK:      {{^  int y;}}
  int y;  // CHECK-NEXT: {{^  int x;}}
};

int main() {
  // The idiomatic zero initializer should remain the same.
  struct Foo foo0 = { 0 }; // CHECK: {{^ struct Foo foo0 = { 0 };}}
  struct Foo foo1 = { 1 }; // CHECK: {{^ struct Foo foo1 = { .x = 1 };}}

  return 0;
}