Open Quuxplusone opened 5 years ago
Attached example.cpp
(74 bytes, text/x-c++src): Example cpp file to reproduce the error
Just working on this now - it's a simple fix.
This makes perfect sense if the setting "readability-uppercase-literal-suffix" is enabled (which it is in this case, due to the glob), as fixing to a lowercase is a violation of this rule.
However should the default behaviour be to also amend with an uppercase suffix, even if the "readability-uppercase-literal-suffix" is not enforced? I know it's common at some places that floating point literals should use a lower case suffix (i.e. they use 1.0f rather than 1.0F), s.t. this automatic change may be alien.
Would like to hear people's opinion on this one - making the suffix be uppercased iff the option is enabled isn't difficult from what I'm seeing.
How about != 0
?
'!= 0' is not a good compromise as it mixes signed and unsigned comparisons.
It is easily possible in the constructor for ImplicitBoolConversionCheck
to check the context if readability-uppercase-literal-suffix
is enabled. See https://github.com/llvm/llvm-project/blob/bab1a17ad7761ae61e5841c2fb905de59cb8c2da/clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp#L98 for example.
example.cpp
(74 bytes, text/x-c++src)