Clement Courbet 91285e26bf
[clang-reorder-fields] Handle macros fields declarations. (#118005)
Right now fields with macro declarations break the tool:

```

struct Foo {
  Mutex mu;
  int x GUARDED_BY(mu);
  int y;
};
```

reordered by mu,y,x yields:

```
struct Foo {
  Mutex mu;
  int y GUARDED_BY(mu);
  int x;
};
```
2024-11-29 08:36:22 +01:00

10 lines
271 B
C++

// RUN: clang-reorder-fields -record-name Foo -fields-order y,x %s -- | FileCheck %s
#define GUARDED_BY(x) __attribute__((guarded_by(x)))
class Foo {
int x GUARDED_BY(x); // CHECK: {{^ int y;}}
int y; // CHECK-NEXT: {{^ int x GUARDED_BY\(x\);}}
};