eduucaldas created this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. eduucaldas added a subscriber: gribozavr2. eduucaldas marked an inline comment as done. eduucaldas added inline comments. eduucaldas marked an inline comment as not done.
================ Comment at: clang/unittests/Tooling/Syntax/TreeTest.cpp:829 + | | | | | `-:: + | | | | `-TypeSpecifier + | | | | |-S ---------------- Perhaps we shouldn't differ between specifiers as that is semantical information Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D81168 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 @@ -692,6 +692,152 @@ )txt")); } +TEST_P(SyntaxTreeTest, UnqualifiedId) { + if (!GetParam().isCXX()) { + return; + } + EXPECT_TRUE(treeDumpEqual( + R"cpp( +void test(int b) { + int a; + a = b; +} +)cpp", + R"txt( +*: TranslationUnit +`-SimpleDeclaration + |-void + |-SimpleDeclarator + | |-test + | `-ParametersAndQualifiers + | |-( + | |-SimpleDeclaration + | | |-int + | | `-SimpleDeclarator + | | `-b + | `-) + `-CompoundStatement + |-{ + |-DeclarationStatement + | |-SimpleDeclaration + | | |-int + | | `-SimpleDeclarator + | | `-a + | `-; + |-ExpressionStatement + | |-BinaryOperatorExpression + | | |-IdExpression + | | | `-UnqualifiedId + | | | `-a + | | |-= + | | `-IdExpression + | | `-UnqualifiedId + | | `-b + | `-; + `-} +)txt")); +} + +TEST_P(SyntaxTreeTest, QualifiedId) { + if (!GetParam().isCXX()) { + return; + } + EXPECT_TRUE(treeDumpEqual( + R"cpp( +namespace a { + namespace b { + struct S { + int i; + static void f(){} + }; + } +} +void test(int b) { + ::a::b::S::f(); +} +)cpp", + R"txt( +*: TranslationUnit +|-NamespaceDefinition +| |-namespace +| |-a +| |-{ +| |-NamespaceDefinition +| | |-namespace +| | |-b +| | |-{ +| | |-SimpleDeclaration +| | | |-struct +| | | |-S +| | | |-{ +| | | |-SimpleDeclaration +| | | | |-int +| | | | |-SimpleDeclarator +| | | | | `-i +| | | | `-; +| | | |-SimpleDeclaration +| | | | |-static +| | | | |-void +| | | | |-SimpleDeclarator +| | | | | |-f +| | | | | `-ParametersAndQualifiers +| | | | | |-( +| | | | | `-) +| | | | `-CompoundStatement +| | | | |-{ +| | | | `-} +| | | |-} +| | | `-; +| | `-} +| `-} +`-SimpleDeclaration + |-void + |-SimpleDeclarator + | |-test + | `-ParametersAndQualifiers + | |-( + | |-SimpleDeclaration + | | |-int + | | `-SimpleDeclarator + | | `-b + | `-) + `-CompoundStatement + |-{ + |-DeclarationStatement + | |-SimpleDeclaration + | | |-a + | | |-:: + | | |-b + | | |-:: + | | |-S + | | `-SimpleDeclarator + | | `-UnknownExpression + | | `-s + | `-; + |-ExpressionStatement + | |-UnknownExpression + | | |-IdExpression + | | | |-NameSpecifiers + | | | | |-GlobalNamespaceSpecifier + | | | | | `:: + | | | | |-NamespaceSpecifier + | | | | | |-a + | | | | | `-:: + | | | | |-NamespaceSpecifier + | | | | | |-b + | | | | | `-:: + | | | | `-TypeSpecifier + | | | | |-S + | | | | `-:: + | | | `-UnqualifiedId + | | | `-f + | | |-( + | | `-) + | `-; + `-} +)txt")); +} + TEST_P(SyntaxTreeTest, CxxNullPtrLiteral) { if (!GetParam().isCXX11OrLater()) { return;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits