summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-reorder-fields/PlainCStructFieldsOrder.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/test/clang-reorder-fields/PlainCStructFieldsOrder.c')
-rw-r--r--clang-tools-extra/test/clang-reorder-fields/PlainCStructFieldsOrder.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-reorder-fields/PlainCStructFieldsOrder.c b/clang-tools-extra/test/clang-reorder-fields/PlainCStructFieldsOrder.c
new file mode 100644
index 00000000000..5b4fe9e654e
--- /dev/null
+++ b/clang-tools-extra/test/clang-reorder-fields/PlainCStructFieldsOrder.c
@@ -0,0 +1,14 @@
+// RUN: clang-reorder-fields -record-name Foo -fields-order z,w,y,x %s -- | FileCheck %s
+
+struct Foo {
+ const int* x; // CHECK: {{^ double z;}}
+ int y; // CHECK-NEXT: {{^ int w;}}
+ double z; // CHECK-NEXT: {{^ int y;}}
+ int w; // CHECK-NEXT: {{^ const int\* x}}
+};
+
+int main() {
+ const int x = 13;
+ struct Foo foo = { &x, 0, 1.29, 17 }; // CHECK: {{^ struct Foo foo = { 1.29, 17, 0, &x };}}
+ return 0;
+}
OpenPOWER on IntegriCloud