teemperor updated this revision to Diff 182761.
teemperor added a comment.

- Added a comment that the using directives are created by Sema.

Also sorry for the late update :)


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

https://reviews.llvm.org/D51178

Files:
  test/Import/cxx-anon-namespace/Inputs/F.cpp
  test/Import/cxx-anon-namespace/test.cpp


Index: test/Import/cxx-anon-namespace/test.cpp
===================================================================
--- /dev/null
+++ test/Import/cxx-anon-namespace/test.cpp
@@ -0,0 +1,45 @@
+// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | 
FileCheck %s
+
+// The implicit UsingDirectiveDecls for the anonymous namespaces are created 
by the Sema.
+
+// CHECK: NamespaceDecl
+// The nested anonymous namespace.
+// CHECK-NEXT: NamespaceDecl
+// CHECK: FunctionDecl
+// CHECK-SAME: func4
+// CHECK-NEXT: CompoundStmt
+// This is for the nested anonymous namespace.
+// CHECK-NEXT: UsingDirectiveDecl
+// CHECK-SAME: ''
+// CHECK: FunctionDecl
+// CHECK-SAME: func1
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: UsingDirectiveDecl
+// CHECK-SAME: ''
+
+// CHECK: NamespaceDecl
+// CHECK-SAME: test_namespace1
+// CHECK-NEXT: NamespaceDecl
+// CHECK: FunctionDecl
+// CHECK-SAME: func2
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: UsingDirectiveDecl
+// CHECK-SAME: ''
+
+// CHECK-NEXT: NamespaceDecl
+// CHECK-SAME: test_namespace2
+// CHECK-NEXT: NamespaceDecl
+// CHECK-NEXT: NamespaceDecl
+// CHECK-SAME: test_namespace3
+// CHECK: FunctionDecl
+// CHECK-SAME: func3
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: UsingDirectiveDecl
+// CHECK-SAME: ''
+
+void expr() {
+  func1();
+  test_namespace1::func2();
+  test_namespace2::test_namespace3::func3();
+  func4();
+}
Index: test/Import/cxx-anon-namespace/Inputs/F.cpp
===================================================================
--- /dev/null
+++ test/Import/cxx-anon-namespace/Inputs/F.cpp
@@ -0,0 +1,25 @@
+namespace {
+void func1() {
+}
+} // namespace
+
+namespace test_namespace1 {
+namespace {
+void func2() {}
+} // namespace
+} // namespace test_namespace1
+
+namespace test_namespace2 {
+namespace {
+namespace test_namespace3 {
+void func3() {}
+} // namespace test_namespace3
+} // namespace
+} // namespace test_namespace2
+
+namespace {
+namespace {
+void func4() {
+}
+} // namespace
+} // namespace


Index: test/Import/cxx-anon-namespace/test.cpp
===================================================================
--- /dev/null
+++ test/Import/cxx-anon-namespace/test.cpp
@@ -0,0 +1,45 @@
+// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s
+
+// The implicit UsingDirectiveDecls for the anonymous namespaces are created by the Sema.
+
+// CHECK: NamespaceDecl
+// The nested anonymous namespace.
+// CHECK-NEXT: NamespaceDecl
+// CHECK: FunctionDecl
+// CHECK-SAME: func4
+// CHECK-NEXT: CompoundStmt
+// This is for the nested anonymous namespace.
+// CHECK-NEXT: UsingDirectiveDecl
+// CHECK-SAME: ''
+// CHECK: FunctionDecl
+// CHECK-SAME: func1
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: UsingDirectiveDecl
+// CHECK-SAME: ''
+
+// CHECK: NamespaceDecl
+// CHECK-SAME: test_namespace1
+// CHECK-NEXT: NamespaceDecl
+// CHECK: FunctionDecl
+// CHECK-SAME: func2
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: UsingDirectiveDecl
+// CHECK-SAME: ''
+
+// CHECK-NEXT: NamespaceDecl
+// CHECK-SAME: test_namespace2
+// CHECK-NEXT: NamespaceDecl
+// CHECK-NEXT: NamespaceDecl
+// CHECK-SAME: test_namespace3
+// CHECK: FunctionDecl
+// CHECK-SAME: func3
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: UsingDirectiveDecl
+// CHECK-SAME: ''
+
+void expr() {
+  func1();
+  test_namespace1::func2();
+  test_namespace2::test_namespace3::func3();
+  func4();
+}
Index: test/Import/cxx-anon-namespace/Inputs/F.cpp
===================================================================
--- /dev/null
+++ test/Import/cxx-anon-namespace/Inputs/F.cpp
@@ -0,0 +1,25 @@
+namespace {
+void func1() {
+}
+} // namespace
+
+namespace test_namespace1 {
+namespace {
+void func2() {}
+} // namespace
+} // namespace test_namespace1
+
+namespace test_namespace2 {
+namespace {
+namespace test_namespace3 {
+void func3() {}
+} // namespace test_namespace3
+} // namespace
+} // namespace test_namespace2
+
+namespace {
+namespace {
+void func4() {
+}
+} // namespace
+} // namespace
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D51178: [ASTImport... Raphael Isemann via Phabricator via cfe-commits

Reply via email to