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

2024-03-15 Thread Mike Rice via cfe-commits
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 56c3ca2e2cfac7b

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

2024-03-15 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-tidy Author: Mike Rice (mikerice1969) Changes 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. --- Full diff:

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

2024-03-16 Thread Piotr Zegar via cfe-commits
https://github.com/PiotrZSL approved this pull request. First this null-ptr check does nothing because in line 114 we still missing nullptr check. Proper way would be to "return" when we find nullptr were it shoudnt. Second thing, asserts mean nothing. In release mode they are disabled. This m

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

2024-03-16 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: Shouldn't we simply `return`? As you say, the assert is disabled in Release mode. Even if it's enabled, the author if `getSubExpr` may one day decide to remove the assert without possibly knowing all the places that do rely on that assert, leaving the code unprotected. It

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

2024-03-18 Thread Mike Rice via cfe-commits
https://github.com/mikerice1969 closed https://github.com/llvm/llvm-project/pull/85473 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-03-18 Thread Mike Rice via cfe-commits
mikerice1969 wrote: I mentioned the assert just to make the point that setSubExpr is written so it doesn't return a nullptr. So it is not expected and the deference is ok. I went ahead with this change but feel free to update if you like. But adding a return when nullptr is seen here would co