================ @@ -0,0 +1,48 @@ +//===--- TemplateVirtualMemberFunctionCheck.cpp - clang-tidy --------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "TemplateVirtualMemberFunctionCheck.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" + +using namespace clang::ast_matchers; + +namespace clang::tidy::portability { + +void TemplateVirtualMemberFunctionCheck::registerMatchers(MatchFinder *Finder) { + Finder->addMatcher(classTemplateSpecializationDecl().bind("specialization"), + this); +} + +void TemplateVirtualMemberFunctionCheck::check( + const MatchFinder::MatchResult &Result) { + const auto *MatchedDecl = + Result.Nodes.getNodeAs<ClassTemplateSpecializationDecl>("specialization"); + + if (MatchedDecl->isExplicitSpecialization()) + return; ---------------- isuckatcs wrote:
I think we can ignore partial specializations too. A partial specialization is still a template, except it has _some_ parameters specified. Because of it still being a template, the same rules should apply for instantiating its member functions. For explicit specializations, the standard explicitly specifies that it's member functions should be treated as methods of regular classes and I think that's why they are instantiated even if they are not used. > ยง 13.9.4 6 [...] Members of an explicitly specialized class template are > defined in the same manner as members of normal classes, and not using the template<> syntax. [...] https://github.com/llvm/llvm-project/pull/110099 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits