This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Ignore macros in make-unique check.
ClosedPublic

Authored by hokein on Aug 3 2017, 4:50 AM.

Details

Summary

The check doesn't fully support smart-ptr usages inside macros, which
may cause incorrect fixes, or even crashes, ignore them for now.

Diff Detail

Repository
rL LLVM

Event Timeline

hokein created this revision.Aug 3 2017, 4:50 AM
alexfh accepted this revision.Aug 3 2017, 7:36 AM

LG with one comment.

clang-tidy/modernize/MakeSmartPtrCheck.cpp
114 ↗(On Diff #109520)

Seems to be a bit too broad. Maybe just disable the fix in macros? If warnings without fixes will be a problem in some codebases, we could then introduce the IgnoreMacros option as in readability-redundant-declaration, modernize-use-using, modernize-use-bool-literals, and modernize-use-default-member-init.

This revision is now accepted and ready to land.Aug 3 2017, 7:36 AM
hokein updated this revision to Diff 109690.Aug 4 2017, 1:33 AM

Add IgnoreMacros option.

hokein updated this revision to Diff 109691.Aug 4 2017, 1:36 AM
hokein marked an inline comment as done.

Add a missing test file.

hokein added a comment.Aug 4 2017, 1:37 AM

Please take another look.

clang-tidy/modernize/MakeSmartPtrCheck.cpp
114 ↗(On Diff #109520)

The idea sounds good to me. Done.

If warnings without fixes will be a problem in some codebases, we could then introduce the IgnoreMacros option

Didn't know there is IgnoreMacros option, but we are missing the option document for these checks. Will add them afterwards.

alexfh accepted this revision.Aug 4 2017, 3:44 AM

LG with a couple of nits.

clang-tidy/modernize/MakeSmartPtrCheck.cpp
54 ↗(On Diff #109691)

Let's go with getLocalOrGlobal to be able to set the option for all checks at once. Other checks having this option do this already.

test/clang-tidy/modernize-make-unique-macros.cpp
14 ↗(On Diff #109691)

Please add CHECK-FIXES to verify that the code remains intact (both macro definition and expansion).

hokein updated this revision to Diff 109701.Aug 4 2017, 4:11 AM
hokein marked 2 inline comments as done.

Address review comments.

This revision was automatically updated to reflect the committed changes.