1 | // RUN: %check_clang_tidy -check-suffixes=,MACROS %s readability-simplify-boolean-expr %t |
2 | |
3 | // Ignore expressions in macros. |
4 | // RUN: %check_clang_tidy %s readability-simplify-boolean-expr %t \ |
5 | // RUN: -- -config="{CheckOptions: {readability-simplify-boolean-expr.IgnoreMacros: true}}" \ |
6 | // RUN: -- |
7 | |
8 | #define NEGATE(expr) !(expr) |
9 | |
10 | bool without_macro(bool a, bool b) { |
11 | return !(!a && b); |
12 | // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: boolean expression can be simplified by DeMorgan's theorem |
13 | // CHECK-FIXES: return a || !b; |
14 | } |
15 | |
16 | bool macro(bool a, bool b) { |
17 | return NEGATE(!a && b); |
18 | // CHECK-MESSAGES-MACROS: :[[@LINE-1]]:12: warning: boolean expression can be simplified by DeMorgan's theorem |
19 | // CHECK-FIXES: return NEGATE(!a && b); |
20 | } |
21 | |