diff --git a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp --- a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp @@ -44,10 +44,10 @@ 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. @@ -206,13 +206,13 @@ 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"; } diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability-implicit-bool-conversion.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability-implicit-bool-conversion.cpp --- a/clang-tools-extra/test/clang-tidy/checkers/readability-implicit-bool-conversion.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability-implicit-bool-conversion.cpp @@ -98,7 +98,7 @@ functionTaking(false); // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: implicit conversion bool -> 'unsigned long' - // CHECK-FIXES: functionTaking(0u); + // CHECK-FIXES: functionTaking(0U); functionTaking(true); // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: implicit conversion bool -> 'signed char' @@ -106,7 +106,7 @@ functionTaking(false); // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: implicit conversion bool -> 'float' - // CHECK-FIXES: functionTaking(0.0f); + // CHECK-FIXES: functionTaking(0.0F); functionTaking(true); // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: implicit conversion bool -> 'double' @@ -177,12 +177,12 @@ unsigned long unsignedLong = 10; functionTaking(unsignedLong); // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'unsigned long' -> bool - // CHECK-FIXES: functionTaking(unsignedLong != 0u); + // CHECK-FIXES: functionTaking(unsignedLong != 0U); float floating = 0.0f; functionTaking(floating); // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'float' -> bool - // CHECK-FIXES: functionTaking(floating != 0.0f); + // CHECK-FIXES: functionTaking(floating != 0.0F); double doubleFloating = 1.0f; functionTaking(doubleFloating); @@ -214,7 +214,7 @@ float floating = 10.0f; bool boolComingFromFloat = floating; // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: implicit conversion 'float' -> bool - // CHECK-FIXES: bool boolComingFromFloat = floating != 0.0f; + // CHECK-FIXES: bool boolComingFromFloat = floating != 0.0F; signed char character = 'a'; bool boolComingFromChar = character; @@ -239,7 +239,7 @@ float floating = 0.2f; bool boolComingFromFloating = floating - 0.3f || boolean; // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: implicit conversion 'float' -> bool - // CHECK-FIXES: bool boolComingFromFloating = ((floating - 0.3f) != 0.0f) || boolean; + // CHECK-FIXES: bool boolComingFromFloating = ((floating - 0.3f) != 0.0F) || boolean; double doubleFloating = 0.3; bool boolComingFromDoubleFloating = (doubleFloating - 0.4) && boolean; @@ -256,7 +256,7 @@ float floating = 10.0f; bool boolComingFromNegatedFloat = ! floating; // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: implicit conversion 'float' -> bool - // CHECK-FIXES: bool boolComingFromNegatedFloat = floating == 0.0f; + // CHECK-FIXES: bool boolComingFromNegatedFloat = floating == 0.0F; signed char character = 'a'; bool boolComingFromNegatedChar = (! character); @@ -283,7 +283,7 @@ float floating = 0.3f; while (floating) {} // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: implicit conversion 'float' -> bool - // CHECK-FIXES: while (floating != 0.0f) {} + // CHECK-FIXES: while (floating != 0.0F) {} double doubleFloating = 0.4; do {} while (doubleFloating); @@ -295,7 +295,7 @@ float floating = 1.0f; return floating; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: implicit conversion 'float' -> bool - // CHECK-FIXES: return floating != 0.0f; + // CHECK-FIXES: return floating != 0.0F; } void implicitConversionToBoolFromLiterals() { @@ -354,7 +354,7 @@ functionTaking(-0.0f); // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'float' -> bool - // CHECK-FIXES: functionTaking((-0.0f) != 0.0f); + // CHECK-FIXES: functionTaking((-0.0f) != 0.0F); functionTaking(-0.0); // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'double' -> bool