This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Don't generate fixes for initializer_list constructor in make_unique check.
ClosedPublic

Authored by hokein on Aug 16 2017, 1:59 AM.

Details

Summary

The current fix will break the compilation -- because braced list is not
deducible in std::make_unique (with the use of forwarding) without
specifying the type explicitly.

We could support it in the future.

Diff Detail

Repository
rL LLVM

Event Timeline

hokein created this revision.Aug 16 2017, 1:59 AM
alexfh accepted this revision.Aug 16 2017, 8:32 AM

LG

test/clang-tidy/modernize-make-unique.cpp
253 ↗(On Diff #111320)

I'd leave CHECK-FIXES with the original text to ensure no unwanted replacements are performed.

This revision is now accepted and ready to land.Aug 16 2017, 8:32 AM
hokein updated this revision to Diff 111481.Aug 17 2017, 2:12 AM

Add CHECK-FIXES, and fix an uncaught issue.

hokein marked an inline comment as done.Aug 17 2017, 2:17 AM
hokein added inline comments.
test/clang-tidy/modernize-make-unique.cpp
253 ↗(On Diff #111320)

Indeed, this is a good suggestion, and it discovered an issue of this patch (there are unexpected replacements generated for these cases).

I have updated the patch which changes a bit more code, please take a look again.

alexfh accepted this revision.Aug 17 2017, 2:50 AM

Still LG with one comment.

clang-tidy/modernize/MakeSmartPtrCheck.h
60 ↗(On Diff #111481)

I'd suggest using a less ambiguous phrase: instead of "Returns whether X." I write "Returns \c true when X".

hokein updated this revision to Diff 111485.Aug 17 2017, 2:57 AM
hokein marked 2 inline comments as done.

Address review comments.

This revision was automatically updated to reflect the committed changes.