[PATCH] D115249: Clang-Tidy implicit bool conversion check use upercase suffixes
Kilian Traub via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 7 07:53:21 PST 2021
kili created this revision.
Herald added a subscriber: carlosgalvezp.
kili requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.
Make the type suffix of the implicit bool conversion check upercase. So that the result does not fail the readability uppercase literall suffix check.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D115249
Files:
clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
Index: clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
+++ 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";
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115249.392402.patch
Type: text/x-patch
Size: 1334 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211207/291411a0/attachment.bin>
More information about the cfe-commits
mailing list