eduucaldas updated this revision to Diff 285273.
eduucaldas marked 11 inline comments as done.
eduucaldas added a comment.

Answer review comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85819/new/

https://reviews.llvm.org/D85819

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
@@ -1145,6 +1145,72 @@
 )txt"));
 }
 
+TEST_P(SyntaxTreeTest, QualifiedId_DecltypeSpecifier) {
+  if (!GetParam().isCXX11OrLater()) {
+    return;
+  }
+  EXPECT_TRUE(treeDumpEqual(
+      R"cpp(
+struct S {
+  static void f(){}
+};
+void test(S s) {
+  decltype(s)::f();
+}
+)cpp",
+      R"txt(
+*: TranslationUnit
+|-SimpleDeclaration
+| |-struct
+| |-S
+| |-{
+| |-SimpleDeclaration
+| | |-static
+| | |-void
+| | |-SimpleDeclarator
+| | | |-f
+| | | `-ParametersAndQualifiers
+| | |   |-(
+| | |   `-)
+| | `-CompoundStatement
+| |   |-{
+| |   `-}
+| |-}
+| `-;
+`-SimpleDeclaration
+  |-void
+  |-SimpleDeclarator
+  | |-test
+  | `-ParametersAndQualifiers
+  |   |-(
+  |   |-SimpleDeclaration
+  |   | |-S
+  |   | `-SimpleDeclarator
+  |   |   `-s
+  |   `-)
+  `-CompoundStatement
+    |-{
+    |-ExpressionStatement
+    | |-UnknownExpression
+    | | |-IdExpression
+    | | | |-NestedNameSpecifier
+    | | | | |-DecltypeNameSpecifier
+    | | | | | |-decltype
+    | | | | | |-(
+    | | | | | |-IdExpression
+    | | | | | | `-UnqualifiedId
+    | | | | | |   `-s
+    | | | | | `-)
+    | | | | `-::
+    | | | `-UnqualifiedId
+    | | |   `-f
+    | | |-(
+    | | `-)
+    | `-;
+    `-}
+)txt"));
+}
+
 TEST_P(SyntaxTreeTest, QualifiedId_OptionalTemplateKw) {
   if (!GetParam().isCXX()) {
     return;
@@ -1235,11 +1301,11 @@
   EXPECT_TRUE(treeDumpEqual(
       R"cpp(
 namespace n {
-    template<typename T>
-    struct ST {
-      template<typename U>
-      static U f();
-    };
+  template<typename T>
+  struct ST {
+    template<typename U>
+    static U f();
+  };
 }
 void test() {
   ::n::template ST<int>::template f<int>();
@@ -1409,72 +1475,6 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, QualifiedId_Decltype) {
-  if (!GetParam().isCXX11OrLater()) {
-    return;
-  }
-  EXPECT_TRUE(treeDumpEqual(
-      R"cpp(
-struct S {
-  static void f(){}
-};
-void test(S s) {
-  decltype(s)::f();
-}
-)cpp",
-      R"txt(
-*: TranslationUnit
-|-SimpleDeclaration
-| |-struct
-| |-S
-| |-{
-| |-SimpleDeclaration
-| | |-static
-| | |-void
-| | |-SimpleDeclarator
-| | | |-f
-| | | `-ParametersAndQualifiers
-| | |   |-(
-| | |   `-)
-| | `-CompoundStatement
-| |   |-{
-| |   `-}
-| |-}
-| `-;
-`-SimpleDeclaration
-  |-void
-  |-SimpleDeclarator
-  | |-test
-  | `-ParametersAndQualifiers
-  |   |-(
-  |   |-SimpleDeclaration
-  |   | |-S
-  |   | `-SimpleDeclarator
-  |   |   `-s
-  |   `-)
-  `-CompoundStatement
-    |-{
-    |-ExpressionStatement
-    | |-UnknownExpression
-    | | |-IdExpression
-    | | | |-NestedNameSpecifier
-    | | | | |-DecltypeNameSpecifier
-    | | | | | |-decltype
-    | | | | | |-(
-    | | | | | |-IdExpression
-    | | | | | | `-UnqualifiedId
-    | | | | | |   `-s
-    | | | | | `-)
-    | | | | `-::
-    | | | `-UnqualifiedId
-    | | |   `-f
-    | | |-(
-    | | `-)
-    | `-;
-    `-}
-)txt"));
-}
-
 TEST_P(SyntaxTreeTest, ParenExpr) {
   EXPECT_TRUE(treeDumpEqual(
       R"cpp(
@@ -2643,7 +2643,7 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, NestedBinaryOperator_Parenthesis) {
+TEST_P(SyntaxTreeTest, BinaryOperator_NestedWithParenthesis) {
   EXPECT_TRUE(treeDumpEqual(
       R"cpp(
 void test() {
@@ -2687,7 +2687,7 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, NestedBinaryOperator_Associativity) {
+TEST_P(SyntaxTreeTest, BinaryOperator_Associativity) {
   EXPECT_TRUE(treeDumpEqual(
       R"cpp(
 void test(int a, int b) {
@@ -2747,7 +2747,7 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, NestedBinaryOperator_Precedence) {
+TEST_P(SyntaxTreeTest, BinaryOperator_Precedence) {
   EXPECT_TRUE(treeDumpEqual(
       R"cpp(
 void test() {
@@ -2802,7 +2802,7 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, UserDefinedOperator_Assignment) {
+TEST_P(SyntaxTreeTest, OverloadedOperator_Assignment) {
   if (!GetParam().isCXX()) {
     return;
   }
@@ -2870,7 +2870,7 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, UserDefinedOperator_Plus) {
+TEST_P(SyntaxTreeTest, OverloadedOperator_Plus) {
   if (!GetParam().isCXX()) {
     return;
   }
@@ -2943,7 +2943,7 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, UserDefinedOperator_Less) {
+TEST_P(SyntaxTreeTest, OverloadedOperator_Less) {
   if (!GetParam().isCXX()) {
     return;
   }
@@ -3018,7 +3018,7 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, UserDefinedOperator_Shift) {
+TEST_P(SyntaxTreeTest, OverloadedOperator_LeftShift) {
   if (!GetParam().isCXX()) {
     return;
   }
@@ -3092,7 +3092,7 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, UserDefinedOperator_Comma) {
+TEST_P(SyntaxTreeTest, OverloadedOperator_Comma) {
   if (!GetParam().isCXX()) {
     return;
   }
@@ -3158,7 +3158,7 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, UserDefinedOperator_ArrowPointer) {
+TEST_P(SyntaxTreeTest, OverloadedOperator_PointerToMember) {
   if (!GetParam().isCXX()) {
     return;
   }
@@ -3227,17 +3227,17 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, UserDefinedOperator_PrefixIncr) {
+TEST_P(SyntaxTreeTest, OverloadedOperator_Negation) {
   if (!GetParam().isCXX()) {
     return;
   }
   EXPECT_TRUE(treeDumpEqual(
       R"cpp(
 struct X {
-  X operator++();
+  bool operator!();
 };
 void test(X x) {
-  ++x;
+  !x;
 }
 )cpp",
       R"txt(
@@ -3247,10 +3247,10 @@
 | |-X
 | |-{
 | |-SimpleDeclaration
-| | |-X
+| | |-bool
 | | |-SimpleDeclarator
 | | | |-operator
-| | | |-++
+| | | |-!
 | | | `-ParametersAndQualifiers
 | | |   |-(
 | | |   `-)
@@ -3272,7 +3272,7 @@
     |-{
     |-ExpressionStatement
     | |-PrefixUnaryOperatorExpression
-    | | |-++
+    | | |-!
     | | `-IdExpression
     | |   `-UnqualifiedId
     | |     `-x
@@ -3281,17 +3281,17 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, UserDefinedOperator_Exclam) {
+TEST_P(SyntaxTreeTest, OverloadedOperator_AddressOf) {
   if (!GetParam().isCXX()) {
     return;
   }
   EXPECT_TRUE(treeDumpEqual(
       R"cpp(
 struct X {
-  bool operator!();
+  X* operator&();
 };
 void test(X x) {
-  !x;
+  &x;
 }
 )cpp",
       R"txt(
@@ -3301,10 +3301,11 @@
 | |-X
 | |-{
 | |-SimpleDeclaration
-| | |-bool
+| | |-X
 | | |-SimpleDeclarator
+| | | |-*
 | | | |-operator
-| | | |-!
+| | | |-&
 | | | `-ParametersAndQualifiers
 | | |   |-(
 | | |   `-)
@@ -3326,7 +3327,7 @@
     |-{
     |-ExpressionStatement
     | |-PrefixUnaryOperatorExpression
-    | | |-!
+    | | |-&
     | | `-IdExpression
     | |   `-UnqualifiedId
     | |     `-x
@@ -3335,17 +3336,17 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, UserDefinedOperator_AddressOf) {
+TEST_P(SyntaxTreeTest, OverloadedOperator_PrefixIncrement) {
   if (!GetParam().isCXX()) {
     return;
   }
   EXPECT_TRUE(treeDumpEqual(
       R"cpp(
 struct X {
-  X* operator&();
+  X operator++();
 };
 void test(X x) {
-  &x;
+  ++x;
 }
 )cpp",
       R"txt(
@@ -3357,9 +3358,8 @@
 | |-SimpleDeclaration
 | | |-X
 | | |-SimpleDeclarator
-| | | |-*
 | | | |-operator
-| | | |-&
+| | | |-++
 | | | `-ParametersAndQualifiers
 | | |   |-(
 | | |   `-)
@@ -3381,7 +3381,7 @@
     |-{
     |-ExpressionStatement
     | |-PrefixUnaryOperatorExpression
-    | | |-&
+    | | |-++
     | | `-IdExpression
     | |   `-UnqualifiedId
     | |     `-x
@@ -3390,7 +3390,7 @@
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, UserDefinedOperator_PostfixIncr) {
+TEST_P(SyntaxTreeTest, OverloadedOperator_PostfixIncrement) {
   if (!GetParam().isCXX()) {
     return;
   }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to