
This diff adds v0 of clang-reorder-fields tool to clang/tools/extra. The main idea behind this tool is to simplify and make less error-prone refactoring of large codebases when someone needs to change the order fields of a struct/class (for example to remove excessive padding). Differential revision: https://reviews.llvm.org/D23279 llvm-svn: 280456
15 lines
360 B
C++
15 lines
360 B
C++
// RUN: clang-reorder-fields -record-name Foo -fields-order z,y,x %s -- | FileCheck %s
|
|
|
|
// The order of fields should not change.
|
|
class Foo {
|
|
public:
|
|
int x; // CHECK: {{^ int x;}}
|
|
int y; // CHECK-NEXT: {{^ int y;}}
|
|
int z; // CHECK-NEXT: {{^ int z;}}
|
|
};
|
|
|
|
int main() {
|
|
Foo foo = { 0, 1 }; // CHECK: {{^ Foo foo = { 0, 1 };}}
|
|
return 0;
|
|
}
|