From fa3f34f401d94658c19f943a2c6ba76ea038153f Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Thu, 19 Sep 2019 13:10:55 +0000 Subject: Creating release candidate final from release_900 branch git-svn-id: https://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_900@372316 91177308-0d34-0410-b5e6-96231b3b80d8 --- final/ABI-Testsuite/test/s2_9/builtin_bool.xpp | 22 ++++ final/ABI-Testsuite/test/s2_9/builtin_char.xpp | 22 ++++ final/ABI-Testsuite/test/s2_9/builtin_double.xpp | 22 ++++ final/ABI-Testsuite/test/s2_9/builtin_float.xpp | 22 ++++ final/ABI-Testsuite/test/s2_9/builtin_int.xpp | 22 ++++ final/ABI-Testsuite/test/s2_9/builtin_long.xpp | 22 ++++ .../test/s2_9/builtin_long_double.xpp | 22 ++++ .../ABI-Testsuite/test/s2_9/builtin_long_long.xpp | 22 ++++ final/ABI-Testsuite/test/s2_9/builtin_short.xpp | 22 ++++ .../test/s2_9/builtin_signed_char.xpp | 22 ++++ .../test/s2_9/builtin_unsigned_char.xpp | 22 ++++ .../test/s2_9/builtin_unsigned_int.xpp | 22 ++++ .../test/s2_9/builtin_unsigned_long.xpp | 22 ++++ .../test/s2_9/builtin_unsigned_long_long.xpp | 22 ++++ .../test/s2_9/builtin_unsigned_short.xpp | 22 ++++ final/ABI-Testsuite/test/s2_9/builtin_void.xpp | 24 ++++ final/ABI-Testsuite/test/s2_9/builtin_wchar_t.xpp | 22 ++++ .../test/s2_9/dynamic_cast_algorithm.xpp | 141 +++++++++++++++++++++ final/ABI-Testsuite/test/s2_9/non_virtual.xpp | 19 +++ final/ABI-Testsuite/test/s2_9/virtual.xpp | 19 +++ 20 files changed, 555 insertions(+) create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_bool.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_char.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_double.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_float.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_int.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_long.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_long_double.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_long_long.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_short.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_signed_char.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_unsigned_char.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_unsigned_int.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_unsigned_long.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_unsigned_long_long.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_unsigned_short.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_void.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/builtin_wchar_t.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/dynamic_cast_algorithm.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/non_virtual.xpp create mode 100755 final/ABI-Testsuite/test/s2_9/virtual.xpp (limited to 'final/ABI-Testsuite/test/s2_9') diff --git a/final/ABI-Testsuite/test/s2_9/builtin_bool.xpp b/final/ABI-Testsuite/test/s2_9/builtin_bool.xpp new file mode 100755 index 00000000..18a88d82 --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_bool.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "bool" + +bool global_var = true; +bool const *global_ptr; + +// CHECK-DAG: _ZTIb +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPb +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKb +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_char.xpp b/final/ABI-Testsuite/test/s2_9/builtin_char.xpp new file mode 100755 index 00000000..2754cf31 --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_char.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "char" + +char global_var = 'a'; +char const *global_ptr; + +// CHECK-DAG: _ZTIc +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPc +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKc +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_double.xpp b/final/ABI-Testsuite/test/s2_9/builtin_double.xpp new file mode 100755 index 00000000..b1b5bba9 --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_double.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "double" + +double global_var = 123.456; +double const *global_ptr; + +// CHECK-DAG: _ZTId +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPd +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKd +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_float.xpp b/final/ABI-Testsuite/test/s2_9/builtin_float.xpp new file mode 100755 index 00000000..d3ec9362 --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_float.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "float" + +float global_var = 1.5f; +float const *global_ptr; + +// CHECK-DAG: _ZTIf +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPf +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKf +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_int.xpp b/final/ABI-Testsuite/test/s2_9/builtin_int.xpp new file mode 100755 index 00000000..31866c69 --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_int.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "int" + +int global_var = 5; +int const *global_ptr; + +// CHECK-DAG: _ZTIi +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPi +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKi +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_long.xpp b/final/ABI-Testsuite/test/s2_9/builtin_long.xpp new file mode 100755 index 00000000..eb1a552d --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_long.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "long" + +long global_var = 5; +long const *global_ptr; + +// CHECK-DAG: _ZTIl +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPl +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKl +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_long_double.xpp b/final/ABI-Testsuite/test/s2_9/builtin_long_double.xpp new file mode 100755 index 00000000..31527d81 --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_long_double.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "long double" + +long double global_var = 123.456; +long double const *global_ptr; + +// CHECK-DAG: _ZTIe +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPe +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKe +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_long_long.xpp b/final/ABI-Testsuite/test/s2_9/builtin_long_long.xpp new file mode 100755 index 00000000..6e2c70d4 --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_long_long.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "long long" + +long long global_var = 5; +long long const *global_ptr; + +// CHECK-DAG: _ZTIx +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPx +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKx +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_short.xpp b/final/ABI-Testsuite/test/s2_9/builtin_short.xpp new file mode 100755 index 00000000..17bc779d --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_short.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "short" + +short global_var = 10; +short const *global_ptr; + +// CHECK-DAG: _ZTIs +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPs +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKs +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_signed_char.xpp b/final/ABI-Testsuite/test/s2_9/builtin_signed_char.xpp new file mode 100755 index 00000000..864ac221 --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_signed_char.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "signed char" + +signed char global_var = 'a'; +signed char const *global_ptr; + +// CHECK-DAG: _ZTIa +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPa +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKa +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_unsigned_char.xpp b/final/ABI-Testsuite/test/s2_9/builtin_unsigned_char.xpp new file mode 100755 index 00000000..a1359e4a --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_unsigned_char.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "unsigned char" + +unsigned char global_var = 'a'; +unsigned char const *global_ptr; + +// CHECK-DAG: _ZTIh +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPh +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKh +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_unsigned_int.xpp b/final/ABI-Testsuite/test/s2_9/builtin_unsigned_int.xpp new file mode 100755 index 00000000..e60afafa --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_unsigned_int.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "unsigned int" + +unsigned int global_var = 5; +unsigned int const *global_ptr; + +// CHECK-DAG: _ZTIj +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPj +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKj +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_unsigned_long.xpp b/final/ABI-Testsuite/test/s2_9/builtin_unsigned_long.xpp new file mode 100755 index 00000000..c58f5295 --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_unsigned_long.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "unsigned long" + +unsigned long global_var = 5; +unsigned long const *global_ptr; + +// CHECK-DAG: _ZTIm +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPm +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKm +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_unsigned_long_long.xpp b/final/ABI-Testsuite/test/s2_9/builtin_unsigned_long_long.xpp new file mode 100755 index 00000000..97f76818 --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_unsigned_long_long.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "unsigned long long" + +unsigned long long global_var = 5; +unsigned long long const *global_ptr; + +// CHECK-DAG: _ZTIy +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPy +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKy +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_unsigned_short.xpp b/final/ABI-Testsuite/test/s2_9/builtin_unsigned_short.xpp new file mode 100755 index 00000000..edbd9fd0 --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_unsigned_short.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "unsigned short" + +unsigned short global_var = 10; +unsigned short const *global_ptr; + +// CHECK-DAG: _ZTIt +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPt +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKt +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_void.xpp b/final/ABI-Testsuite/test/s2_9/builtin_void.xpp new file mode 100755 index 00000000..d1c8943a --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_void.xpp @@ -0,0 +1,24 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +#include + +// Test run-time library includes support for builtin type "void" + +int global_int = 10; +void const *global_ptr; + +// CHECK-DAG: _ZTIv +const std::type_info &foo1() { const std::type_info &t = typeid(void); return t; } +// CHECK-DAG: _ZTIPv +void foo2() { throw (void *)&global_int; } +// CHECK-DAG: _ZTIPKv +void foo3() { try { foo2(); } catch(void const *p) { } } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/builtin_wchar_t.xpp b/final/ABI-Testsuite/test/s2_9/builtin_wchar_t.xpp new file mode 100755 index 00000000..7f602bb7 --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/builtin_wchar_t.xpp @@ -0,0 +1,22 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +// Test run-time library includes support for builtin type "wchar_t" + +wchar_t global_var = true; +wchar_t const *global_ptr; + +// CHECK-DAG: _ZTIw +void foo1() { throw global_var; } +// CHECK-DAG: _ZTIPw +void foo2() { throw &global_var; } +// CHECK-DAG: _ZTIPKw +void foo3() { throw global_ptr; } + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/dynamic_cast_algorithm.xpp b/final/ABI-Testsuite/test/s2_9/dynamic_cast_algorithm.xpp new file mode 100755 index 00000000..2173f8ca --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/dynamic_cast_algorithm.xpp @@ -0,0 +1,141 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: runtool %t%exeext | grep "Test passed" + +#include + +// Direct inheritance +struct A1 { virtual ~A1() {} }; +struct B1 : A1 { }; + +A1 A1_obj; +B1 B1_obj; + +struct A2 { virtual ~A2() {} }; +struct B2 : A2 { }; +struct C2 : A2 { }; + +A2 A2_obj; +B2 B2_obj; +C2 C2_obj; + +// Virtual inheritance +struct A3 { virtual ~A3() {} }; +struct B3 : virtual A3 { }; + +A3 A3_obj; +B3 B3_obj; + +struct A4 { virtual ~A4() {} }; +struct B4 : virtual A4 { }; +struct C4 : A4 { }; + +A4 A4_obj; +B4 B4_obj; +C4 C4_obj; + +struct A5 { virtual ~A5() {} }; +struct B5 : A5 { }; +struct C5 : virtual A5 { }; + +A5 A5_obj; +B5 B5_obj; +C5 C5_obj; + +struct A6 { virtual ~A6() {} }; +struct B6 : virtual A6 { }; +struct C6 : virtual A6 { }; + +A6 A6_obj; +B6 B6_obj; +C6 C6_obj; + +struct A7 { virtual ~A7() {} }; +struct B7_1 : A7 { }; +struct B7_2 : A7 { }; +struct C7 : B7_1, B7_2 { }; + +A7 A7_obj; +B7_1 B7_1_obj; +B7_2 B7_2_obj; +C7 C7_obj; + +int failed_tests = 0; + +void base_to_derived_cast() { + A1 *A1_ptr = &B1_obj; + B1 *B1_ptr = dynamic_cast(A1_ptr); + if(!B1_ptr) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } + + A2 *A2_ptr1 = &B2_obj, *A2_ptr2 = &C2_obj; + B2 *B2_ptr = dynamic_cast(A2_ptr1); + C2 *C2_ptr = dynamic_cast(A2_ptr2); + if(!B2_ptr) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } + if(!C2_ptr) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } + + A3 *A3_ptr = &B3_obj; + B3 *B3_ptr = dynamic_cast(A3_ptr); + if(!B3_ptr) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } + + A4 *A4_ptr1 = &B4_obj, *A4_ptr2 = &C4_obj; + B4 *B4_ptr = dynamic_cast(A4_ptr1); + C4 *C4_ptr = dynamic_cast(A4_ptr2); + if(!B4_ptr) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } + if(!C4_ptr) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } + + A5 *A5_ptr1 = &B5_obj, *A5_ptr2 = &C5_obj; + B5 *B5_ptr = dynamic_cast(A5_ptr1); + C5 *C5_ptr = dynamic_cast(A5_ptr2); + if(!B5_ptr) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } + if(!C5_ptr) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } + + A6 *A6_ptr1 = &B6_obj, *A6_ptr2 = &C6_obj; + B6 *B6_ptr = dynamic_cast(A6_ptr1); + C6 *C6_ptr = dynamic_cast(A6_ptr2); + if(!B6_ptr) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } + if(!C6_ptr) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } +} + +void cross_cast() { + C7* C7_ptr = &C7_obj; + B7_1 *B7_1_ptr = dynamic_cast(C7_ptr); + B7_2 *B7_2_ptr = dynamic_cast(C7_ptr); + + if(!B7_1_ptr) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } + if(!B7_2_ptr) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } + + B7_1 *cc1 = dynamic_cast(B7_2_ptr); + B7_2 *cc2 = dynamic_cast(B7_1_ptr); + + if(!cc1) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } + if(!cc2) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } +} + +void void_ptr_cast() { + C7* C7_ptr = &C7_obj; + B7_1 *B7_1_ptr = dynamic_cast(C7_ptr); + B7_2 *B7_2_ptr = dynamic_cast(C7_ptr); + + if(!B7_1_ptr) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } + if(!B7_2_ptr) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } + if(!(dynamic_cast(B7_1_ptr) == dynamic_cast(B7_2_ptr))) { printf("Test failed %s:%d\n", __FILE__, __LINE__); failed_tests++; } +} + +int main(int argc, char *argv[]) { + base_to_derived_cast(); + cross_cast(); + void_ptr_cast(); + + if(failed_tests > 0) { + printf("Test failed\n"); + } else { + printf("Test passed\n"); + } + + printf("\x1a"); + + return 0; +} diff --git a/final/ABI-Testsuite/test/s2_9/non_virtual.xpp b/final/ABI-Testsuite/test/s2_9/non_virtual.xpp new file mode 100755 index 00000000..d9571c60 --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/non_virtual.xpp @@ -0,0 +1,19 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +struct foo { }; + +// Section 2.9.2 +// Check that the type-info was generated and no v-table was generated + +// CHECK-NOT: _ZTV3foo +// CHECK-DAG: _ZTI3foo +// CHECK-NOT: _ZTV3foo + +int main(int argc, char *argv[]) { + throw foo(); +} diff --git a/final/ABI-Testsuite/test/s2_9/virtual.xpp b/final/ABI-Testsuite/test/s2_9/virtual.xpp new file mode 100755 index 00000000..b4d3bc03 --- /dev/null +++ b/final/ABI-Testsuite/test/s2_9/virtual.xpp @@ -0,0 +1,19 @@ +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// RUN: cxx_compiler -c cxx_rtti cxx_exceptions %s -o %t.o +// RUN: linker %t.o -o %t%exeext +// RUN: bindump %t.o| FileCheck %s + +struct foo { }; +struct bar : virtual foo { }; + +// Section 2.9.2 +// Check that the type-info was generated and a v-table was generated + +// CHECK-DAG: _ZTV3bar +// CHECK-DAG: _ZTI3bar + +int main(int argc, char *argv[]) { + throw bar(); +} -- cgit v1.2.3