[clang-tools-extra] [clang-reorder-fields] Prevent rewriting unsupported cases (PR #142149)

Clement Courbet via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 13 07:53:11 PDT 2025


================
@@ -0,0 +1,15 @@
+// RUN: clang-reorder-fields -record-name ::bar::Foo -fields-order y,x %s -- | FileCheck %s
+
+namespace bar {
+
+#define DEFINE_FIELDS
+
+// This is okay to reorder.
+struct Foo {
+#ifdef DEFINE_FIELDS // CHECK:      {{^#ifdef DEFINE_FIELDS}}
+  int y;             // CHECK-NEXT: {{^ int y;}}
----------------
legrosbuffle wrote:

should this be:

```
int x;
int y;
```

In the original file ?

https://github.com/llvm/llvm-project/pull/142149


More information about the cfe-commits mailing list