This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG90f85dfc14bc: [SyntaxTree] Group tests related to `using` (authored by eduucaldas).
Changed prior to commit: https://reviews.llvm.org/D86443?vs=287334&id=287389#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86443/new/ https://reviews.llvm.org/D86443 Files: clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
Index: clang/unittests/Tooling/Syntax/BuildTreeTest.cpp =================================================================== --- clang/unittests/Tooling/Syntax/BuildTreeTest.cpp +++ clang/unittests/Tooling/Syntax/BuildTreeTest.cpp @@ -2494,7 +2494,7 @@ )txt"})); } -TEST_P(SyntaxTreeTest, UsingDeclaration) { +TEST_P(SyntaxTreeTest, UsingDeclaration_Namespace) { if (!GetParam().isCXX()) { return; } @@ -2515,6 +2515,59 @@ )txt"})); } +TEST_P(SyntaxTreeTest, UsingDeclaration_ClassMember) { + if (!GetParam().isCXX()) { + return; + } + EXPECT_TRUE(treeDumpEqualOnAnnotations( + R"cpp( +template <class T> struct X { + [[using T::foo;]] + [[using typename T::bar;]] +}; +)cpp", + {R"txt( +UsingDeclaration +|-using +|-NestedNameSpecifier +| |-IdentifierNameSpecifier +| | `-T +| `-:: +|-foo +`-; +)txt", + R"txt( +UsingDeclaration +|-using +|-typename +|-NestedNameSpecifier +| |-IdentifierNameSpecifier +| | `-T +| `-:: +|-bar +`-; +)txt"})); +} + +TEST_P(SyntaxTreeTest, UsingTypeAlias) { + if (!GetParam().isCXX()) { + return; + } + EXPECT_TRUE(treeDumpEqual( + R"cpp( +using type = int; +)cpp", + R"txt( +*: TranslationUnit +`-TypeAliasDeclaration + |-using + |-type + |-= + |-int + `-; +)txt")); +} + TEST_P(SyntaxTreeTest, FreeStandingClass_ForwardDeclaration) { EXPECT_TRUE(treeDumpEqualOnAnnotations( R"cpp( @@ -3005,52 +3058,6 @@ )txt")); } -TEST_P(SyntaxTreeTest, TemplatesUsingUsing) { - if (!GetParam().isCXX()) { - return; - } - EXPECT_TRUE(treeDumpEqual( - R"cpp( -template <class T> struct X { - using T::foo; - using typename T::bar; -}; -)cpp", - R"txt( -*: TranslationUnit -`-TemplateDeclaration - |-template - |-< - |-UnknownDeclaration - | |-class - | `-T - |-> - `-SimpleDeclaration - |-struct - |-X - |-{ - |-UsingDeclaration - | |-using - | |-NestedNameSpecifier - | | |-IdentifierNameSpecifier - | | | `-T - | | `-:: - | |-foo - | `-; - |-UsingDeclaration - | |-using - | |-typename - | |-NestedNameSpecifier - | | |-IdentifierNameSpecifier - | | | `-T - | | `-:: - | |-bar - | `-; - |-} - `-; -)txt")); -} - TEST_P(SyntaxTreeTest, ExplicitClassTemplateInstantation_Definition) { if (!GetParam().isCXX()) { return; @@ -3152,25 +3159,6 @@ )txt"})); } -TEST_P(SyntaxTreeTest, UsingType) { - if (!GetParam().isCXX()) { - return; - } - EXPECT_TRUE(treeDumpEqual( - R"cpp( -using type = int; -)cpp", - R"txt( -*: TranslationUnit -`-TypeAliasDeclaration - |-using - |-type - |-= - |-int - `-; -)txt")); -} - TEST_P(SyntaxTreeTest, EmptyDeclaration) { EXPECT_TRUE(treeDumpEqual( R"cpp(
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits