xref: /llvm-project/clang-tools-extra/test/clang-reorder-fields/ClassSimpleCtor.cpp (revision bf3c84cff7fdd767bb8228bb0dfde3b385eedf04)
1*bf3c84cfSAlexander Shaposhnikov // RUN: clang-reorder-fields -record-name Foo -fields-order s1,x,z,s2 %s -- | FileCheck %s
2*bf3c84cfSAlexander Shaposhnikov 
3*bf3c84cfSAlexander Shaposhnikov class Foo {
4*bf3c84cfSAlexander Shaposhnikov public:
5*bf3c84cfSAlexander Shaposhnikov   Foo();
6*bf3c84cfSAlexander Shaposhnikov 
7*bf3c84cfSAlexander Shaposhnikov private:
8*bf3c84cfSAlexander Shaposhnikov   int x;              // CHECK:      {{^  const char \*s1;}}
9*bf3c84cfSAlexander Shaposhnikov   const char *s1;     // CHECK-NEXT: {{^  int x;}}
10*bf3c84cfSAlexander Shaposhnikov   const char *s2;     // CHECK-NEXT: {{^  double z;}}
11*bf3c84cfSAlexander Shaposhnikov   double z;           // CHECK-NEXT: {{^  const char \*s2;}}
12*bf3c84cfSAlexander Shaposhnikov };
13*bf3c84cfSAlexander Shaposhnikov 
Foo()14*bf3c84cfSAlexander Shaposhnikov Foo::Foo():
15*bf3c84cfSAlexander Shaposhnikov   x(12),      // CHECK:      {{^  s1\("abc"\),}}
16*bf3c84cfSAlexander Shaposhnikov   s1("abc"),  // CHECK-NEXT: {{^  x\(12\),}}
17*bf3c84cfSAlexander Shaposhnikov   s2("def"),  // CHECK-NEXT: {{^  z\(3.14\),}}
18*bf3c84cfSAlexander Shaposhnikov   z(3.14)     // CHECK-NEXT: {{^  s2\("def"\)}}
19*bf3c84cfSAlexander Shaposhnikov {}
20*bf3c84cfSAlexander Shaposhnikov 
main()21*bf3c84cfSAlexander Shaposhnikov int main() {
22*bf3c84cfSAlexander Shaposhnikov   Foo foo;
23*bf3c84cfSAlexander Shaposhnikov   return 0;
24*bf3c84cfSAlexander Shaposhnikov }
25