The method decl is not marked as overriding any other method decls
until the template is instantiated.
Use the override attribute as another signal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231487
91177308-0d34-0410-b5e6-
96231b3b80d8
/// \endcode
/// matches B::x
AST_MATCHER(CXXMethodDecl, isOverride) {
- return Node.size_overridden_methods() > 0;
+ return Node.size_overridden_methods() > 0 || Node.hasAttr<OverrideAttr>();
}
/// \brief Matches member expressions that are called with '->' as opposed
methodDecl(isOverride())));
EXPECT_TRUE(notMatches("class X { int f(); int f(int); }; ",
methodDecl(isOverride())));
+ EXPECT_TRUE(
+ matches("template <typename Base> struct Y : Base { void f() override;};",
+ methodDecl(isOverride(), hasName("::Y::f"))));
}
TEST(Matcher, ConstructorCall) {