Issue 52828
Summary clang-tidy fix eliminates macro uses when the issue is in the macro (readability-else-after-return)
Labels clang-tidy
Assignees
Reporter joker-eph
    ```c++
#define CASE(x) \
  if (x) \
    return 1; \
  else \
    return 2; \


bool foo(bool x) {
  CASE(x);
}
```

After running `$ clang-tidy /tmp/tidy.cpp --checks=readability-else-after-return -fix`

```
/tmp/tidy.cpp:9:3: warning: do not use 'else' after 'return' [readability-else-after-return]
  CASE(x);
  ^~~~
/tmp/tidy.cpp:9:3: note: FIX-IT applied suggested code changes
/tmp/tidy.cpp:4:3: note: expanded from macro 'CASE'
  else \
  ^
clang-tidy applied 1 of 1 suggested fixes.
```

The use of the macro is weirdly deleted:
```c++
#define CASE(x) \
  if (x) \
    return 1; \
  else \
    return 2; \


bool foo(bool x) {
  (x);
}
```


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to