[PATCH] D73775: [clang-tidy] Cover cases like (b && c && b) in the redundant expression check

Alexey Romanov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 2 23:41:17 PST 2020


alexeyr added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp:363
+                      ASTContext &Context) {
+  const auto OpKind = getOp(TheExpr);
+  // if there are no nested operators of the same kind, it's handled by
----------------
Eugene.Zelenko wrote:
> Please don't use auto when type is not spelled explicitly or iterator.
In this case the type will depend on `TExpr`: either `BinaryOperator::Opcode` or `OverloadedOperatorKind`. I could make it a template parameter (but it won't be deducible) or convert `OverloadedOperatorKind` to `Opcode`. Any preference?


================
Comment at: clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp:375
+  for (ast_type_traits::DynTypedNode Parent : Parents) {
+    if (checkOpKind<TExpr>(Parent.get<TExpr>(), OpKind)) {
+      return false;
----------------
Eugene.Zelenko wrote:
> Please elide braces.
Should braces be elided from `for` as well?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73775





More information about the cfe-commits mailing list