This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy: modernize] Fix modernize-use-equals-default with {} brackets list initialization: patch
ClosedPublic

Authored by IdrissRio on Jul 15 2018, 3:56 PM.

Details

Summary

Hello, i would like to suggest a fix for one of the checks in clang-tidy.
The bug was reported in https://bugs.llvm.org/show_bug.cgi?id=38039 where you can find more information.

struct UOB{
	UOB(const UOB &Other):j{Other.j}{}
	int j;
};

In this case the check modernize-use-equals-default does not detect copy constructors that can be defaulted; that should be:

struct UOB{
	UOB(const UOB &Other) = default;
	int j;
};

Diff Detail

Event Timeline

IdrissRio created this revision.Jul 15 2018, 3:56 PM
IdrissRio edited the summary of this revision. (Show Details)Jul 15 2018, 3:59 PM
aaron.ballman accepted this revision.Jul 16 2018, 5:44 AM

LGTM with a formatting nit.

clang-tidy/modernize/UseEqualsDefaultCheck.cpp
100

Did clang-format produce this formatting? If not, can you clang-format this patch?

This revision is now accepted and ready to land.Jul 16 2018, 5:44 AM

Fixed the formatting error with clang-format

This revision was automatically updated to reflect the committed changes.
IdrissRio marked an inline comment as done.