https://github.com/Da-Viper created https://github.com/llvm/llvm-project/pull/102831
When readability-implicit-bool-conversion-check and readability-uppercase-literal-suffix-check is enabled this will cause you to apply a fix twice from (!i) -> (i == 0u) to (i == 0U) twice instead will skip the middle one >From 8a4f6af9fc1f44c2f8b5fd3693ca14eaf776fd02 Mon Sep 17 00:00:00 2001 From: Ebuka Ezike <yerimy...@gmail.com> Date: Sun, 11 Aug 2024 21:39:35 +0100 Subject: [PATCH] [clang-tidy] use upper cace letters for bool conversion suffix When readability-implicit-bool-conversion-check and readability-uppercase-literal-suffix-check is enabled this will cause you to apply a fix twice from (!i) -> (i == 0u) to (i == 0U) twice instead will skip the middle one --- .../readability/ImplicitBoolConversionCheck.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp index aa115cd450c4f6..258cec80dd0bac 100644 --- a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp @@ -43,10 +43,10 @@ StringRef getZeroLiteralToCompareWithForType(CastKind CastExprKind, ASTContext &Context) { switch (CastExprKind) { case CK_IntegralToBoolean: - return Type->isUnsignedIntegerType() ? "0u" : "0"; + return Type->isUnsignedIntegerType() ? "0U" : "0"; case CK_FloatingToBoolean: - return Context.hasSameType(Type, Context.FloatTy) ? "0.0f" : "0.0"; + return Context.hasSameType(Type, Context.FloatTy) ? "0.0F" : "0.0"; case CK_PointerToBoolean: case CK_MemberPointerToBoolean: // Fall-through on purpose. @@ -202,13 +202,13 @@ StringRef getEquivalentForBoolLiteral(const CXXBoolLiteralExpr *BoolLiteral, if (DestType->isFloatingType()) { if (Context.hasSameType(DestType, Context.FloatTy)) { - return BoolLiteral->getValue() ? "1.0f" : "0.0f"; + return BoolLiteral->getValue() ? "1.0F" : "0.0F"; } return BoolLiteral->getValue() ? "1.0" : "0.0"; } if (DestType->isUnsignedIntegerType()) { - return BoolLiteral->getValue() ? "1u" : "0u"; + return BoolLiteral->getValue() ? "1U" : "0U"; } return BoolLiteral->getValue() ? "1" : "0"; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits