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
10bool 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
16bool 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

source code of clang-tools-extra/test/clang-tidy/checkers/readability/simplify-boolean-expr-macros.cpp