[all-commits] [llvm/llvm-project] e636e6: [clang-tidy]: Added modernize-replace-disallow-cop...
Konrad Kleine via All-commits
all-commits at lists.llvm.org
Wed Jun 3 13:56:27 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: e636e6b79ac06b13059e46b49acb4d9de204c75b
https://github.com/llvm/llvm-project/commit/e636e6b79ac06b13059e46b49acb4d9de204c75b
Author: Konrad Kleine <kkleine at redhat.com>
Date: 2020-06-03 (Wed, 03 Jun 2020)
Changed paths:
M clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
M clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
A clang-tools-extra/clang-tidy/modernize/ReplaceDisallowCopyAndAssignMacroCheck.cpp
A clang-tools-extra/clang-tidy/modernize/ReplaceDisallowCopyAndAssignMacroCheck.h
M clang-tools-extra/docs/ReleaseNotes.rst
M clang-tools-extra/docs/clang-tidy/checks/list.rst
A clang-tools-extra/docs/clang-tidy/checks/modernize-replace-disallow-copy-and-assign-macro.rst
A clang-tools-extra/test/clang-tidy/checkers/modernize-replace-disallow-copy-and-assign-macro.cpp
Log Message:
-----------
[clang-tidy]: Added modernize-replace-disallow-copy-and-assign-macro
Summary:
This check finds macro expansions of `DISALLOW_COPY_AND_ASSIGN(Type)` and
replaces them with a deleted copy constructor and a deleted assignment operator.
Before the `delete` keyword was introduced in C++11 it was common practice to
declare a copy constructor and an assignment operator as a private members. This
effectively makes them unusable to the public API of a class.
With the advent of the `delete` keyword in C++11 we can abandon the
`private` access of the copy constructor and the assignment operator and
delete the methods entirely.
Migration example:
```
lang=dif
class Foo {
private:
- DISALLOW_COPY_AND_ASSIGN(Foo);
+ Foo(const Foo &) = delete;
+ const Foo &operator=(const Foo &) = delete;
};
```
Reviewers: alexfh, hokein, aaron.ballman, njames93
Reviewed By: njames93
Subscribers: Eugene.Zelenko, mgorny, xazax.hun, cfe-commits
Tags: #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D80531
More information about the All-commits
mailing list