xref: /llvm-project/clang-tools-extra/test/clang-reorder-fields/CStructFieldsOrder.cpp (revision bf3c84cff7fdd767bb8228bb0dfde3b385eedf04)
1*bf3c84cfSAlexander Shaposhnikov // RUN: clang-reorder-fields -record-name ::bar::Foo -fields-order z,w,y,x %s -- | FileCheck %s
2*bf3c84cfSAlexander Shaposhnikov 
3*bf3c84cfSAlexander Shaposhnikov namespace bar {
4*bf3c84cfSAlexander Shaposhnikov struct Foo {
5*bf3c84cfSAlexander Shaposhnikov   const int* x; // CHECK:      {{^  double z;}}
6*bf3c84cfSAlexander Shaposhnikov   int y;        // CHECK-NEXT: {{^  int w;}}
7*bf3c84cfSAlexander Shaposhnikov   double z;     // CHECK-NEXT: {{^  int y;}}
8*bf3c84cfSAlexander Shaposhnikov   int w;        // CHECK-NEXT: {{^  const int\* x}}
9*bf3c84cfSAlexander Shaposhnikov };
10*bf3c84cfSAlexander Shaposhnikov } // end namespace bar
11*bf3c84cfSAlexander Shaposhnikov 
main()12*bf3c84cfSAlexander Shaposhnikov int main() {
13*bf3c84cfSAlexander Shaposhnikov   const int x = 13;
14*bf3c84cfSAlexander Shaposhnikov   bar::Foo foo = { &x, 0, 1.29, 17 }; // CHECK: {{^  bar::Foo foo = { 1.29, 17, 0, &x };}}
15*bf3c84cfSAlexander Shaposhnikov   return 0;
16*bf3c84cfSAlexander Shaposhnikov }
17