eduucaldas created this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. eduucaldas requested review of this revision.
Some key choices to highlight: - Surround Tokens with "''" - Do not print `UnknownRole`, to reduce noise - Surround Roles with "<", to clarify the difference in meaning Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D85316 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 @@ -307,45 +307,45 @@ } )cpp", R"txt( -*: TranslationUnit +TranslationUnit <*> `-SimpleDeclaration - |-int - |-SimpleDeclarator - | |-main + |-'int' + |-SimpleDeclarator <SimpleDeclaration_declarator> + | |-'main' | `-ParametersAndQualifiers - | |-( - | `-) + | |-'(' <OpenParen> + | `-')' <CloseParen> `-CompoundStatement - |-{ - |-IfStatement - | |-if - | |-( + |-'{' <OpenParen> + |-IfStatement <CompoundStatement_statement> + | |-'if' <IntroducerKeyword> + | |-'(' | |-IntegerLiteralExpression - | | `-1 - | |-) - | `-CompoundStatement - | |-{ - | `-} - |-IfStatement - | |-if - | |-( + | | `-'1' <LiteralToken> + | |-')' + | `-CompoundStatement <IfStatement_thenStatement> + | |-'{' <OpenParen> + | `-'}' <CloseParen> + |-IfStatement <CompoundStatement_statement> + | |-'if' <IntroducerKeyword> + | |-'(' | |-IntegerLiteralExpression - | | `-1 - | |-) - | |-CompoundStatement - | | |-{ - | | `-} - | |-else - | `-IfStatement - | |-if - | |-( + | | `-'1' <LiteralToken> + | |-')' + | |-CompoundStatement <IfStatement_thenStatement> + | | |-'{' <OpenParen> + | | `-'}' <CloseParen> + | |-'else' <IfStatement_elseKeyword> + | `-IfStatement <IfStatement_elseStatement> + | |-'if' <IntroducerKeyword> + | |-'(' | |-IntegerLiteralExpression - | | `-0 - | |-) - | `-CompoundStatement - | |-{ - | `-} - `-} + | | `-'0' <LiteralToken> + | |-')' + | `-CompoundStatement <IfStatement_thenStatement> + | |-'{' <OpenParen> + | `-'}' <CloseParen> + `-'}' <CloseParen> )txt")); }
Index: clang/unittests/Tooling/Syntax/TreeTest.cpp =================================================================== --- clang/unittests/Tooling/Syntax/TreeTest.cpp +++ clang/unittests/Tooling/Syntax/TreeTest.cpp @@ -307,45 +307,45 @@ } )cpp", R"txt( -*: TranslationUnit +TranslationUnit <*> `-SimpleDeclaration - |-int - |-SimpleDeclarator - | |-main + |-'int' + |-SimpleDeclarator <SimpleDeclaration_declarator> + | |-'main' | `-ParametersAndQualifiers - | |-( - | `-) + | |-'(' <OpenParen> + | `-')' <CloseParen> `-CompoundStatement - |-{ - |-IfStatement - | |-if - | |-( + |-'{' <OpenParen> + |-IfStatement <CompoundStatement_statement> + | |-'if' <IntroducerKeyword> + | |-'(' | |-IntegerLiteralExpression - | | `-1 - | |-) - | `-CompoundStatement - | |-{ - | `-} - |-IfStatement - | |-if - | |-( + | | `-'1' <LiteralToken> + | |-')' + | `-CompoundStatement <IfStatement_thenStatement> + | |-'{' <OpenParen> + | `-'}' <CloseParen> + |-IfStatement <CompoundStatement_statement> + | |-'if' <IntroducerKeyword> + | |-'(' | |-IntegerLiteralExpression - | | `-1 - | |-) - | |-CompoundStatement - | | |-{ - | | `-} - | |-else - | `-IfStatement - | |-if - | |-( + | | `-'1' <LiteralToken> + | |-')' + | |-CompoundStatement <IfStatement_thenStatement> + | | |-'{' <OpenParen> + | | `-'}' <CloseParen> + | |-'else' <IfStatement_elseKeyword> + | `-IfStatement <IfStatement_elseStatement> + | |-'if' <IntroducerKeyword> + | |-'(' | |-IntegerLiteralExpression - | | `-0 - | |-) - | `-CompoundStatement - | |-{ - | `-} - `-} + | | `-'0' <LiteralToken> + | |-')' + | `-CompoundStatement <IfStatement_thenStatement> + | |-'{' <OpenParen> + | `-'}' <CloseParen> + `-'}' <CloseParen> )txt")); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits