
Add checks to prevent rewriting when doing so might result in incorrect code. The following cases are checked: - There are multiple field declarations in one statement like `int a, b` - Multiple fields are created from a single macro expansion - Preprocessor directives are present in the struct
16 lines
305 B
C++
16 lines
305 B
C++
// RUN: clang-reorder-fields -record-name ::bar::Foo -fields-order y,x %s -- | FileCheck %s
|
|
|
|
namespace bar {
|
|
|
|
#define DEFINE_FOO
|
|
|
|
// This is okay to reorder.
|
|
#ifdef DEFINE_FOO
|
|
struct Foo {
|
|
int x; // CHECK: {{^ int y;}}
|
|
int y; // CHECK-NEXT: {{^ int x;}}
|
|
};
|
|
#endif
|
|
|
|
} // end namespace bar
|