1*5902bb95SChris Cotter //===--- MissingStdForwardCheck.h - clang-tidy ------------------*- C++ -*-===// 2*5902bb95SChris Cotter // 3*5902bb95SChris Cotter // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*5902bb95SChris Cotter // See https://llvm.org/LICENSE.txt for license information. 5*5902bb95SChris Cotter // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*5902bb95SChris Cotter // 7*5902bb95SChris Cotter //===----------------------------------------------------------------------===// 8*5902bb95SChris Cotter 9*5902bb95SChris Cotter #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_MISSINGSTDFORWARDCHECK_H 10*5902bb95SChris Cotter #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_MISSINGSTDFORWARDCHECK_H 11*5902bb95SChris Cotter 12*5902bb95SChris Cotter #include "../ClangTidyCheck.h" 13*5902bb95SChris Cotter 14*5902bb95SChris Cotter namespace clang::tidy::cppcoreguidelines { 15*5902bb95SChris Cotter 16*5902bb95SChris Cotter /// Warns when a function accepting a forwarding reference does anything besides 17*5902bb95SChris Cotter /// forwarding (with std::forward) the parameter in the body of the function. 18*5902bb95SChris Cotter /// This check implement CppCoreGuideline F.19. 19*5902bb95SChris Cotter /// 20*5902bb95SChris Cotter /// For the user-facing documentation see: 21*5902bb95SChris Cotter /// http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/missing-std-forward.html 22*5902bb95SChris Cotter class MissingStdForwardCheck : public ClangTidyCheck { 23*5902bb95SChris Cotter public: MissingStdForwardCheck(StringRef Name,ClangTidyContext * Context)24*5902bb95SChris Cotter MissingStdForwardCheck(StringRef Name, ClangTidyContext *Context) 25*5902bb95SChris Cotter : ClangTidyCheck(Name, Context) {} 26*5902bb95SChris Cotter void registerMatchers(ast_matchers::MatchFinder *Finder) override; 27*5902bb95SChris Cotter void check(const ast_matchers::MatchFinder::MatchResult &Result) override; isLanguageVersionSupported(const LangOptions & LangOpts)28*5902bb95SChris Cotter bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { 29*5902bb95SChris Cotter return LangOpts.CPlusPlus11; 30*5902bb95SChris Cotter } getCheckTraversalKind()31*5902bb95SChris Cotter std::optional<TraversalKind> getCheckTraversalKind() const override { 32*5902bb95SChris Cotter return TK_IgnoreUnlessSpelledInSource; 33*5902bb95SChris Cotter } 34*5902bb95SChris Cotter }; 35*5902bb95SChris Cotter 36*5902bb95SChris Cotter } // namespace clang::tidy::cppcoreguidelines 37*5902bb95SChris Cotter 38*5902bb95SChris Cotter #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_MISSINGSTDFORWARDCHECK_H 39