[clang] b493e4c - [SyntaxTree] Split ConstVolatileQualifiers tests

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


Author: Eduardo Caldas
Date: 2020-08-25T06:07:40Z
New Revision: b493e4cb3e37401d4fe5c0b2ba1adf7e66758bb0

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

LOG: [SyntaxTree] Split ConstVolatileQualifiers tests

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

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 8ce83e927672..2ad01f09596e 100644
--- a/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
+++ b/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
@@ -3962,13 +3962,11 @@ int *(d)(int);
 )txt"));
 }
 
-TEST_P(SyntaxTreeTest, ConstVolatileQualifiers) {
+TEST_P(SyntaxTreeTest, Declaration_ConstVolatileQualifiers_SimpleConst) {
   EXPECT_TRUE(treeDumpEqual(
       R"cpp(
 const int west = -1;
 int const east = 1;
-const int const universal = 0;
-const int const *const *volatile b;
 )cpp",
       R"txt(
 *: TranslationUnit
@@ -3983,25 +3981,45 @@ const int const *const *volatile b;
 | |   `-IntegerLiteralExpression
 | |     `-1
 | `-;
-|-SimpleDeclaration
-| |-int
-| |-const
-| |-SimpleDeclarator
-| | |-east
-| | |-=
-| | `-IntegerLiteralExpression
-| |   `-1
-| `-;
-|-SimpleDeclaration
-| |-const
-| |-int
-| |-const
-| |-SimpleDeclarator
-| | |-universal
-| | |-=
-| | `-IntegerLiteralExpression
-| |   `-0
-| `-;
+`-SimpleDeclaration
+  |-int
+  |-const
+  |-SimpleDeclarator
+  | |-east
+  | |-=
+  | `-IntegerLiteralExpression
+  |   `-1
+  `-;
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, Declaration_ConstVolatileQualifiers_MultipleConst) {
+  EXPECT_TRUE(treeDumpEqual(
+      R"cpp(
+const int const universal = 0;
+)cpp",
+      R"txt(
+*: TranslationUnit
+`-SimpleDeclaration
+  |-const
+  |-int
+  |-const
+  |-SimpleDeclarator
+  | |-universal
+  | |-=
+  | `-IntegerLiteralExpression
+  |   `-0
+  `-;
+)txt"));
+}
+
+TEST_P(SyntaxTreeTest, Declaration_ConstVolatileQualifiers_ConstAndVolatile) {
+  EXPECT_TRUE(treeDumpEqual(
+      R"cpp(
+const int const *const *volatile b;
+)cpp",
+      R"txt(
+*: TranslationUnit
 `-SimpleDeclaration
   |-const
   |-int


        


More information about the cfe-commits mailing list