Issue 91487
Summary [clang-tidy]: readability-simplify-boolean-expr wants to use DeMorgan's theorem on macros despite IgnoreMacros
Labels clang-tidy
Assignees
Reporter nick-potenski
    clang-tidy produces a `readability-simplify-boolean-expr` warning to simplify expressions with macros using DeMorgan's theorem despite `readability-simplify-boolean-expr.IgnoreMacros` being set to `true`.

Simplified test case:
```
#define is_a_favorite_number(_i) (_i == 42 || _i == 3 || _i == 1000000)

bool UseNumber(int i) { return i >= 0 && !is_a_favorite_number(i); }
```

.clang-tidy config:
```
---
Checks:
    '-*,
 readability-simplify-boolean-expr
    '
CheckOptions:
    - key: readability-simplify-boolean-expr.IgnoreMacros
      value: true
```

Produces the following:
```
1 warning generated.
test_bool_simplification.cpp:4:42: error: boolean _expression_ can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr,-warnings-as-errors]
    4 | bool UseNumber(int i) { return i >= 0 && !is_a_favorite_number(i); }
      | ^~~~~~~~~~~~~~~~~~~~~~~~
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to