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 @@ -2329,16 +2329,17 @@ 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) { +void test(X x, X y, X* xp, int X::* pmi) { x = y; x + y; x < y; x << y; x, y; + xp->*pmi; } )cpp", R"txt( @@ -2437,6 +2438,17 @@ | | | | `-& | | | `-) | | `-; +| |-SimpleDeclaration +| | |-X +| | |-SimpleDeclarator +| | | |-operator +| | | |-->* +| | | `-ParametersAndQualifiers +| | | |-( +| | | |-SimpleDeclaration +| | | | `-int +| | | `-) +| | `-; | |-} | `-; `-SimpleDeclaration @@ -2454,6 +2466,21 @@ | | |-X | | `-SimpleDeclarator | | `-y + | |-, + | |-SimpleDeclaration + | | |-X + | | `-SimpleDeclarator + | | |-* + | | `-xp + | |-, + | |-SimpleDeclaration + | | |-int + | | `-SimpleDeclarator + | | |-MemberPointer + | | | |-X + | | | |-:: + | | | `-* + | | `-pmi | `-) `-CompoundStatement |-{ @@ -2518,6 +2545,16 @@ | | `-UnqualifiedId | | `-y | `-; + |-ExpressionStatement + | |-BinaryOperatorExpression + | | |-IdExpression + | | | `-UnqualifiedId + | | | `-xp + | | |-->* + | | `-IdExpression + | | `-UnqualifiedId + | | `-pmi + | `-; `-} )txt")); }