clang-tools  5.0.0
UnconventionalAssignOperatorCheck.h
Go to the documentation of this file.
1 //===--- UnconventionalAssignOperatorCheck.h - clang-tidy -------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_ASSIGNOPERATORSIGNATURECHECK_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_ASSIGNOPERATORSIGNATURECHECK_H
12 
13 #include "../ClangTidy.h"
14 
15 namespace clang {
16 namespace tidy {
17 namespace misc {
18 
19 /// Finds declarations of assignment operators with the wrong return and/or
20 /// argument types and definitions with good return type but wrong return
21 /// statements.
22 ///
23 /// * The return type must be `Class&`.
24 /// * Works with move-assign and assign by value.
25 /// * Private and deleted operators are ignored.
26 /// * The operator must always return ``*this``.
27 ///
28 /// For the user-facing documentation see:
29 /// http://clang.llvm.org/extra/clang-tidy/checks/misc-unconventional-assign-operator.html
31 public:
33  : ClangTidyCheck(Name, Context) {}
34  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
35  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
36 };
37 
38 } // namespace misc
39 } // namespace tidy
40 } // namespace clang
41 
42 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_ASSIGNOPERATORSIGNATURECHECK_H
StringHandle Name
std::unique_ptr< ast_matchers::MatchFinder > Finder
Definition: ClangTidy.cpp:275
UnconventionalAssignOperatorCheck(StringRef Name, ClangTidyContext *Context)
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Finds declarations of assignment operators with the wrong return and/or argument types and definition...
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.