2015-08-20 23:52:52 +08:00
|
|
|
//===--- MoveConstructorInitCheck.h - clang-tidy-----------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MOVECONSTRUCTORINITCHECK_H
|
|
|
|
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MOVECONSTRUCTORINITCHECK_H
|
|
|
|
|
|
|
|
#include "../ClangTidy.h"
|
2015-10-07 00:27:03 +08:00
|
|
|
#include "../utils/IncludeInserter.h"
|
|
|
|
|
|
|
|
#include <memory>
|
2015-08-20 23:52:52 +08:00
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace tidy {
|
|
|
|
|
2015-08-28 02:01:58 +08:00
|
|
|
/// The check flags user-defined move constructors that have a ctor-initializer
|
|
|
|
/// initializing a member or base class through a copy constructor instead of a
|
|
|
|
/// move constructor.
|
2015-10-07 00:27:03 +08:00
|
|
|
/// For the user-facing documentation see:
|
|
|
|
/// http://clang.llvm.org/extra/clang-tidy/checks/misc-move-constructor-init.html
|
2015-08-20 23:52:52 +08:00
|
|
|
class MoveConstructorInitCheck : public ClangTidyCheck {
|
|
|
|
public:
|
2015-10-07 00:27:03 +08:00
|
|
|
MoveConstructorInitCheck(StringRef Name, ClangTidyContext *Context);
|
2015-08-20 23:52:52 +08:00
|
|
|
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
|
|
|
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
2015-10-07 00:27:03 +08:00
|
|
|
void registerPPCallbacks(clang::CompilerInstance &Compiler) override;
|
|
|
|
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void
|
|
|
|
handleMoveConstructor(const ast_matchers::MatchFinder::MatchResult &Result);
|
|
|
|
void
|
|
|
|
handleParamNotMoved(const ast_matchers::MatchFinder::MatchResult &Result);
|
|
|
|
|
|
|
|
std::unique_ptr<IncludeInserter> Inserter;
|
|
|
|
const IncludeSorter::IncludeStyle IncludeStyle;
|
2016-01-08 23:50:51 +08:00
|
|
|
const bool UseCERTSemantics;
|
2015-08-20 23:52:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|
|
|
|
|
|
|
|
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MOVECONSTRUCTORINITCHECK_H
|