[clang-tools-extra] [clang-tidy] Use upper case letters for bool conversion suffix (PR #104882)

Julian Schmidt via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 24 06:23:24 PDT 2024


================
@@ -392,8 +402,16 @@ void ImplicitBoolConversionCheck::handleCastFromBool(
 
   if (const auto *BoolLiteral =
           dyn_cast<CXXBoolLiteralExpr>(Cast->getSubExpr()->IgnoreParens())) {
-    Diag << tooling::fixit::createReplacement(
-        *Cast, getEquivalentForBoolLiteral(BoolLiteral, DestType, Context));
+
+    const auto EquivalentForBoolLiteral =
+        getEquivalentForBoolLiteral(BoolLiteral, DestType, Context);
+    if (UseUpperCaseLiteralSuffix) {
+      Diag << tooling::fixit::createReplacement(
+          *Cast, EquivalentForBoolLiteral.upper());
+    } else {
+      Diag << tooling::fixit::createReplacement(*Cast,
+                                                EquivalentForBoolLiteral);
+    }
----------------
5chmidti wrote:

nit: do not use compound statements for single statements in control structures

https://github.com/llvm/llvm-project/pull/104882


More information about the cfe-commits mailing list