[PATCH] D140760: [clang-tidy] Support begin/end free functions in modernize-loop-convert

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 27 12:18:58 PST 2023


PiotrZSL added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp:871
+        return false;
+    } else if (Nodes.getNodeAs<CallExpr>(EndCallName)) {
+      return true;
----------------
ccotter wrote:
> PiotrZSL wrote:
> > ``else return Nodes.getNodeAs<CallExpr>(EndCallName) != nullptr;``
> Is this in the style guide? NotNullTerminatedResultCheck.cpp, SignedCharMisuseCheck.cpp, UnconventionalAssignOperatorCheck.cpp have equivalent conditionals that do not check against `nullptr`.
its not about checking for nullptr, its about simplifying if else if else, you dont need to explicitly compare to nullptr, I'm just used to it.
You can easily depend on implicit bool conversion here, its fine.
Simply you got if something return true else return false, you can write just return something.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140760



More information about the cfe-commits mailing list