[clang-tools-extra] [clang-tidy] use upper case letters for bool conversion suffix (PR #102831)
Julian Schmidt via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 14 03:33:04 PDT 2024
================
@@ -39,14 +39,22 @@ AST_MATCHER(Stmt, isNULLMacroExpansion) {
}
StringRef getZeroLiteralToCompareWithForType(CastKind CastExprKind,
- QualType Type,
- ASTContext &Context) {
+ QualType Type, ASTContext &Context,
+ bool UseUpperCaseSuffix) {
switch (CastExprKind) {
- case CK_IntegralToBoolean:
- return Type->isUnsignedIntegerType() ? "0u" : "0";
+ case CK_IntegralToBoolean: {
+ if (Type->isUnsignedIntegerType()) {
+ return UseUpperCaseSuffix ? "0U" : "0u";
+ }
+ return "0";
+ }
- case CK_FloatingToBoolean:
- return Context.hasSameType(Type, Context.FloatTy) ? "0.0f" : "0.0";
+ case CK_FloatingToBoolean: {
+ if (Context.hasSameType(Type, Context.FloatTy)) {
+ return UseUpperCaseSuffix ? "0.0F" : "0.0f";
+ }
----------------
5chmidti wrote:
Nit: Please remove the two compound statements of the two `if` statements (LLVM coding standards).
e.g.,
```c++
if (Type->isUnsignedIntegerType())
return UseUpperCaseSuffix ? "0U" : "0u";
```
This also applies to lines 214-226
https://github.com/llvm/llvm-project/pull/102831
More information about the cfe-commits
mailing list