llvm / llvm/llvm-project

[clang-tidy] readability-simplify-boolean-expr should handle if statements with init statements

Open
#172,180 2 comments 0 reactions 0 assignees View on GitHub
clang-tidy enhancement
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

**Problem:** `readability-simplify-boolean-expr` doesn't simplify conditions in if statements with init statements.

**Examples:**
- `if (auto x = f(); x != nullptr)` → `if (auto x = f())`
- `if (bool b = g(); b == true)` → `if (bool b = g())`

**Request:** Extend the check to handle C++17 if-with-initializer syntax.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.