[PATCH] D52989: [clang-tidy] Fix handling of parens around new expressions in make_<smartptr> checks.
Alexander Kornienko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 9 08:58:33 PDT 2018
alexfh added inline comments.
================
Comment at: clang-tidy/modernize/MakeSmartPtrCheck.cpp:246
+ ASTContext *Ctx) {
+ std::function<const Expr *(const Expr *)> SkipParensParents =
+ [&](const Expr *E) {
----------------
hokein wrote:
> nit: I'd use `auto` to avoid this long type name, the type is clear to me, it is a lambda function.
I first tried it with an `auto`, but the recursive call below didn't compile. Works fine without recursion though.
================
Comment at: clang-tidy/modernize/MakeSmartPtrCheck.cpp:250
+ if (const Expr *Parent = Node.get<ParenExpr>())
+ return SkipParensParents(Parent);
+ }
----------------
hokein wrote:
> nit: we can easily avoid the recursive call by using while here, I think.
Turned out that iterative approach here doesn't complicate code as much as I thought it would.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D52989
More information about the cfe-commits
mailing list