blob: a2530f9314cfd3b1584ae03eae634aed7201555a [file] [log] [blame]
Samuel Benzaquenb5cbe012015-02-09 17:50:40 +00001//===--- AssignOperatorSignatureCheck.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
Alexander Kornienko66580552015-03-09 16:52:33 +000010#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_ASSIGNOPERATORSIGNATURECHECK_H
11#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_ASSIGNOPERATORSIGNATURECHECK_H
Samuel Benzaquenb5cbe012015-02-09 17:50:40 +000012
13#include "../ClangTidy.h"
14
15namespace clang {
16namespace tidy {
Alexander Kornienko2b3124202015-03-02 12:25:03 +000017namespace misc {
Samuel Benzaquenb5cbe012015-02-09 17:50:40 +000018
Alexander Kornienkof8ed0a82015-08-27 18:01:58 +000019/// Finds declarations of assign operators with the wrong return and/or argument
20/// types.
Samuel Benzaquenb5cbe012015-02-09 17:50:40 +000021///
Alexander Kornienkof8ed0a82015-08-27 18:01:58 +000022/// * The return type must be `Class&`.
23/// * Works with move-assign and assign by value.
24/// * Private and deleted operators are ignored.
Samuel Benzaquenb5cbe012015-02-09 17:50:40 +000025class AssignOperatorSignatureCheck : public ClangTidyCheck {
26public:
27 AssignOperatorSignatureCheck(StringRef Name, ClangTidyContext *Context)
28 : ClangTidyCheck(Name, Context) {}
29 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
30 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
31};
32
Alexander Kornienko2b3124202015-03-02 12:25:03 +000033} // namespace misc
Samuel Benzaquenb5cbe012015-02-09 17:50:40 +000034} // namespace tidy
35} // namespace clang
36
Alexander Kornienko66580552015-03-09 16:52:33 +000037#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_ASSIGNOPERATORSIGNATURECHECK_H