diff --git a/clang/unittests/Tooling/Syntax/TreeTest.cpp b/clang/unittests/Tooling/Syntax/TreeTest.cpp --- a/clang/unittests/Tooling/Syntax/TreeTest.cpp +++ b/clang/unittests/Tooling/Syntax/TreeTest.cpp @@ -2322,16 +2322,18 @@ friend bool operator<(const X&, const X&); friend X operator<<(X&, const X&); X operator,(X&); - // TODO: Fix crash on member function pointer and add a test for `->*` - // TODO: Unbox operators in syntax tree. + X operator->*(int); + // TODO: Unbox operators in syntax tree. // Represent operators by `+` instead of `IdExpression-UnqualifiedId-+` }; -void test(X x, X y) { +int X::*pmi; +void test(X x, X y, X* xp) { x = y; x + y; x < y; x << y; x, y; + xp->*pmi; } )cpp", R"txt( @@ -2430,8 +2432,28 @@ | | | | `-& | | | `-) | | `-; +| |-SimpleDeclaration +| | |-X +| | |-SimpleDeclarator +| | | |-operator +| | | |-->* +| | | `-ParametersAndQualifiers +| | | |-( +| | | |-SimpleDeclaration +| | | | `-int +| | | `-) +| | `-; | |-} | `-; +|-SimpleDeclaration +| |-int +| |-SimpleDeclarator +| | |-MemberPointer +| | | |-X +| | | |-:: +| | | `-* +| | `-pmi +| `-; `-SimpleDeclaration |-void |-SimpleDeclarator @@ -2447,6 +2469,12 @@ | | |-X | | `-SimpleDeclarator | | `-y + | |-, + | |-SimpleDeclaration + | | |-X + | | `-SimpleDeclarator + | | |-* + | | `-xp | `-) `-CompoundStatement |-{ @@ -2511,6 +2539,16 @@ | | `-UnqualifiedId | | `-y | `-; + |-ExpressionStatement + | |-BinaryOperatorExpression + | | |-IdExpression + | | | `-UnqualifiedId + | | | `-xp + | | |-->* + | | `-IdExpression + | | `-UnqualifiedId + | | `-pmi + | `-; `-} )txt")); }