Skip to content

Commit bcdaf89

Browse files
egorzhdanGroverkss
authored andcommitted
[Clang] Dispatch default overloads of TemplateArgumentVisitor to the implementation
This fixes an issue where overriding `clang::ConstTemplateArgumentVisitor::VisitTemplateArgument` in an implementation visitor class did not have the desired effect: the overload was not invoked when one of the visitor methods (e.g. `VisitDeclarationArgument`) is not implemented, instead it dispatched to `clang::ConstTemplateArgumentVisitor::VisitTemplateArgument` itself and always returned a default-initialized result. This makes `TemplateArgumentVisitor` and `ConstTemplateArgumentVisitor` follow the implicit convention that is followed elsewhere in Clang AST, in `RecursiveASTVisitor` and `TypeVisitor`.
1 parent 7cd235b commit bcdaf89

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/include/clang/AST/TemplateArgumentVisitor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ class Base {
5252
#define VISIT_METHOD(CATEGORY) \
5353
RetTy Visit##CATEGORY##TemplateArgument(REF(TemplateArgument) TA, \
5454
ParamTys... P) { \
55-
return VisitTemplateArgument(TA, std::forward<ParamTys>(P)...); \
55+
return static_cast<ImplClass *>(this)->VisitTemplateArgument( \
56+
TA, std::forward<ParamTys>(P)...); \
5657
}
5758

5859
VISIT_METHOD(Null);

0 commit comments

Comments
 (0)