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

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] RemoveParentheses should not touch macros
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-format,
            invalid-code-generation
      </td>
    </tr>

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

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

<pre>
    Catch2's `REQUIRE` (and stuff) need parentheses around `&&` otherwise they hit an static assert. So we need to not touch `REQUIRE((a && b));`. In general I think it is a good idea to not touch macros at all.

Now how to deal with that. Add an option to declare macros which shouldn't be touched? Use `TT_ForEachMacro` etc.? We have [some](https://github.com/llvm/llvm-project/blob/7a46baa465c49db84b7b5f8fa9ab847ec1da3ce4/clang/lib/Format/UnwrappedLineParser.cpp#L3872-L3874) [heuristics](https://github.com/llvm/llvm-project/blob/7a46baa465c49db84b7b5f8fa9ab847ec1da3ce4/clang/lib/Format/TokenAnnotator.cpp#L2107) to detect macros.
That could be put in a `IsMacro` function.

What do you think @owenca @mydeveloperday @rymiel ?

I'm willing to work on it, but you can also take on it, just asking for the way to go here.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVE1v5DYP_jXyhYihkb8PPuTLeIN3W7Rpgj0WtMQZaUcjGZIcY_rrC81ksxv01FMBQTYk8iGp5yExRnNwRCNr7ljzUOCatA_j__AvDOr8f7fGhcKRjrGYvTqP95ikFkx0EVjLnx9_f316fmQtByZ6dApiWvd7JgZwRAoWDOSSpkgRMPjVqezFRJtXy8EnTWEzkSBpOoM2CdBBTJiMBIyRQirhDw8bXfGSB-cTJL9K_XN80efwcAWGmYkhr-qOtbyEJwcHchTQwhMkbdwRTAITAeHgvQKjCD8jn1AGHwEToLUl4w-M3173X_0G2m_ZXBFa2EzSkDSmEm6Vysn7JRnvrgbSYqDvaJs2UkPUfrXKMdElmOkajxSrJniNlEt6eflz8uERpf4l--VXoiTLbPGVQOMbAWvuoj8Rax6Y6HVKS2TVLRMTE9PBJL3OpfQnJiZr375_bpbgv5FMTEyz9TMTU4d1OyPWbSPrQc19PXdzs-_3OODc1x3JncJKUs3EJC26QwYy2XHy4YQZ6NVtAZeF1Bfj6DcMkUIpl4WJ6kvVd-Im73WWAmvuNK3BxGRk_K-zfvFHcrfO-YTJfyQsdrzLqV5oSyTTO2vv5L9oTCAzc5m0ZU1gHGCm6yl-0LRfnczcfxLM1-ypPJz9-q49VnO_kZOY_05nRW9k_UJB4TmfhPPJkAVWTT_DPDHRnWAz1hp3yFluPhzBOzCJiXuY13SJINEB2ugh4ZF-XH9bYwKMx-y79yE3G2x4zjgHD5oClYUaKzVUAxY07tqhbWrOeV3okZqeY9U2c0c093zoOKl6mHet3Hd9JerCjIKLasd5I3a8retSVXteDdSITqp-Vh2rOZ3Q2DJTWvpwKEyMK41tXzV1YXEmGy_TR4gLZzf7d64EE_dMCOPe0Bp1I72im2sn52fO981DEcaLUub1EFnNrYkp_giUTLKXyfYJuHmAZzr5tyzaj_F0bcx_DIFiDXb812q9FBiZmC41_h0AAP__7VO7mw">