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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] Check request: portability-minmax-macro-defensive
        </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 `std::min` and `std::max` invocations without surrounding parentheses over the name. The check will suggest to insert parentheses around the name.

BEFORE:
```
int result = std::min(a, b); 
```

AFTER:
```
int result = (std::min)(a, b); 
```

Without parentheses the code that uses `std::min` and `std::max` might lead to compilation error in MSVC:
```
#include <algorithm> // std::min
#include <windows.h> // min macro

int main() {
    int a = 5, b = 10;
    
 // Compilation error in MSVC: 
    // "error C2589: '(': illegal token on right side of '::'"
    int result = std::min(a, b); 
    
    return 0;
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMlF2v4yYQhn_N-GaUCOP468IXztddW2m7aq-Jmdh0MaSAkz399RUkR5ucSt0jIZHAvDO8z2CE92o0RB2UWyj3mVjCZF0nyfxjHWcsO1n51v1KJD0KHCYavmGYRMCb0hrPykiEivkgoeih6GdloGIoPi6L73FZmasdRFDWeLypMNkloF-cs4uRyox4EY5MmMiTR3slh2EiNGKmNX6d6FE9FfbLOJIPGCwq48mFF61IGX-ogfXA-u3h-NuXQzwQ66Fij8F6ZQI68osOCMUeX7zwRgDf4Ql4C8UWPyiB9f3x6-HLT3MCb17Ttj_P_OcD0LOx6Giwku4tWOLS5-nPapwCahIyYhvsfFE6NQPJOetQGfzl9z92_zUDvFBm0IskhGIn9GidCtMMxQGBH4EfX5l9FNyUkfbm19OTYFYGZzE4e_cacc0i8QbeItRbYD0iYtwQCWGZaKWfOYPiPSBOj5y7_3GE7-H3UOD8HrHjZdOmfV6n4nX8o7SmUWgM9hsZtAZdQueVJLRnvEfFEUX86aifv0bvZ0dER2FxBh-moN4_489kV8i2aEVGXV5v2g1nTV5lU1dy0Z5k3Yi2yjf5Jmf5OW-JZDVIRlVdZ6rjjJesYg3neVFUa1ERNbwS1MiyLdsSNoxmofRa6-u8tm7MlPcLdfmmKHiVaXEi7dO7wPmghRlXQcm3aLjcZ66LqtVpGT1smFY--B95ggo6vShPsnKPu_T9Ovp7IR8i54t1QZyUVuFtNSszi--rdClWks5kvLpStjjdTSFcfMIdmzeqMC2n9WBn4MdY8jGtLs7-RUMAfkw-PPDjw8q14_8GAAD__1HIdVE">