Skip to content

clang-reorder-fields mishandles macros #52632

Closed
@tavianator

Description

@tavianator

When macros are used in an initializer, clang-reorder-fields edits the macros themselves instead of reordering their uses. Example:

$ cat foo.c
struct foo {
  int bar;
  int baz;
};

#define BAR 0
#define BAZ 1

struct foo global = {
  BAR,
  BAZ,
};
$ clang-reorder-fields --record-name=foo --fields-order=baz,bar foo.c --
struct foo {
  int baz;
  int bar;
};

#define BAR BAZ
#define BAZ BAR

struct foo global = {
  BAR,
  BAZ,
};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions