Hello, i want to propose this check suggested by @EugeneZelenko.
I have found it in the beginner tag of llvm-bugzilla repository.
This check looks for numerical unsigned constants that are equal to -1 or ~0
and substitutes them with std::numeric_limits<type>::max().
It includes the library <limits> if is not found.
Example:
unsigned const int x = -1;
becomes
unsigned const int x = std::numeric_limits<unsigned int>::max();
If the library <limits> is not include in the TU the check will add it with this criteria:
- If a #include is found it will add #include <limits> before this include.
- if no #include directive is found it will add it at the begin of the TU.
Please use alphabetical order for new checks.