[clang-tools-extra] [NFC] Remove dead code detected by code sanitizer. (PR #134385)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 4 11:05:57 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tools-extra
Author: Zahira Ammarguellat (zahiraam)
<details>
<summary>Changes</summary>
The code sanitizer is failing with this error: `Execution cannot reach this statement.`
The execution code path would early exit at line 928 if `(Lil && Ril) = true`.
---
Full diff: https://github.com/llvm/llvm-project/pull/134385.diff
1 Files Affected:
- (modified) clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp (-12)
``````````diff
diff --git a/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp b/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
index c249244b1a1b2..8e5a528bc5d3e 100644
--- a/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
@@ -927,18 +927,6 @@ static bool areExprsSameMacroOrLiteral(const BinaryOperator *BinOp,
if (Lil && Ril)
return Lil->getValue() == Ril->getValue();
- const auto *LStrl = dyn_cast<StringLiteral>(Lhs);
- const auto *RStrl = dyn_cast<StringLiteral>(Rhs);
- if (Lil && Ril) {
- const llvm::StringRef L = Lexer::getSourceText(
- CharSourceRange::getTokenRange(LStrl->getBeginLoc()), SM,
- Context->getLangOpts(), 0);
- const llvm::StringRef R = Lexer::getSourceText(
- CharSourceRange::getTokenRange(RStrl->getBeginLoc()), SM,
- Context->getLangOpts(), 0);
- return L.compare(R) == 0;
- }
-
const auto *Lbl = dyn_cast<CXXBoolLiteralExpr>(Lhs);
const auto *Rbl = dyn_cast<CXXBoolLiteralExpr>(Rhs);
if (Lbl && Rbl)
``````````
</details>
https://github.com/llvm/llvm-project/pull/134385
More information about the cfe-commits
mailing list