[clang-tools-extra] Add clang-tidy check to suggest replacement of conditional statement with std::min/std::max (PR #77816)
Bhuminjay Soni via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 17 03:24:25 PST 2024
11happy wrote:
**Here's the update for recent commit :**
- Modified the RegisterMatcher to support the `If` statement with brackets by adding this ```compoundStmt(has(binaryOperator(
hasOperatorName("="), hasLHS(expr().bind("lhsVar2")),
hasRHS(expr().bind("rhsVar2")))))``` as AST matchers for If statement with brackets looked like this:

- Formatted by placing the `CHECK-FIXES` on a new line below `CHECK-MESSAGES`
- Added Test for Macro Functions & If statemnt with brackets
- Changed ```Lexer::getSourceText(
CharSourceRange::getTokenRange(rhsVar1->getSourceRange()),
Context.getSourceManager(), Context.getLangOpts())``` to ```
Lexer::getSourceText(Source.getExpansionRange(lhsVar1->getSourceRange()),
Context.getSourceManager(), Context.getLangOpts());```
- I have kept the options for `AlgorithmHeader` instead of hardcoding to keep modularity also fixed the typo.
https://github.com/llvm/llvm-project/pull/77816
More information about the cfe-commits
mailing list