diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h --- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -2102,6 +2102,8 @@ return UO_Minus; case OO_Amp: return UO_AddrOf; + case OO_Star: + return UO_Deref; case OO_Tilde: return UO_Not; case OO_Exclaim: diff --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp --- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp @@ -1893,6 +1893,23 @@ cxxOperatorCallExpr( forFunction(functionDecl(hasName("plusIntOperator"))), hasOperatorName("+"), hasUnaryOperand(expr()))))); + + Code = R"cpp( +struct HasOpArrow +{ + int& operator*(); +}; +void foo() +{ + HasOpArrow s1; + *s1; +} +)cpp"; + + EXPECT_TRUE( + matches(Code, traverse(TK_IgnoreUnlessSpelledInSource, + cxxOperatorCallExpr(hasOperatorName("*"), + hasUnaryOperand(expr()))))); } TEST(Matcher, UnaryOperatorTypes) {