This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] No fixes for auto new expression in smart check
ClosedPublic

Authored by hokein on Nov 22 2018, 6:23 AM.

Event Timeline

hokein created this revision.Nov 22 2018, 6:23 AM
aaron.ballman added inline comments.Nov 23 2018, 7:27 AM
clang-tidy/modernize/MakeSmartPtrCheck.cpp
258

Drop the quotation marks.

test/clang-tidy/modernize-make-unique.cpp
288

It seems like we could also generate the correct replacement for the user here.

PE1 = std::make_unique<decltype(E())>();

However, I feel like this isn't worth it in general and the correct behavior is to not diagnose in this situation in the first place -- I don't think anyone will find the make_unique<> version to be an improvement over the new auto() version. What do you think?

hokein updated this revision to Diff 175216.Nov 26 2018, 2:34 AM
hokein marked 3 inline comments as done.

No diagnose this case as well.

hokein added inline comments.Nov 26 2018, 2:35 AM
test/clang-tidy/modernize-make-unique.cpp
288

This seems reasonable to me. Also the new auto() is very rare even in our monolithic repository.

aaron.ballman accepted this revision.Nov 26 2018, 4:32 AM

LGTM with a minor typo to correct.

test/clang-tidy/modernize-make-unique.cpp
285

warninags -> warnings

This revision is now accepted and ready to land.Nov 26 2018, 4:32 AM
hokein updated this revision to Diff 175227.Nov 26 2018, 4:40 AM
hokein marked 2 inline comments as done.

Fix a typo.

Thanks for the quick review.

test/clang-tidy/modernize-make-unique.cpp
285

oops...

This revision was automatically updated to reflect the committed changes.