|
|
|||
File indexing completed on 2026-05-10 08:36:20
0001 //===--- ReplaceDisallowCopyAndAssignMacroCheck.h - clang-tidy --*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 0009 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_REPLACEDISALLOWCOPYANDASSIGNMACROCHECK_H 0010 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_REPLACEDISALLOWCOPYANDASSIGNMACROCHECK_H 0011 0012 #include "../ClangTidyCheck.h" 0013 0014 namespace clang::tidy::modernize { 0015 0016 /// This check finds macro expansions of ``DISALLOW_COPY_AND_ASSIGN(Type)`` and 0017 /// replaces them with a deleted copy constructor and a deleted assignment 0018 /// operator. 0019 /// 0020 /// Before: 0021 /// ~~~{.cpp} 0022 /// class Foo { 0023 /// private: 0024 /// DISALLOW_COPY_AND_ASSIGN(Foo); 0025 /// }; 0026 /// ~~~ 0027 /// 0028 /// After: 0029 /// ~~~{.cpp} 0030 /// class Foo { 0031 /// private: 0032 /// Foo(const Foo &) = delete; 0033 /// const Foo &operator=(const Foo &) = delete; 0034 /// }; 0035 /// ~~~ 0036 /// 0037 /// For the user-facing documentation see: 0038 /// http://clang.llvm.org/extra/clang-tidy/checks/modernize/replace-disallow-copy-and-assign-macro.html 0039 class ReplaceDisallowCopyAndAssignMacroCheck : public ClangTidyCheck { 0040 public: 0041 ReplaceDisallowCopyAndAssignMacroCheck(StringRef Name, 0042 ClangTidyContext *Context); 0043 bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { 0044 return LangOpts.CPlusPlus11; 0045 } 0046 void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP, 0047 Preprocessor *ModuleExpanderPP) override; 0048 void storeOptions(ClangTidyOptions::OptionMap &Opts) override; 0049 0050 const StringRef &getMacroName() const { return MacroName; } 0051 0052 private: 0053 const StringRef MacroName; 0054 }; 0055 0056 } // namespace clang::tidy::modernize 0057 0058 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_REPLACEDISALLOWCOPYANDASSIGNMACROCHECK_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|