[PATCH] D85185: [SyntaxTree] Add test coverage for `->*` operator
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGc5cdc3e801ad: [SyntaxTree] Add test coverage for `-*` operator (authored by eduucaldas). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85185/new/ https://reviews.llvm.org/D85185 Files: clang/unittests/Tooling/Syntax/TreeTest.cpp Index: clang/unittests/Tooling/Syntax/TreeTest.cpp === --- clang/unittests/Tooling/Syntax/TreeTest.cpp +++ 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")); } Index: clang/unittests/Tooling/Syntax/TreeTest.cpp === --- clang/unittests/Tooling/Syntax/TreeTest.cpp +++ 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")); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D85185: [SyntaxTree] Add test coverage for `->*` operator
eduucaldas updated this revision to Diff 283144. eduucaldas added a comment. Answer comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85185/new/ https://reviews.llvm.org/D85185 Files: clang/unittests/Tooling/Syntax/TreeTest.cpp Index: clang/unittests/Tooling/Syntax/TreeTest.cpp === --- clang/unittests/Tooling/Syntax/TreeTest.cpp +++ clang/unittests/Tooling/Syntax/TreeTest.cpp @@ -2322,16 +2322,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( @@ -2430,6 +2431,17 @@ | | | | `-& | | | `-) | | `-; +| |-SimpleDeclaration +| | |-X +| | |-SimpleDeclarator +| | | |-operator +| | | |-->* +| | | `-ParametersAndQualifiers +| | | |-( +| | | |-SimpleDeclaration +| | | | `-int +| | | `-) +| | `-; | |-} | `-; `-SimpleDeclaration @@ -2447,6 +2459,21 @@ | | |-X | | `-SimpleDeclarator | | `-y + | |-, + | |-SimpleDeclaration + | | |-X + | | `-SimpleDeclarator + | | |-* + | | `-xp + | |-, + | |-SimpleDeclaration + | | |-int + | | `-SimpleDeclarator + | | |-MemberPointer + | | | |-X + | | | |-:: + | | | `-* + | | `-pmi | `-) `-CompoundStatement |-{ @@ -2511,6 +2538,16 @@ | | `-UnqualifiedId | | `-y | `-; +|-ExpressionStatement +| |-BinaryOperatorExpression +| | |-IdExpression +| | | `-UnqualifiedId +| | | `-xp +| | |-->* +| | `-IdExpression +| | `-UnqualifiedId +| | `-pmi +| `-; `-} )txt")); } Index: clang/unittests/Tooling/Syntax/TreeTest.cpp === --- clang/unittests/Tooling/Syntax/TreeTest.cpp +++ clang/unittests/Tooling/Syntax/TreeTest.cpp @@ -2322,16 +2322,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( @@ -2430,6 +2431,17 @@ | | | | `-& | | | `-) | | `-; +| |-SimpleDeclaration +| | |-X +| | |-SimpleDeclarator +| | | |-operator +| | | |-->* +| | | `-ParametersAndQualifiers +| | | |-( +| | | |-SimpleDeclaration +| | | | `-int +| | | `-) +| | `-; | |-} | `-; `-SimpleDeclaration @@ -2447,6 +2459,21 @@ | | |-X | | `-SimpleDeclarator | | `-y + | |-, + | |-SimpleDeclaration + | | |-X + | | `-SimpleDeclarator + | | |-* + | | `-xp + | |-, + | |-SimpleDeclaration + | | |-int + | | `-SimpleDeclarator + | | |-MemberPointer + | | | |-X + | | | |-:: + | | | `-* + | | `-pmi | `-) `-CompoundStatement |-{ @@ -2511,6 +2538,16 @@ | | `-UnqualifiedId | | `-y | `-; +|-ExpressionStatement +| |-BinaryOperatorExpression +| | |-IdExpression +| | | `-UnqualifiedId +| | | `-xp +| | |-->* +| | `-IdExpression +| | `-UnqualifiedId +| | `-pmi +| `-; `-} )txt")); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D85185: [SyntaxTree] Add test coverage for `->*` operator
gribozavr2 accepted this revision. gribozavr2 added inline comments. This revision is now accepted and ready to land. Comment at: clang/unittests/Tooling/Syntax/TreeTest.cpp:2330 +int X::*pmi; +void test(X x, X y, X* xp) { x = y; Could you add `pmi` as a function parameter (for consistency)? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85185/new/ https://reviews.llvm.org/D85185 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D85185: [SyntaxTree] Add test coverage for `->*` operator
eduucaldas created this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. eduucaldas requested review of this revision. This was the last binary operator that we supported but didn't have any test coverage. The recent fix in a crash in member pointers allowed us to add this test. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D85185 Files: clang/unittests/Tooling/Syntax/TreeTest.cpp Index: clang/unittests/Tooling/Syntax/TreeTest.cpp === --- clang/unittests/Tooling/Syntax/TreeTest.cpp +++ 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")); } Index: clang/unittests/Tooling/Syntax/TreeTest.cpp === --- clang/unittests/Tooling/Syntax/TreeTest.cpp +++ 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")); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits