diff options
Diffstat (limited to 'clang/unittests/Tooling/Syntax/TreeTest.cpp')
-rw-r--r-- | clang/unittests/Tooling/Syntax/TreeTest.cpp | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/clang/unittests/Tooling/Syntax/TreeTest.cpp b/clang/unittests/Tooling/Syntax/TreeTest.cpp index 7a438f1..094a495 100644 --- a/clang/unittests/Tooling/Syntax/TreeTest.cpp +++ b/clang/unittests/Tooling/Syntax/TreeTest.cpp @@ -1129,6 +1129,61 @@ void test(S s) { )txt")); } +TEST_P(SyntaxTreeTest, ParenExpr) { + EXPECT_TRUE(treeDumpEqual( + R"cpp( +void test() { + (1); + ((1)); + (1 + (2)); +} +)cpp", + R"txt( +*: TranslationUnit +`-SimpleDeclaration + |-void + |-SimpleDeclarator + | |-test + | `-ParametersAndQualifiers + | |-( + | `-) + `-CompoundStatement + |-{ + |-ExpressionStatement + | |-ParenExpression + | | |-( + | | |-IntegerLiteralExpression + | | | `-1 + | | `-) + | `-; + |-ExpressionStatement + | |-ParenExpression + | | |-( + | | |-ParenExpression + | | | |-( + | | | |-IntegerLiteralExpression + | | | | `-1 + | | | `-) + | | `-) + | `-; + |-ExpressionStatement + | |-ParenExpression + | | |-( + | | |-BinaryOperatorExpression + | | | |-IntegerLiteralExpression + | | | | `-1 + | | | |-+ + | | | `-ParenExpression + | | | |-( + | | | |-IntegerLiteralExpression + | | | | `-2 + | | | `-) + | | `-) + | `-; + `-} +)txt")); +} + TEST_P(SyntaxTreeTest, IntegerLiteral) { EXPECT_TRUE(treeDumpEqual( R"cpp( @@ -2040,7 +2095,7 @@ void test(int a, int b) { |-{ |-ExpressionStatement | |-BinaryOperatorExpression - | | |-UnknownExpression + | | |-ParenExpression | | | |-( | | | |-BinaryOperatorExpression | | | | |-IntegerLiteralExpression @@ -2050,7 +2105,7 @@ void test(int a, int b) { | | | | `-2 | | | `-) | | |-* - | | `-UnknownExpression + | | `-ParenExpression | | |-( | | |-BinaryOperatorExpression | | | |-IntegerLiteralExpression |