[PATCH] D130181: [clang-tidy] Add readability-use-early-exits check

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 5 01:15:09 PDT 2022


njames93 added a comment.

In D130181#3769083 <https://reviews.llvm.org/D130181#3769083>, @JonasToth wrote:

> ...

Your concerns aren't actually that important. Because the transformations only work on for binary operators, and not CXXOperatorCallExpr, it would always never do any special logic, instead just wrap the whole thing in parens and negate it

  if (!(A && B))
    continue;
  
  if (!(!B && C))
    continue;
  
  padLines();

The only potential issue would be cases when the binary operator is type dependent, as binary operators where they type is unresolved are handled as BinaryOperators, even if every instantiation would be resolved to an operator call

  template <size_t N, size_t M>
  void fancyMatrix(Matrix<N,M> A, Matrix<M, M> B) {
  
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130181/new/

https://reviews.llvm.org/D130181



More information about the cfe-commits mailing list