[clang-tools-extra] 57914f6 - [clang-tidy][NFC] Remove unnecessary nullptr check on cast subexpr (#85473)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 18 08:44:59 PDT 2024


Author: Mike Rice
Date: 2024-03-18T08:44:55-07:00
New Revision: 57914f647e2551ea19758038345bb8bc2c4762c1

URL: https://github.com/llvm/llvm-project/commit/57914f647e2551ea19758038345bb8bc2c4762c1
DIFF: https://github.com/llvm/llvm-project/commit/57914f647e2551ea19758038345bb8bc2c4762c1.diff

LOG: [clang-tidy][NFC] Remove unnecessary nullptr check on cast subexpr (#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.

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp

Removed: 
    


################################################################################
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