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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] Check request: improve greater equals or less equals operators
        </td>
    </tr>

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

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

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

<pre>
    
Needs a check that will find a definition of `operator>=` or `operator<=` which performs more than 1 invocations of another compare operators. The check will suggest to change the logic using only 1 invocation, and the observable behavior will remains unchanged.

BEFORE
```
bool operator>=(const A& lhs, const A& rhs) { return (rhs < lhs) || (lhs == rhs); }
bool operator<=(const A& lhs, const A& rhs) { return (lhs < rhs) || (lhs == rhs); }

bool operator>=(const B& lhs, const B& rhs) { return (lhs > rhs) || (lhs == rhs); }
bool operator<=(const B& lhs, const B& rhs) { return (rhs > lhs) || (lhs == rhs); }
```

AFTER
```
bool operator>=(const A& lhs, const A& rhs) { return !(lhs < rhs); }
bool operator<=(const A& lhs, const A& rhs) { return !(rhs < lhs); }

bool operator>=(const B& lhs, const B& rhs) { return !(rhs > lhs); }
bool operator<=(const B& lhs, const B& rhs) { return !(lhs > rhs); }
```

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0lM1upDoQhZ-m2JTSMkXzt2BB_y3vlaK8gIFq8L1uu2ObjjJPP4KQmWR6NFGPEgkJKNvnc_lYR3qvesNcQbqBdBfJMQzWVR2bb9aREFFju-cKRP0Pc-dRYjtw-z-GQQZ8UlrjUZkOJXZ8VEYFZQ3aI0Im7JmdDNZBsodkB5lA697Xt0v9aVDtgGd2R-tOHk_W8aRvMEZlLraVk6qfZKWxYWCHrT2dpWN81fIrfBh42dq8Kz_2PfuAwWI7SNNPioza9qrF0SvTozX6-R0BaIvSdPNE23h2F9loxoYHeVHWveg6PkllPI7mRbZbgahB1Jv94d_7_fSdieURdWOtxl_OgYrWGh-wBspQD36ivqm4qVIi5Bt0HEZnEKhwg0dIti_Tp8Et5NtpQM8DO0h2y0JINgj57pq9_Vu2XtjuBvYHrW-u8JsP8Pub8H9q_Ra2W9i3HPtb-0HU9eFhf_81tyK-MufTzY-v7t5XeBxfHfWnWxlf3aTfOxZ1VdKVSSkjruJ8LbIiXsdpNFRl2uRynXdpkWfHJBOctm0nqRVdQcU6oUhVJCgVRHlcJFm6XhGVVDRHorLJE-okrMUUHXql9eW0sq6PlPcjVzGVoiwiLRvWfg5holZL098F1T0D0RTKrppW3TVj72EttPLB_9QJKug5vt8sS3e4ncPQ8ePIPkBSozqdnb0w9o5lYIf8OErtp1TW7P2P39dIjUanqyGEs4ekBjoAHXoVhrFZtfYEdJj4y-vu7Ox_3Aagw9yUBzosfV0q-h4AAP__N4zqEA">