blob: 3b7dda06cc8aceaef2900847c5e8d100fbc044b7 [file] [log] [blame]
Aaron Ballman9392ced2015-08-20 15:52:52 +00001//===--- MoveConstructorInitCheck.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 Kornienko6e39e682017-11-27 13:06:28 +000010#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_MOVECONSTRUCTORINITCHECK_H
11#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_MOVECONSTRUCTORINITCHECK_H
Aaron Ballman9392ced2015-08-20 15:52:52 +000012
13#include "../ClangTidy.h"
Aaron Ballmanfc4e0422015-10-06 16:27:03 +000014#include "../utils/IncludeInserter.h"
15
16#include <memory>
Aaron Ballman9392ced2015-08-20 15:52:52 +000017
18namespace clang {
19namespace tidy {
Alexander Kornienko6e39e682017-11-27 13:06:28 +000020namespace performance {
Aaron Ballman9392ced2015-08-20 15:52:52 +000021
Alexander Kornienkof8ed0a82015-08-27 18:01:58 +000022/// The check flags user-defined move constructors that have a ctor-initializer
23/// initializing a member or base class through a copy constructor instead of a
24/// move constructor.
Aaron Ballmanfc4e0422015-10-06 16:27:03 +000025/// For the user-facing documentation see:
Alexander Kornienko6e39e682017-11-27 13:06:28 +000026/// http://clang.llvm.org/extra/clang-tidy/checks/performance-move-constructor-init.html
Aaron Ballman9392ced2015-08-20 15:52:52 +000027class MoveConstructorInitCheck : public ClangTidyCheck {
28public:
Aaron Ballmanfc4e0422015-10-06 16:27:03 +000029 MoveConstructorInitCheck(StringRef Name, ClangTidyContext *Context);
Aaron Ballman9392ced2015-08-20 15:52:52 +000030 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
31 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Aaron Ballmanfc4e0422015-10-06 16:27:03 +000032 void registerPPCallbacks(clang::CompilerInstance &Compiler) override;
33 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
34
35private:
Etienne Bergeron2a4c00f2016-05-03 02:54:05 +000036 std::unique_ptr<utils::IncludeInserter> Inserter;
37 const utils::IncludeSorter::IncludeStyle IncludeStyle;
Aaron Ballman9392ced2015-08-20 15:52:52 +000038};
39
Alexander Kornienko6e39e682017-11-27 13:06:28 +000040} // namespace performance
Aaron Ballman9392ced2015-08-20 15:52:52 +000041} // namespace tidy
42} // namespace clang
43
Alexander Kornienko6e39e682017-11-27 13:06:28 +000044#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_MOVECONSTRUCTORINITCHECK_H