1*c491c917SChris Cotter //===--- RvalueReferenceParamNotMovedCheck.h - clang-tidy -------*- C++ -*-===// 2*c491c917SChris Cotter // 3*c491c917SChris Cotter // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*c491c917SChris Cotter // See https://llvm.org/LICENSE.txt for license information. 5*c491c917SChris Cotter // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*c491c917SChris Cotter // 7*c491c917SChris Cotter //===----------------------------------------------------------------------===// 8*c491c917SChris Cotter 9*c491c917SChris Cotter #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_RVALUEREFERENCEPARAMNOTMOVEDCHECK_H 10*c491c917SChris Cotter #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_RVALUEREFERENCEPARAMNOTMOVEDCHECK_H 11*c491c917SChris Cotter 12*c491c917SChris Cotter #include "../ClangTidyCheck.h" 13*c491c917SChris Cotter 14*c491c917SChris Cotter namespace clang::tidy::cppcoreguidelines { 15*c491c917SChris Cotter 16*c491c917SChris Cotter /// Warns when an rvalue reference function parameter is never moved within 17*c491c917SChris Cotter /// the function body. This check implements CppCoreGuideline F.18. 18*c491c917SChris Cotter /// 19*c491c917SChris Cotter /// For the user-facing documentation see: 20*c491c917SChris Cotter /// http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/rvalue-reference-param-not-moved.html 21*c491c917SChris Cotter class RvalueReferenceParamNotMovedCheck : public ClangTidyCheck { 22*c491c917SChris Cotter public: 23*c491c917SChris Cotter RvalueReferenceParamNotMovedCheck(StringRef Name, ClangTidyContext *Context); 24*c491c917SChris Cotter void registerMatchers(ast_matchers::MatchFinder *Finder) override; 25*c491c917SChris Cotter void check(const ast_matchers::MatchFinder::MatchResult &Result) override; isLanguageVersionSupported(const LangOptions & LangOpts)26*c491c917SChris Cotter bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { 27*c491c917SChris Cotter return LangOpts.CPlusPlus11; 28*c491c917SChris Cotter } 29*c491c917SChris Cotter void storeOptions(ClangTidyOptions::OptionMap &Opts) override; 30*c491c917SChris Cotter 31*c491c917SChris Cotter private: 32*c491c917SChris Cotter const bool AllowPartialMove; 33*c491c917SChris Cotter const bool IgnoreUnnamedParams; 34*c491c917SChris Cotter const bool IgnoreNonDeducedTemplateTypes; 35*c491c917SChris Cotter }; 36*c491c917SChris Cotter 37*c491c917SChris Cotter } // namespace clang::tidy::cppcoreguidelines 38*c491c917SChris Cotter 39*c491c917SChris Cotter #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_RVALUEREFERENCEPARAMNOTMOVEDCHECK_H 40