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