[clang-tools-extra] [clang-tidy][NFC] Remove unnecessary nullptr check on cast subexpr (PR #85473)
Mike Rice via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 15 14:57:29 PDT 2024
https://github.com/mikerice1969 created https://github.com/llvm/llvm-project/pull/85473
The value of SubExpr is not null since getSubExpr would assert in that case. Remove the nullptr check. This avoids confusion since SubExpr is used without check later in the function.
>From 56c3ca2e2cfac7b6c9b9029d14151fd80d705c2c Mon Sep 17 00:00:00 2001
From: Mike Rice <michael.p.rice at intel.com>
Date: Fri, 15 Mar 2024 13:37:32 -0700
Subject: [PATCH] [clang-tidy][NFC] Remove unnecessary nullptr check on cast
subexpr
The value of SubExpr is not null since getSubExpr would assert in that
case. Remove the nullptr check. This avoids confusion since SubExpr is
used without check later in the function.
---
.../clang-tidy/readability/ImplicitBoolConversionCheck.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
index 4f02950e7794cb..74152c6034510b 100644
--- a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
@@ -81,8 +81,7 @@ void fixGenericExprCastToBool(DiagnosticBuilder &Diag,
const Expr *SubExpr = Cast->getSubExpr();
- bool NeedInnerParens =
- SubExpr != nullptr && utils::fixit::areParensNeededForStatement(*SubExpr);
+ bool NeedInnerParens = utils::fixit::areParensNeededForStatement(*SubExpr);
bool NeedOuterParens =
Parent != nullptr && utils::fixit::areParensNeededForStatement(*Parent);
More information about the cfe-commits
mailing list