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

Vladimir Vuksanovic via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 16 07:18:06 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;}}
----------------
vvuksanovic wrote:

Yes, good catch.

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


More information about the cfe-commits mailing list