[clang] 90f85df - [SyntaxTree] Group tests related to `using`

Eduardo Caldas via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 24 07:32:07 PDT 2020


Author: Eduardo Caldas
Date: 2020-08-24T14:31:46Z
New Revision: 90f85dfc14bc6020486eb2d2c6399f8207ef3625

URL: https://github.com/llvm/llvm-project/commit/90f85dfc14bc6020486eb2d2c6399f8207ef3625
DIFF: https://github.com/llvm/llvm-project/commit/90f85dfc14bc6020486eb2d2c6399f8207ef3625.diff

LOG: [SyntaxTree] Group tests related to `using`

Differential Revision: https://reviews.llvm.org/D86443

Added: 
    

Modified: 
    clang/unittests/Tooling/Syntax/BuildTreeTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp b/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
index 4fc648df90b3..acbe90526fcb 100644
--- a/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
+++ b/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
@@ -2494,7 +2494,7 @@ UsingNamespaceDirective
 )txt"}));
 }
 
-TEST_P(SyntaxTreeTest, UsingDeclaration) {
+TEST_P(SyntaxTreeTest, UsingDeclaration_Namespace) {
   if (!GetParam().isCXX()) {
     return;
   }
@@ -2515,6 +2515,59 @@ UsingDeclaration
 )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 @@ template <class T> struct X<T>::Y {};
 )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 @@ TemplateDeclaration
 )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(


        


More information about the cfe-commits mailing list