eduucaldas updated this revision to Diff 286823.
eduucaldas marked 2 inline comments as done.
eduucaldas added a comment.
answer comments
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86139/new/
https://reviews.llvm.org/D86139
Files:
clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
Index: clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
===================================================================
--- clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
+++ clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
@@ -2454,7 +2454,7 @@
)txt"));
}
-TEST_P(SyntaxTreeTest, Namespaces) {
+TEST_P(SyntaxTreeTest, Namespace_Nested) {
if (!GetParam().isCXX()) {
return;
}
@@ -2462,9 +2462,6 @@
R"cpp(
namespace a { namespace b {} }
namespace a::b {}
-namespace {}
-
-namespace foo = a;
)cpp",
R"txt(
*: TranslationUnit
@@ -2478,82 +2475,91 @@
| | |-{
| | `-}
| `-}
-|-NamespaceDefinition
-| |-namespace
-| |-a
-| |-::
-| |-b
-| |-{
-| `-}
-|-NamespaceDefinition
-| |-namespace
-| |-{
-| `-}
-`-NamespaceAliasDefinition
+`-NamespaceDefinition
|-namespace
- |-foo
- |-=
|-a
- `-;
+ |-::
+ |-b
+ |-{
+ `-}
)txt"));
}
-TEST_P(SyntaxTreeTest, UsingDirective) {
+TEST_P(SyntaxTreeTest, Namespace_Unnamed) {
if (!GetParam().isCXX()) {
return;
}
EXPECT_TRUE(treeDumpEqual(
R"cpp(
-namespace ns {}
-using namespace ::ns;
+namespace {}
)cpp",
R"txt(
*: TranslationUnit
-|-NamespaceDefinition
-| |-namespace
-| |-ns
-| |-{
-| `-}
-`-UsingNamespaceDirective
- |-using
+`-NamespaceDefinition
|-namespace
- |-NestedNameSpecifier
- | `-::
- |-ns
- `-;
+ |-{
+ `-}
)txt"));
}
+TEST_P(SyntaxTreeTest, Namespace_Alias) {
+ if (!GetParam().isCXX()) {
+ return;
+ }
+ EXPECT_TRUE(treeDumpEqualOnAnnotations(
+ R"cpp(
+namespace a {}
+[[namespace foo = a;]]
+)cpp",
+ {R"txt(
+NamespaceAliasDefinition
+|-namespace
+|-foo
+|-=
+|-a
+`-;
+)txt"}));
+}
+
+TEST_P(SyntaxTreeTest, UsingDirective) {
+ if (!GetParam().isCXX()) {
+ return;
+ }
+ EXPECT_TRUE(treeDumpEqualOnAnnotations(
+ R"cpp(
+namespace ns {}
+[[using namespace ::ns;]]
+)cpp",
+ {R"txt(
+UsingNamespaceDirective
+|-using
+|-namespace
+|-NestedNameSpecifier
+| `-::
+|-ns
+`-;
+)txt"}));
+}
+
TEST_P(SyntaxTreeTest, UsingDeclaration) {
if (!GetParam().isCXX()) {
return;
}
- EXPECT_TRUE(treeDumpEqual(
+ EXPECT_TRUE(treeDumpEqualOnAnnotations(
R"cpp(
namespace ns { int a; }
-using ns::a;
+[[using ns::a;]]
)cpp",
- R"txt(
-*: TranslationUnit
-|-NamespaceDefinition
-| |-namespace
-| |-ns
-| |-{
-| |-SimpleDeclaration
-| | |-int
-| | |-SimpleDeclarator
-| | | `-a
-| | `-;
-| `-}
-`-UsingDeclaration
- |-using
- |-NestedNameSpecifier
- | |-IdentifierNameSpecifier
- | | `-ns
- | `-::
- |-a
- `-;
-)txt"));
+ {R"txt(
+UsingDeclaration
+|-using
+|-NestedNameSpecifier
+| |-IdentifierNameSpecifier
+| | `-ns
+| `-::
+|-a
+`-;
+)txt"}));
}
TEST_P(SyntaxTreeTest, FreeStandingClasses) {
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits