Fix isOverride() for the case of a dependent typed base class.
The method decl is not marked as overriding any other method decls until the template is instantiated. Use the override attribute as another signal. llvm-svn: 231487
This commit is contained in:
parent
298a3a0567
commit
bb5093fefd
|
|
@ -2993,7 +2993,7 @@ AST_MATCHER(CXXMethodDecl, isConst) {
|
|||
/// \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
|
||||
|
|
|
|||
|
|
@ -1790,6 +1790,9 @@ TEST(Matcher, MatchesOverridingMethod) {
|
|||
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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue