clang-tools
20.0.0git
llvm-project
clang-tools-extra
clang-tidy
modernize
ReplaceDisallowCopyAndAssignMacroCheck.h
Go to the documentation of this file.
1
//===--- ReplaceDisallowCopyAndAssignMacroCheck.h - clang-tidy --*- C++ -*-===//
2
//
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
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_REPLACEDISALLOWCOPYANDASSIGNMACROCHECK_H
10
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_REPLACEDISALLOWCOPYANDASSIGNMACROCHECK_H
11
12
#include "../ClangTidyCheck.h"
13
14
namespace
clang::tidy::modernize
{
15
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
18
/// operator.
19
///
20
/// Before:
21
/// ~~~{.cpp}
22
/// class Foo {
23
/// private:
24
/// DISALLOW_COPY_AND_ASSIGN(Foo);
25
/// };
26
/// ~~~
27
///
28
/// After:
29
/// ~~~{.cpp}
30
/// class Foo {
31
/// private:
32
/// Foo(const Foo &) = delete;
33
/// const Foo &operator=(const Foo &) = delete;
34
/// };
35
/// ~~~
36
///
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
{
40
public
:
41
ReplaceDisallowCopyAndAssignMacroCheck
(StringRef
Name
,
42
ClangTidyContext
*Context);
43
bool
isLanguageVersionSupported
(
const
LangOptions &LangOpts)
const override
{
44
return
LangOpts.CPlusPlus11;
45
}
46
void
registerPPCallbacks
(
const
SourceManager &SM, Preprocessor *PP,
47
Preprocessor *ModuleExpanderPP)
override
;
48
void
storeOptions
(
ClangTidyOptions::OptionMap
&Opts)
override
;
49
50
const
StringRef &
getMacroName
()
const
{
return
MacroName; }
51
52
private
:
53
const
StringRef MacroName;
54
};
55
56
}
// namespace clang::tidy::modernize
57
58
#endif
// LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_REPLACEDISALLOWCOPYANDASSIGNMACROCHECK_H
Name
llvm::SmallString< 256U > Name
Definition:
ChainedComparisonCheck.cpp:42
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition:
ClangTidyCheck.h:53
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition:
ClangTidyDiagnosticConsumer.h:69
clang::tidy::modernize::ReplaceDisallowCopyAndAssignMacroCheck
This check finds macro expansions of DISALLOW_COPY_AND_ASSIGN(Type) and replaces them with a deleted ...
Definition:
ReplaceDisallowCopyAndAssignMacroCheck.h:39
clang::tidy::modernize::ReplaceDisallowCopyAndAssignMacroCheck::getMacroName
const StringRef & getMacroName() const
Definition:
ReplaceDisallowCopyAndAssignMacroCheck.h:50
clang::tidy::modernize::ReplaceDisallowCopyAndAssignMacroCheck::storeOptions
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
Definition:
ReplaceDisallowCopyAndAssignMacroCheck.cpp:84
clang::tidy::modernize::ReplaceDisallowCopyAndAssignMacroCheck::registerPPCallbacks
void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) override
Override this to register PPCallbacks in the preprocessor.
Definition:
ReplaceDisallowCopyAndAssignMacroCheck.cpp:77
clang::tidy::modernize::ReplaceDisallowCopyAndAssignMacroCheck::isLanguageVersionSupported
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override
Override this to disable registering matchers and PP callbacks if an invalid language version is bein...
Definition:
ReplaceDisallowCopyAndAssignMacroCheck.h:43
clang::tidy::modernize
Definition:
AvoidBindCheck.cpp:32
clang::tidy::ClangTidyOptions::OptionMap
llvm::StringMap< ClangTidyValue > OptionMap
Definition:
ClangTidyOptions.h:126
Generated on Sat Dec 21 2024 14:59:02 for clang-tools by
1.9.6