This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Rename modernize-use-default to modernize-use-equals-default
ClosedPublic

Authored by malcolm.parsons on Nov 10 2016, 9:07 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

malcolm.parsons retitled this revision from to [clang-tidy] Rename modernize-use-default to modernize-use-equals-default.
malcolm.parsons added a subscriber: cfe-commits.
aaron.ballman added inline comments.Nov 10 2016, 9:19 AM
clang-tidy/modernize/ModernizeTidyModule.cpp
58 ↗(On Diff #77502)

What do we want to do, if anything, for people who have scripts using the old name? Do we want to keep the old name as an alias to the new name for some period of time?

clang-tidy/modernize/ModernizeTidyModule.cpp
58 ↗(On Diff #77502)

An alias helps if the check was enabled by name, but not if it was disabled by name.
If the alias is temporary, would you want a deprecation warning?
I wouldn't want to warn about -checks=modernize*, but maybe warning for -checks=modernize-use-default would be useful.

aaron.ballman added inline comments.Nov 10 2016, 9:42 AM
clang-tidy/modernize/ModernizeTidyModule.cpp
58 ↗(On Diff #77502)

An alias helps if the check was enabled by name, but not if it was disabled by name.

Oye, this is true and unfortunate.

If the alias is temporary, would you want a deprecation warning?
I wouldn't want to warn about -checks=modernize*, but maybe warning for -checks=modernize-use-default would be useful.

I think a deprecation warning would be a helpful feature, but not required. I do agree that I would not want a warning for wildcard matches.

I would also be fine if we simply had the documentation for modernize-use-default forward to the documentation for modernize-use-equals-default and put a note in there about the old name being deprecated and leave in an alias to the old name.

To be complete, I would also be fine if we remove the old name as in this patch. I am mostly thinking about what default policy we want to have when this situation arises. FWIW, the check was exposed under this name around Oct 2015, so it's been in the wild for over a year, and in a public release.

Prazek added a subscriber: Prazek.Nov 10 2016, 11:08 PM

I think this change is not required at first place.
It is introduced because of "modernize-use-delete" was too ambiguous because of operator delete, so it was changed to "modernize-use-equals-delete". But this case is not ambiguous at all, so I don't see point changing that.
Maybe it would be better to find better name for the modernize-use-equals-delete to be modernize-delete-function or something before 4.0 is released.

It is introduced because of "modernize-use-delete" was too ambiguous because of operator delete, so it was changed to "modernize-use-equals-delete". But this case is not ambiguous at all, so I don't see point changing that.

default can also be used in a switch.

aaron.ballman edited edge metadata.Nov 11 2016, 7:15 AM

It is introduced because of "modernize-use-delete" was too ambiguous because of operator delete, so it was changed to "modernize-use-equals-delete". But this case is not ambiguous at all, so I don't see point changing that.

default can also be used in a switch.

Also, "default" has meaning in English, so it's plausible to read this as a check that modernizes your code to "use the default" for whatever the user might be thinking of when they enable the check, so I think there is existing ambiguity with the current name.

malcolm.parsons edited edge metadata.

Fix sorting.
Mention in release notes.

alexfh added inline comments.Dec 1 2016, 6:33 AM
clang-tidy/modernize/ModernizeTidyModule.cpp
58 ↗(On Diff #77502)

I'd personally prefer to leave the old documentation file with a redirect and a note about the renaming. Similar to how we treat aliases. WDYT?

malcolm.parsons added inline comments.Dec 1 2016, 7:34 AM
clang-tidy/modernize/ModernizeTidyModule.cpp
58 ↗(On Diff #77502)

If it has a redirect then add_new_check.py will add it to list.rst using the same wording as an alias.
Is that what you want?
Should it be an alias?

alexfh added inline comments.Dec 1 2016, 7:53 AM
clang-tidy/modernize/ModernizeTidyModule.cpp
58 ↗(On Diff #77502)

I don't care about leaving the old name for the check (probably, better to remove it right away), but leaving the old documentation page with a proper redirect seems useful as a means to resolve users' confusion. I wouldn't call it "alias" in this case though, and including it to the list doesn't seem to be useful (so the document will need to be marked orphan, IIUC).

alexfh added inline comments.Dec 1 2016, 7:55 AM
clang-tidy/modernize/ModernizeTidyModule.cpp
58 ↗(On Diff #77502)

(So, we can do something close to clang/tools/extra/docs/clang-tidy.rst)

Add documentation redirect.
Change add_new_check.py to ignore checks that are orphaned.

Re-remove doubled space in modernize-use-equals-default.rst.

alexfh accepted this revision.Dec 1 2016, 9:19 AM
alexfh edited edge metadata.

LG. Thanks!

This revision is now accepted and ready to land.Dec 1 2016, 9:19 AM
This revision was automatically updated to reflect the committed changes.
clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-copy.cpp