[clang-tools-extra] [clang-tidy] add modernize-math-constant check (PR #66583)

via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 16 11:41:11 PDT 2023


5chmidti wrote:

> I'ts not only about category but also name, check suggests std::numbers, then better name it modernize-use-std-numbers, reason for that is simple. Before C++20 we may want to have a check for example -prefer-math-constants that would change 3.14 hardcoded in code into M_PI. And in same way we could have check -use-std-numeric-limits that would change -2147483648 into std::numeric_limitsstd::sint32_t::min(). Simply we may have many of such checks.

Sorry, I read too fast it seems. But no objections to the name change on my end. It is more precise.
I'll force push one more time before any review comments come in. 

I don't plan to implement pre c++20 macros or limits here.
However, I do plan to write a check for numeric limits, as it is quite similar to this one.


https://github.com/llvm/llvm-project/pull/66583


More information about the cfe-commits mailing list