diff options
Diffstat (limited to 'test/Import')
-rw-r--r-- | test/Import/cxx-anon-namespace/Inputs/F.cpp | 25 | ||||
-rw-r--r-- | test/Import/cxx-anon-namespace/test.cpp | 45 | ||||
-rw-r--r-- | test/Import/cxx-record-flags/Inputs/F.cpp | 9 | ||||
-rw-r--r-- | test/Import/cxx-record-flags/test.cpp | 14 | ||||
-rw-r--r-- | test/Import/destructor/Inputs/F.cpp | 3 | ||||
-rw-r--r-- | test/Import/destructor/test.cpp | 10 |
6 files changed, 106 insertions, 0 deletions
diff --git a/test/Import/cxx-anon-namespace/Inputs/F.cpp b/test/Import/cxx-anon-namespace/Inputs/F.cpp new file mode 100644 index 0000000000..83764866bb --- /dev/null +++ b/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/test/Import/cxx-anon-namespace/test.cpp b/test/Import/cxx-anon-namespace/test.cpp new file mode 100644 index 0000000000..0cbf08c181 --- /dev/null +++ b/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(); +} diff --git a/test/Import/cxx-record-flags/Inputs/F.cpp b/test/Import/cxx-record-flags/Inputs/F.cpp new file mode 100644 index 0000000000..1294c67f68 --- /dev/null +++ b/test/Import/cxx-record-flags/Inputs/F.cpp @@ -0,0 +1,9 @@ +class FTrivial { + int i; +}; + +struct FNonTrivial { + virtual ~FNonTrivial() = default; + int i; +}; + diff --git a/test/Import/cxx-record-flags/test.cpp b/test/Import/cxx-record-flags/test.cpp new file mode 100644 index 0000000000..bff76274fb --- /dev/null +++ b/test/Import/cxx-record-flags/test.cpp @@ -0,0 +1,14 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: FTrivial +// CHECK: DefinitionData +// CHECK-SAME: pass_in_registers + +// CHECK: FNonTrivial +// CHECK-NOT: pass_in_registers +// CHECK: DefaultConstructor + +void expr() { + FTrivial f1; + FNonTrivial f2; +} diff --git a/test/Import/destructor/Inputs/F.cpp b/test/Import/destructor/Inputs/F.cpp new file mode 100644 index 0000000000..c33c45399d --- /dev/null +++ b/test/Import/destructor/Inputs/F.cpp @@ -0,0 +1,3 @@ +struct B { + virtual ~B() {} +}; diff --git a/test/Import/destructor/test.cpp b/test/Import/destructor/test.cpp new file mode 100644 index 0000000000..bfdee398c8 --- /dev/null +++ b/test/Import/destructor/test.cpp @@ -0,0 +1,10 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s + +// Triggers the deserialization of B's destructor. +B b1; + +// CHECK: CXXDestructorDecl + +// CHECK-NEXT: ~B 'void () noexcept' virtual +// CHECK-SAME: 'void () noexcept' +// CHECK-SAME: virtual |