diff options
| author | Raphael Isemann <teemperor@gmail.com> | 2019-01-21 10:14:31 +0000 |
|---|---|---|
| committer | Raphael Isemann <teemperor@gmail.com> | 2019-01-21 10:14:31 +0000 |
| commit | 4e4c0664f9b4c65e344317239b66271a67a800ad (patch) | |
| tree | e61fe20512e43b30e14f2b2e52efe8837c7a6275 | |
| parent | fd29980f0901142e0c382189d68b84b2fdbca69c (diff) | |
| download | bcm5719-llvm-4e4c0664f9b4c65e344317239b66271a67a800ad.tar.gz bcm5719-llvm-4e4c0664f9b4c65e344317239b66271a67a800ad.zip | |
[ASTImporter] Add test for importing anonymous namespaces.
Reviewers: a.sidorin, a_sidorin
Reviewed By: a_sidorin
Subscribers: a_sidorin, martong, cfe-commits
Differential Revision: https://reviews.llvm.org/D51178
llvm-svn: 351739
| -rw-r--r-- | clang/test/Import/cxx-anon-namespace/Inputs/F.cpp | 25 | ||||
| -rw-r--r-- | clang/test/Import/cxx-anon-namespace/test.cpp | 45 |
2 files changed, 70 insertions, 0 deletions
diff --git a/clang/test/Import/cxx-anon-namespace/Inputs/F.cpp b/clang/test/Import/cxx-anon-namespace/Inputs/F.cpp new file mode 100644 index 00000000000..83764866bbe --- /dev/null +++ b/clang/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 diff --git a/clang/test/Import/cxx-anon-namespace/test.cpp b/clang/test/Import/cxx-anon-namespace/test.cpp new file mode 100644 index 00000000000..0cbf08c181e --- /dev/null +++ b/clang/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(); +} |

