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