llvm-project/clang-tools-extra/clang-tidy/modernize
Konrad Kleine e636e6b79a [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
2020-06-03 16:56:03 -04:00
..
AvoidBindCheck.cpp [clang-tidy] Convert config options that are bools to use the bool overload of get(GlobalOrLocal)? 2020-04-12 23:06:09 +01:00
AvoidBindCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
AvoidCArraysCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
AvoidCArraysCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
CMakeLists.txt [clang-tidy]: Added modernize-replace-disallow-copy-and-assign-macro 2020-06-03 16:56:03 -04:00
ConcatNestedNamespacesCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
ConcatNestedNamespacesCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
DeprecatedHeadersCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
DeprecatedHeadersCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
DeprecatedIosBaseAliasesCheck.cpp [clang-tidy] Use StringSwitch in a bunch of places. NFCI. 2020-04-26 17:24:47 +02:00
DeprecatedIosBaseAliasesCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
LoopConvertCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
LoopConvertCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
LoopConvertUtils.cpp [clang-tools-extra] NFC: Fix trivial typo in documents and comments 2020-04-05 15:28:40 +09:00
LoopConvertUtils.h Fix trivial typos in comments; NFC 2020-01-02 13:41:43 -05:00
MakeSharedCheck.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MakeSharedCheck.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MakeSmartPtrCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
MakeSmartPtrCheck.h [clang-tidy] Added virtual isLanguageVersionSupported to ClangTidyCheck 2020-02-28 13:05:05 +00:00
MakeUniqueCheck.cpp MakeUniqueCheck.cpp: explicit the fact that there is an autofix for this checker 2020-01-10 22:06:03 +01:00
MakeUniqueCheck.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ModernizeTidyModule.cpp [clang-tidy]: Added modernize-replace-disallow-copy-and-assign-macro 2020-06-03 16:56:03 -04:00
PassByValueCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
PassByValueCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
RawStringLiteralCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
RawStringLiteralCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
RedundantVoidArgCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
RedundantVoidArgCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
ReplaceAutoPtrCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
ReplaceAutoPtrCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
ReplaceDisallowCopyAndAssignMacroCheck.cpp [clang-tidy]: Added modernize-replace-disallow-copy-and-assign-macro 2020-06-03 16:56:03 -04:00
ReplaceDisallowCopyAndAssignMacroCheck.h [clang-tidy]: Added modernize-replace-disallow-copy-and-assign-macro 2020-06-03 16:56:03 -04:00
ReplaceRandomShuffleCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
ReplaceRandomShuffleCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
ReturnBracedInitListCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
ReturnBracedInitListCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
ShrinkToFitCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
ShrinkToFitCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UnaryStaticAssertCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UnaryStaticAssertCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseAutoCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
UseAutoCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseBoolLiteralsCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
UseBoolLiteralsCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseDefaultMemberInitCheck.cpp C++2a -> C++20 in some identifiers; NFC. 2020-04-21 15:37:19 -04:00
UseDefaultMemberInitCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseEmplaceCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
UseEmplaceCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseEqualsDefaultCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
UseEqualsDefaultCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseEqualsDeleteCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseEqualsDeleteCheck.h [clang-tidy] Convert config options that are bools to use the bool overload of get(GlobalOrLocal)? 2020-04-12 23:06:09 +01:00
UseNodiscardCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseNodiscardCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseNoexceptCheck.cpp [clang-tidy] Fix potential assert in use-noexcept check 2020-05-24 14:40:58 +01:00
UseNoexceptCheck.h [clang-tidy] Fix potential assert in use-noexcept check 2020-05-24 14:40:58 +01:00
UseNullptrCheck.cpp Set traversal explicitly where needed in clang-tidy 2020-05-21 22:34:37 +01:00
UseNullptrCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseOverrideCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseOverrideCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseTrailingReturnTypeCheck.cpp std::isspace -> llvm::isSpace (where locale should be ignored) 2020-05-02 15:36:04 +02:00
UseTrailingReturnTypeCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseTransparentFunctorsCheck.cpp [clang-tidy] Convert config options that are bools to use the bool overload of get(GlobalOrLocal)? 2020-04-12 23:06:09 +01:00
UseTransparentFunctorsCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseUncaughtExceptionsCheck.cpp [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseUncaughtExceptionsCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00
UseUsingCheck.cpp [clang-tidy] modernize-use-using: Fix broken fixit with InjectedClassName 2020-04-27 14:23:23 +02:00
UseUsingCheck.h [clang-tidy] Change checks to use new isLanguageVersionSupported restriction 2020-03-03 16:43:45 +00:00