1*6d8e9665Sisuckatcs //===--- TemplateVirtualMemberFunctionCheck.h - clang-tidy ------*- C++ -*-===// 2*6d8e9665Sisuckatcs // 3*6d8e9665Sisuckatcs // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*6d8e9665Sisuckatcs // See https://llvm.org/LICENSE.txt for license information. 5*6d8e9665Sisuckatcs // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*6d8e9665Sisuckatcs // 7*6d8e9665Sisuckatcs //===----------------------------------------------------------------------===// 8*6d8e9665Sisuckatcs 9*6d8e9665Sisuckatcs #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PORTABILITY_TEMPLATEVIRTUALMEMBERFUNCTIONCHECK_H 10*6d8e9665Sisuckatcs #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PORTABILITY_TEMPLATEVIRTUALMEMBERFUNCTIONCHECK_H 11*6d8e9665Sisuckatcs 12*6d8e9665Sisuckatcs #include "../ClangTidyCheck.h" 13*6d8e9665Sisuckatcs 14*6d8e9665Sisuckatcs namespace clang::tidy::portability { 15*6d8e9665Sisuckatcs 16*6d8e9665Sisuckatcs /// Upon instantiating a template class, non-virtual member functions don't have 17*6d8e9665Sisuckatcs /// to be instantiated unless they are used. Virtual member function 18*6d8e9665Sisuckatcs /// instantiation on the other hand is unspecified and depends on the 19*6d8e9665Sisuckatcs /// implementation of the compiler. This check intends to find cases when a 20*6d8e9665Sisuckatcs /// virtual member function is not instantiated but it might be with a different 21*6d8e9665Sisuckatcs /// compiler. 22*6d8e9665Sisuckatcs /// 23*6d8e9665Sisuckatcs /// For the user-facing documentation see: 24*6d8e9665Sisuckatcs /// http://clang.llvm.org/extra/clang-tidy/checks/portability/template-virtual-member-function.html 25*6d8e9665Sisuckatcs class TemplateVirtualMemberFunctionCheck : public ClangTidyCheck { 26*6d8e9665Sisuckatcs public: 27*6d8e9665Sisuckatcs TemplateVirtualMemberFunctionCheck(StringRef Name, ClangTidyContext *Context) 28*6d8e9665Sisuckatcs : ClangTidyCheck(Name, Context) {} 29*6d8e9665Sisuckatcs void registerMatchers(ast_matchers::MatchFinder *Finder) override; 30*6d8e9665Sisuckatcs void check(const ast_matchers::MatchFinder::MatchResult &Result) override; 31*6d8e9665Sisuckatcs bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { 32*6d8e9665Sisuckatcs return LangOpts.CPlusPlus; 33*6d8e9665Sisuckatcs } 34*6d8e9665Sisuckatcs }; 35*6d8e9665Sisuckatcs 36*6d8e9665Sisuckatcs } // namespace clang::tidy::portability 37*6d8e9665Sisuckatcs 38*6d8e9665Sisuckatcs #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PORTABILITY_TEMPLATEVIRTUALMEMBERFUNCTIONCHECK_H 39