1 //===--- ReplaceDisallowCopyAndAssignMacroCheck.h - clang-tidy --*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_REPLACEDISALLOWCOPYANDASSIGNMACROCHECK_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_REPLACEDISALLOWCOPYANDASSIGNMACROCHECK_H
12 #include "../ClangTidyCheck.h"
14 namespace clang::tidy::modernize
{
16 /// This check finds macro expansions of ``DISALLOW_COPY_AND_ASSIGN(Type)`` and
17 /// replaces them with a deleted copy constructor and a deleted assignment
24 /// DISALLOW_COPY_AND_ASSIGN(Foo);
32 /// Foo(const Foo &) = delete;
33 /// const Foo &operator=(const Foo &) = delete;
37 /// For the user-facing documentation see:
38 /// http://clang.llvm.org/extra/clang-tidy/checks/modernize/replace-disallow-copy-and-assign-macro.html
39 class ReplaceDisallowCopyAndAssignMacroCheck
: public ClangTidyCheck
{
41 ReplaceDisallowCopyAndAssignMacroCheck(StringRef Name
,
42 ClangTidyContext
*Context
);
43 bool isLanguageVersionSupported(const LangOptions
&LangOpts
) const override
{
44 return LangOpts
.CPlusPlus11
;
46 void registerPPCallbacks(const SourceManager
&SM
, Preprocessor
*PP
,
47 Preprocessor
*ModuleExpanderPP
) override
;
48 void storeOptions(ClangTidyOptions::OptionMap
&Opts
) override
;
50 const StringRef
&getMacroName() const { return MacroName
; }
53 const StringRef MacroName
;
56 } // namespace clang::tidy::modernize
58 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_REPLACEDISALLOWCOPYANDASSIGNMACROCHECK_H