<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/57975>57975</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] SimplifyDeMorgan of `readability-simplify-boolean-expr` should not trigger within macro
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          zero9178
      </td>
    </tr>
</table>

<pre>
    Following code:
```cpp
#include <cstdio>

#define A_ASSERT(...) \
if (!(__VA_ARGS__)) \
    fprintf(stderr, #__VA_ARGS__);

void foo(bool a, bool b)
{
    A_ASSERT(a != true && b == false);
}
```
causes clang-tidy to emit:
```
[<source>:9:5: warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]](javascript:;)
    A_ASSERT(a != true && b == false);
    ^
[<source>:4:5: note: expanded from macro 'A_ASSERT'](javascript:;)
if (!(__VA_ARGS__)) \
    ^~~~~~~~~~~~~~
```
when run with `readability-simplify-boolean-expr` enabled.
Ideally it would not emit that diagnostic as it is impossible to fix, since the inversion that is part of the expression is part of the macro and essential to its function in other expansions. 

CE link:
https://godbolt.org/z/5bc993a1q
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylU02T2jgQ_TX2pQuXkbGNDz4wwySVw14yW3ul9NEGZYXkleQh5Ndvy0CGTJJKtpaSjVv9ofdet4RT5_6dM8adtN2DdAqzapOV26zcZE15WXIcrzus0laaSSFk1aMMUWmXVU9X5y1E4aAtwma3eX5--vhnxtZFUWSsg6x-vATpAWg3Y0t673Z_UeTH98-7HcV8Ewb0G0avbRwokE5D7zP2SLnVm6zq4R7Di9MKBucoSThngKek-Uuk4Etk-_B6yB1UDglWtYXoJ2LJGlogiO42bQ7cBPzmwHb7RqyLKfkUMIA03O4XUaszRAd41PF7da9m_UCSBjd5iUnSakOHbGp64MS9peakz0QCuQX8PHoMQTsLkkyBEPRxNHrQqECcYYt_OL_nNmNtgHhA5_FIuj545IoLbXQ8L64Z58W16CIVzeptWmz9ib_wIL0eZ8RE9ybc_9MrZWf10884r26crYtpEBNRbhWRGrw7wpFL7-iQ9hVA-wu4_2HUEq7299aPOng6oAU_WTjpeADa_rXYTQlouTCoikuNDwq5MWfQEU5uMirpMI8NNZFHUJrvrQtRS-AhBWl6H0dHk0BF0ogN-nMa9kDXFFPjQdsX9POgzBUoYeQ-ghtm790cvfFcpCbtgfxoo-Ym1dcxwDBZGecUC45i_aVLqUoo4P4iPj6B0fbvrzN_iHEMyWLvaO2dEs7EgiaVrC_01EJ2XcWX_-TYL5tmtVw166rOVV-prup4HnU02NPYvN4raj88X8W9TX3i8Lv6h8NXnaPX-z2xSf0jarMC-eRN_wY2uSdRSHckw5iX299i9O4TykimDmHCkAi1XVvnh75rUQysFYMY2rVUWLKOr7parHhTsqZc54YLNCFRyxi7Y8cYEcx1z0rGyo7VrCpLtixkLVGtpCxVt1IommxV4pFrUyQgSdDc9zMmMe0DOY0OMbw6ObV8b3GWMtXnUzw4339B77plu85n_P0M_l9iLtch">