@@ -1681,7 +1681,13 @@ void MatchFinder::addMatcher(const DeclarationMatcher &NodeMatch,
16811681
16821682void MatchFinder::addMatcher (const TypeMatcher &NodeMatch,
16831683 MatchCallback *Action) {
1684- Matchers.Type .emplace_back (NodeMatch, Action);
1684+ std::optional<TraversalKind> TK;
1685+ if (Action)
1686+ TK = Action->getCheckTraversalKind ();
1687+ if (TK)
1688+ Matchers.Type .emplace_back (traverse (*TK, NodeMatch), Action);
1689+ else
1690+ Matchers.Type .emplace_back (NodeMatch, Action);
16851691 Matchers.AllCallbacks .insert (Action);
16861692}
16871693
@@ -1699,37 +1705,74 @@ void MatchFinder::addMatcher(const StatementMatcher &NodeMatch,
16991705
17001706void MatchFinder::addMatcher (const NestedNameSpecifierMatcher &NodeMatch,
17011707 MatchCallback *Action) {
1702- Matchers.NestedNameSpecifier .emplace_back (NodeMatch, Action);
1708+ std::optional<TraversalKind> TK;
1709+ if (Action)
1710+ TK = Action->getCheckTraversalKind ();
1711+ if (TK)
1712+ Matchers.NestedNameSpecifier .emplace_back (traverse (*TK, NodeMatch), Action);
1713+ else
1714+ Matchers.NestedNameSpecifier .emplace_back (NodeMatch, Action);
17031715 Matchers.AllCallbacks .insert (Action);
17041716}
17051717
17061718void MatchFinder::addMatcher (const NestedNameSpecifierLocMatcher &NodeMatch,
17071719 MatchCallback *Action) {
1708- Matchers.NestedNameSpecifierLoc .emplace_back (NodeMatch, Action);
1720+ std::optional<TraversalKind> TK;
1721+ if (Action)
1722+ TK = Action->getCheckTraversalKind ();
1723+ if (TK)
1724+ Matchers.NestedNameSpecifierLoc .emplace_back (traverse (*TK, NodeMatch),
1725+ Action);
1726+ else
1727+ Matchers.NestedNameSpecifierLoc .emplace_back (NodeMatch, Action);
17091728 Matchers.AllCallbacks .insert (Action);
17101729}
17111730
17121731void MatchFinder::addMatcher (const TypeLocMatcher &NodeMatch,
17131732 MatchCallback *Action) {
1714- Matchers.TypeLoc .emplace_back (NodeMatch, Action);
1733+ std::optional<TraversalKind> TK;
1734+ if (Action)
1735+ TK = Action->getCheckTraversalKind ();
1736+ if (TK)
1737+ Matchers.TypeLoc .emplace_back (traverse (*TK, NodeMatch), Action);
1738+ else
1739+ Matchers.TypeLoc .emplace_back (NodeMatch, Action);
17151740 Matchers.AllCallbacks .insert (Action);
17161741}
17171742
17181743void MatchFinder::addMatcher (const CXXCtorInitializerMatcher &NodeMatch,
17191744 MatchCallback *Action) {
1720- Matchers.CtorInit .emplace_back (NodeMatch, Action);
1745+ std::optional<TraversalKind> TK;
1746+ if (Action)
1747+ TK = Action->getCheckTraversalKind ();
1748+ if (TK)
1749+ Matchers.CtorInit .emplace_back (traverse (*TK, NodeMatch), Action);
1750+ else
1751+ Matchers.CtorInit .emplace_back (NodeMatch, Action);
17211752 Matchers.AllCallbacks .insert (Action);
17221753}
17231754
17241755void MatchFinder::addMatcher (const TemplateArgumentLocMatcher &NodeMatch,
17251756 MatchCallback *Action) {
1726- Matchers.TemplateArgumentLoc .emplace_back (NodeMatch, Action);
1757+ std::optional<TraversalKind> TK;
1758+ if (Action)
1759+ TK = Action->getCheckTraversalKind ();
1760+ if (TK)
1761+ Matchers.TemplateArgumentLoc .emplace_back (traverse (*TK, NodeMatch), Action);
1762+ else
1763+ Matchers.TemplateArgumentLoc .emplace_back (NodeMatch, Action);
17271764 Matchers.AllCallbacks .insert (Action);
17281765}
17291766
17301767void MatchFinder::addMatcher (const AttrMatcher &AttrMatch,
17311768 MatchCallback *Action) {
1732- Matchers.Attr .emplace_back (AttrMatch, Action);
1769+ std::optional<TraversalKind> TK;
1770+ if (Action)
1771+ TK = Action->getCheckTraversalKind ();
1772+ if (TK)
1773+ Matchers.Attr .emplace_back (traverse (*TK, AttrMatch), Action);
1774+ else
1775+ Matchers.Attr .emplace_back (AttrMatch, Action);
17331776 Matchers.AllCallbacks .insert (Action);
17341777}
17351778
0 commit comments