This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by alexfh on Oct 8 2018, 9:34 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

alexfh created this revision.Oct 8 2018, 9:34 AM
hokein accepted this revision.Oct 9 2018, 1:20 AM

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

Looks good, just a few nits.

clang-tidy/modernize/MakeSmartPtrCheck.cpp
246 ↗(On Diff #168671)

nit: I'd use auto to avoid this long type name, the type is clear to me, it is a lambda function.

250 ↗(On Diff #168671)

nit: we can easily avoid the recursive call by using while here, I think.

This revision is now accepted and ready to land.Oct 9 2018, 1:20 AM
alexfh updated this revision to Diff 168812.Oct 9 2018, 8:57 AM
alexfh marked 2 inline comments as done.
  • Remove recursion, use auto.
clang-tidy/modernize/MakeSmartPtrCheck.cpp
246 ↗(On Diff #168671)

I first tried it with an auto, but the recursive call below didn't compile. Works fine without recursion though.

250 ↗(On Diff #168671)

Turned out that iterative approach here doesn't complicate code as much as I thought it would.

This revision was automatically updated to reflect the committed changes.