[clang] 35a5e88 - [Syntax] NFC, Simplify a test with annotations

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 11 00:49:23 PST 2021


Author: Haojian Wu
Date: 2021-02-11T09:49:06+01:00
New Revision: 35a5e883906f11b63b60574d8737791448dd478f

URL: https://github.com/llvm/llvm-project/commit/35a5e883906f11b63b60574d8737791448dd478f
DIFF: https://github.com/llvm/llvm-project/commit/35a5e883906f11b63b60574d8737791448dd478f.diff

LOG: [Syntax] NFC, Simplify a test with annotations

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 1f950b05e3f1..a76557dcf803 100644
--- a/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
+++ b/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
@@ -4768,67 +4768,43 @@ TranslationUnit Detached
 }
 
 TEST_P(BuildSyntaxTreeTest, ParametersAndQualifiers_InFreeFunctions_Named) {
-  EXPECT_TRUE(treeDumpEqual(
+  EXPECT_TRUE(treeDumpEqualOnAnnotations(
       R"cpp(
-int func1(int a);
-int func2(int *ap);
-int func3(int a, float b);
-)cpp",
-      R"txt(
-TranslationUnit Detached
-|-SimpleDeclaration
-| |-'int'
-| |-DeclaratorList Declarators
-| | `-SimpleDeclarator ListElement
-| |   |-'func1'
-| |   `-ParametersAndQualifiers
-| |     |-'(' OpenParen
-| |     |-ParameterDeclarationList Parameters
-| |     | `-SimpleDeclaration ListElement
-| |     |   |-'int'
-| |     |   `-DeclaratorList Declarators
-| |     |     `-SimpleDeclarator ListElement
-| |     |       `-'a'
-| |     `-')' CloseParen
-| `-';'
-|-SimpleDeclaration
-| |-'int'
-| |-DeclaratorList Declarators
-| | `-SimpleDeclarator ListElement
-| |   |-'func2'
-| |   `-ParametersAndQualifiers
-| |     |-'(' OpenParen
-| |     |-ParameterDeclarationList Parameters
-| |     | `-SimpleDeclaration ListElement
-| |     |   |-'int'
-| |     |   `-DeclaratorList Declarators
-| |     |     `-SimpleDeclarator ListElement
-| |     |       |-'*'
-| |     |       `-'ap'
-| |     `-')' CloseParen
-| `-';'
-`-SimpleDeclaration
+     int func1([[int a]]);
+     int func2([[int *ap]]);
+     int func3([[int a, float b]]);
+   )cpp",
+      {R"txt(
+ParameterDeclarationList Parameters
+`-SimpleDeclaration ListElement
   |-'int'
-  |-DeclaratorList Declarators
-  | `-SimpleDeclarator ListElement
-  |   |-'func3'
-  |   `-ParametersAndQualifiers
-  |     |-'(' OpenParen
-  |     |-ParameterDeclarationList Parameters
-  |     | |-SimpleDeclaration ListElement
-  |     | | |-'int'
-  |     | | `-DeclaratorList Declarators
-  |     | |   `-SimpleDeclarator ListElement
-  |     | |     `-'a'
-  |     | |-',' ListDelimiter
-  |     | `-SimpleDeclaration ListElement
-  |     |   |-'float'
-  |     |   `-DeclaratorList Declarators
-  |     |     `-SimpleDeclarator ListElement
-  |     |       `-'b'
-  |     `-')' CloseParen
-  `-';'
-)txt"));
+  `-DeclaratorList Declarators
+    `-SimpleDeclarator ListElement
+      `-'a'
+)txt",
+       R"txt(
+ParameterDeclarationList Parameters
+`-SimpleDeclaration ListElement
+  |-'int'
+  `-DeclaratorList Declarators
+    `-SimpleDeclarator ListElement
+      |-'*'
+      `-'ap'
+)txt",
+       R"txt(
+ParameterDeclarationList Parameters
+|-SimpleDeclaration ListElement
+| |-'int'
+| `-DeclaratorList Declarators
+|   `-SimpleDeclarator ListElement
+|     `-'a'
+|-',' ListDelimiter
+`-SimpleDeclaration ListElement
+  |-'float'
+  `-DeclaratorList Declarators
+    `-SimpleDeclarator ListElement
+      `-'b'
+)txt"}));
 }
 
 TEST_P(BuildSyntaxTreeTest, ParametersAndQualifiers_InFreeFunctions_Unnamed) {


        


More information about the cfe-commits mailing list