|
8 | 8 |
|
9 | 9 | #include "MethodHidingCheck.h"
|
10 | 10 | #include "clang/ASTMatchers/ASTMatchFinder.h"
|
| 11 | +#include "clang/ASTMatchers/ASTMatchers.h" |
11 | 12 | #include <stack>
|
12 | 13 |
|
13 | 14 | using namespace clang::ast_matchers;
|
@@ -39,14 +40,6 @@ bool namesCollide(const CXXMethodDecl &Lhs, const CXXMethodDecl &Rhs) {
|
39 | 40 | for (unsigned int It = 0; It < Lhs.getNumParams(); ++It)
|
40 | 41 | if (!sameBasicType(Lhs.getParamDecl(It), Rhs.getParamDecl(It)))
|
41 | 42 | return false;
|
42 |
| - // Templates are not handled yet |
43 |
| - if (Lhs.isTemplated() || Rhs.isTemplated()) |
44 |
| - return false; |
45 |
| - if (Lhs.isTemplateInstantiation() || Rhs.isTemplateInstantiation()) |
46 |
| - return false; |
47 |
| - if (Lhs.isFunctionTemplateSpecialization() || |
48 |
| - Rhs.isFunctionTemplateSpecialization()) |
49 |
| - return false; |
50 | 43 | return true;
|
51 | 44 | }
|
52 | 45 |
|
@@ -97,9 +90,11 @@ void MethodHidingCheck::registerMatchers(MatchFinder *Finder) {
|
97 | 90 | Finder->addMatcher(
|
98 | 91 | cxxMethodDecl(
|
99 | 92 | unless(anyOf(isOutOfLine(), isStaticStorageClass(), isImplicit(),
|
100 |
| - cxxConstructorDecl(), isOverride(), |
| 93 | + cxxConstructorDecl(), isOverride(), isPrivate(), |
101 | 94 | // isFinal(), //included with isOverride,
|
102 |
| - isPrivate())), |
| 95 | + // Templates are not handled yet |
| 96 | + ast_matchers::isTemplateInstantiation(), |
| 97 | + ast_matchers::isExplicitTemplateSpecialization())), |
103 | 98 | ofClass(cxxRecordDecl(
|
104 | 99 | isDerivedFrom(cxxRecordDecl(unless(isInStdNamespace()))))
|
105 | 100 | .bind("derived_class")),
|
|
0 commit comments