[PATCH] D52989: [clang-tidy] Fix handling of parens around new expressions in make_<smartptr> checks.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 9 01:21:05 PDT 2018


hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

Thanks for fixing it. It looks much simpler than I thought originally.

Looks good, just a few nits.



================
Comment at: clang-tidy/modernize/MakeSmartPtrCheck.cpp:246
+                                   ASTContext *Ctx) {
+  std::function<const Expr *(const Expr *)> SkipParensParents =
+      [&](const Expr *E) {
----------------
nit: I'd use `auto` to avoid this long type name, the type is clear to me, it is a lambda function.


================
Comment at: clang-tidy/modernize/MakeSmartPtrCheck.cpp:250
+          if (const Expr *Parent = Node.get<ParenExpr>())
+            return SkipParensParents(Parent);
+        }
----------------
nit: we can easily avoid the recursive call by using while here, I think.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52989





More information about the cfe-commits mailing list