[clang] ed83095 - [SyntaxTree] Use annotations to reduce noise on member function tests
Eduardo Caldas via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 24 07:32:01 PDT 2020
Author: Eduardo Caldas
Date: 2020-08-24T14:31:45Z
New Revision: ed83095254a3e212d14b293a6a0e6c85d1f3331c
URL: https://github.com/llvm/llvm-project/commit/ed83095254a3e212d14b293a6a0e6c85d1f3331c
DIFF: https://github.com/llvm/llvm-project/commit/ed83095254a3e212d14b293a6a0e6c85d1f3331c.diff
LOG: [SyntaxTree] Use annotations to reduce noise on member function tests
Differential Revision: https://reviews.llvm.org/D86439
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 a8e675468257..93f510e0a890 100644
--- a/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
+++ b/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
@@ -2570,61 +2570,47 @@ TEST_P(SyntaxTreeTest, StaticMemberFunction) {
if (!GetParam().isCXX11OrLater()) {
return;
}
- EXPECT_TRUE(treeDumpEqual(
+ EXPECT_TRUE(treeDumpEqualOnAnnotations(
R"cpp(
struct S {
- static void f(){}
+ [[static void f(){}]]
};
)cpp",
- R"txt(
-*: TranslationUnit
-`-SimpleDeclaration
- |-struct
- |-S
+ {R"txt(
+SimpleDeclaration
+|-static
+|-void
+|-SimpleDeclarator
+| |-f
+| `-ParametersAndQualifiers
+| |-(
+| `-)
+`-CompoundStatement
|-{
- |-SimpleDeclaration
- | |-static
- | |-void
- | |-SimpleDeclarator
- | | |-f
- | | `-ParametersAndQualifiers
- | | |-(
- | | `-)
- | `-CompoundStatement
- | |-{
- | `-}
- |-}
- `-;
-)txt"));
+ `-}
+)txt"}));
}
TEST_P(SyntaxTreeTest, ConversionMemberFunction) {
if (!GetParam().isCXX()) {
return;
}
- EXPECT_TRUE(treeDumpEqual(
+ EXPECT_TRUE(treeDumpEqualOnAnnotations(
R"cpp(
struct X {
- operator int();
+ [[operator int();]]
};
)cpp",
- R"txt(
-*: TranslationUnit
-`-SimpleDeclaration
- |-struct
- |-X
- |-{
- |-SimpleDeclaration
- | |-SimpleDeclarator
- | | |-operator
- | | |-int
- | | `-ParametersAndQualifiers
- | | |-(
- | | `-)
- | `-;
- |-}
- `-;
-)txt"));
+ {R"txt(
+SimpleDeclaration
+|-SimpleDeclarator
+| |-operator
+| |-int
+| `-ParametersAndQualifiers
+| |-(
+| `-)
+`-;
+)txt"}));
}
TEST_P(SyntaxTreeTest, LiteralOperatorDeclaration) {
@@ -2687,76 +2673,62 @@ TEST_P(SyntaxTreeTest, OverloadedOperatorDeclaration) {
if (!GetParam().isCXX()) {
return;
}
- EXPECT_TRUE(treeDumpEqual(
+ EXPECT_TRUE(treeDumpEqualOnAnnotations(
R"cpp(
struct X {
- X& operator=(const X&);
+ [[X& operator=(const X&);]]
};
)cpp",
- R"txt(
-*: TranslationUnit
-`-SimpleDeclaration
- |-struct
- |-X
- |-{
- |-SimpleDeclaration
- | |-X
- | |-SimpleDeclarator
- | | |-&
- | | |-operator
- | | |-=
- | | `-ParametersAndQualifiers
- | | |-(
- | | |-SimpleDeclaration
- | | | |-const
- | | | |-X
- | | | `-SimpleDeclarator
- | | | `-&
- | | `-)
- | `-;
- |-}
- `-;
-)txt"));
+ {R"txt(
+SimpleDeclaration
+|-X
+|-SimpleDeclarator
+| |-&
+| |-operator
+| |-=
+| `-ParametersAndQualifiers
+| |-(
+| |-SimpleDeclaration
+| | |-const
+| | |-X
+| | `-SimpleDeclarator
+| | `-&
+| `-)
+`-;
+)txt"}));
}
TEST_P(SyntaxTreeTest, OverloadedOperatorFriendDeclarataion) {
if (!GetParam().isCXX()) {
return;
}
- EXPECT_TRUE(treeDumpEqual(
+ EXPECT_TRUE(treeDumpEqualOnAnnotations(
R"cpp(
struct X {
- friend X operator+(X, const X&);
+ [[friend X operator+(X, const X&);]]
};
)cpp",
- R"txt(
-*: TranslationUnit
+ {R"txt(
+UnknownDeclaration
`-SimpleDeclaration
- |-struct
+ |-friend
|-X
- |-{
- |-UnknownDeclaration
- | `-SimpleDeclaration
- | |-friend
- | |-X
- | |-SimpleDeclarator
- | | |-operator
- | | |-+
- | | `-ParametersAndQualifiers
- | | |-(
- | | |-SimpleDeclaration
- | | | `-X
- | | |-,
- | | |-SimpleDeclaration
- | | | |-const
- | | | |-X
- | | | `-SimpleDeclarator
- | | | `-&
- | | `-)
- | `-;
- |-}
+ |-SimpleDeclarator
+ | |-operator
+ | |-+
+ | `-ParametersAndQualifiers
+ | |-(
+ | |-SimpleDeclaration
+ | | `-X
+ | |-,
+ | |-SimpleDeclaration
+ | | |-const
+ | | |-X
+ | | `-SimpleDeclarator
+ | | `-&
+ | `-)
`-;
-)txt"));
+)txt"}));
}
TEST_P(SyntaxTreeTest, ClassTemplateDeclaration) {
@@ -2847,38 +2819,31 @@ TEST_P(SyntaxTreeTest, StaticMemberFunctionTemplate) {
if (!GetParam().isCXX()) {
return;
}
- EXPECT_TRUE(treeDumpEqual(
+ EXPECT_TRUE(treeDumpEqualOnAnnotations(
R"cpp(
struct S {
- template<typename U>
- static U f();
+ [[template<typename U>
+ static U f();]]
};
)cpp",
- R"txt(
-*: TranslationUnit
+ {R"txt(
+TemplateDeclaration
+|-template
+|-<
+|-UnknownDeclaration
+| |-typename
+| `-U
+|->
`-SimpleDeclaration
- |-struct
- |-S
- |-{
- |-TemplateDeclaration
- | |-template
- | |-<
- | |-UnknownDeclaration
- | | |-typename
- | | `-U
- | |->
- | `-SimpleDeclaration
- | |-static
- | |-U
- | |-SimpleDeclarator
- | | |-f
- | | `-ParametersAndQualifiers
- | | |-(
- | | `-)
- | `-;
- |-}
+ |-static
+ |-U
+ |-SimpleDeclarator
+ | |-f
+ | `-ParametersAndQualifiers
+ | |-(
+ | `-)
`-;
-)txt"));
+)txt"}));
}
TEST_P(SyntaxTreeTest, NestedTemplates) {
More information about the cfe-commits
mailing list