llvm-project/clang-tools-extra/test/clang-reorder-fields/ClassDifferentFieldsAccesses.cpp
Alexander Shaposhnikov bf3c84cff7 Add clang-reorder-fields to clang-tools-extra
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
2016-09-02 02:56:07 +00:00

17 lines
322 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;}}
private:
int y; // CHECK: {{^ int y;}}
int z; // CHECK-NEXT: {{^ int z;}}
};
int main() {
Foo foo;
return 0;
}