[clang] c5cdc3e - [SyntaxTree] Add test coverage for `->*` operator
Eduardo Caldas via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 5 00:50:54 PDT 2020
Author: Eduardo Caldas
Date: 2020-08-05T07:36:39Z
New Revision: c5cdc3e801ad1b0aceaf220d78a3ff3fab1e0fdb
URL: https://github.com/llvm/llvm-project/commit/c5cdc3e801ad1b0aceaf220d78a3ff3fab1e0fdb
DIFF: https://github.com/llvm/llvm-project/commit/c5cdc3e801ad1b0aceaf220d78a3ff3fab1e0fdb.diff
LOG: [SyntaxTree] Add test coverage for `->*` operator
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.
Differential Revision: https://reviews.llvm.org/D85185
Added:
Modified:
clang/unittests/Tooling/Syntax/TreeTest.cpp
Removed:
################################################################################
diff --git a/clang/unittests/Tooling/Syntax/TreeTest.cpp b/clang/unittests/Tooling/Syntax/TreeTest.cpp
index 3ccfabb95da9..e696be3dae7c 100644
--- a/clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ b/clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -2329,16 +2329,17 @@ struct X {
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 @@ void test(X x, X y) {
| | | | `-&
| | | `-)
| | `-;
+| |-SimpleDeclaration
+| | |-X
+| | |-SimpleDeclarator
+| | | |-operator
+| | | |-->*
+| | | `-ParametersAndQualifiers
+| | | |-(
+| | | |-SimpleDeclaration
+| | | | `-int
+| | | `-)
+| | `-;
| |-}
| `-;
`-SimpleDeclaration
@@ -2454,6 +2466,21 @@ void test(X x, X y) {
| | |-X
| | `-SimpleDeclarator
| | `-y
+ | |-,
+ | |-SimpleDeclaration
+ | | |-X
+ | | `-SimpleDeclarator
+ | | |-*
+ | | `-xp
+ | |-,
+ | |-SimpleDeclaration
+ | | |-int
+ | | `-SimpleDeclarator
+ | | |-MemberPointer
+ | | | |-X
+ | | | |-::
+ | | | `-*
+ | | `-pmi
| `-)
`-CompoundStatement
|-{
@@ -2518,6 +2545,16 @@ void test(X x, X y) {
| | `-UnqualifiedId
| | `-y
| `-;
+ |-ExpressionStatement
+ | |-BinaryOperatorExpression
+ | | |-IdExpression
+ | | | `-UnqualifiedId
+ | | | `-xp
+ | | |-->*
+ | | `-IdExpression
+ | | `-UnqualifiedId
+ | | `-pmi
+ | `-;
`-}
)txt"));
}
More information about the cfe-commits
mailing list