From 3a7fbe2e3e1524bfcf5a2255841982f3991625ee Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 30 Sep 2003 18:57:56 +0000 Subject: [PATCH] These tests got moved to test/Programs/SingleSource/Regression/C++/EH git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8785 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/C++Frontend/EH/ctor_dtor_count.cpp | 23 ------------ test/C++Frontend/EH/dead_try_block.cpp | 13 ------- test/C++Frontend/EH/exception_spec_test.cpp | 51 -------------------------- test/C++Frontend/EH/function_try_block.cpp | 55 ----------------------------- test/C++Frontend/EH/simple_rethrow.cpp | 25 ------------- test/C++Frontend/EH/simple_throw.cpp | 13 ------- test/C++Frontend/EH/throw_rethrow_test.cpp | 40 --------------------- 7 files changed, 220 deletions(-) delete mode 100644 test/C++Frontend/EH/ctor_dtor_count.cpp delete mode 100644 test/C++Frontend/EH/dead_try_block.cpp delete mode 100644 test/C++Frontend/EH/exception_spec_test.cpp delete mode 100644 test/C++Frontend/EH/function_try_block.cpp delete mode 100644 test/C++Frontend/EH/simple_rethrow.cpp delete mode 100644 test/C++Frontend/EH/simple_throw.cpp delete mode 100644 test/C++Frontend/EH/throw_rethrow_test.cpp diff --git a/test/C++Frontend/EH/ctor_dtor_count.cpp b/test/C++Frontend/EH/ctor_dtor_count.cpp deleted file mode 100644 index a399c097818..00000000000 --- a/test/C++Frontend/EH/ctor_dtor_count.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -static int c; - -struct A { - A() { ++c; } - A(const A&) { ++c; } - ~A() { --c; } -}; - -struct B { - A a; - B() { A a; throw 1; } -}; - -int main() { - try { - B b; - } catch (...) {} - if (!c) printf("All ok!\n"); - return c; -} - diff --git a/test/C++Frontend/EH/dead_try_block.cpp b/test/C++Frontend/EH/dead_try_block.cpp deleted file mode 100644 index 00a5b1108ea..00000000000 --- a/test/C++Frontend/EH/dead_try_block.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// This testcase doesn't actually DO any EH -#include - -static void foo() {} -int main() { - try { - foo(); - } catch(...) { - return 1; - } - printf("All ok\n"); - return 0; -} diff --git a/test/C++Frontend/EH/exception_spec_test.cpp b/test/C++Frontend/EH/exception_spec_test.cpp deleted file mode 100644 index f80f0eeaaba..00000000000 --- a/test/C++Frontend/EH/exception_spec_test.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// This tests that exception specifications interact properly with unexpected -// handlers. - -#include -#include -#include - -static void TerminateHandler() { - printf("std::terminate called\n"); - exit(1); -} - -static void UnexpectedHandler1() { - printf("std::unexpected called: throwing a double\n"); - throw 1.0; -} - -static void UnexpectedHandler2() { - printf("std::unexpected called: throwing an int!\n"); - throw 1; -} - -void test(bool Int) throw (double) { - if (Int) { - printf("Throwing an int from a function which only allows doubles!\n"); - throw 1; - } else { - printf("Throwing a double from a function which allows doubles!\n"); - throw 1.0; - } -} - -int main() { - try { - test(false); - } catch (double D) { - printf("Double successfully caught!\n"); - } - - std::set_terminate(TerminateHandler); - std::set_unexpected(UnexpectedHandler1); - - try { - test(true); - } catch (double D) { - printf("Double successfully caught!\n"); - } - - std::set_unexpected(UnexpectedHandler2); - test(true); -} diff --git a/test/C++Frontend/EH/function_try_block.cpp b/test/C++Frontend/EH/function_try_block.cpp deleted file mode 100644 index 001b7c50b82..00000000000 --- a/test/C++Frontend/EH/function_try_block.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -#include - -static unsigned NumAs = 0; - -struct A { - unsigned ANum; - A() : ANum(NumAs++) { printf("Created A #%d\n", ANum); } - A(const A &a) : ANum(NumAs++) { printf("Copy Created A #%d\n", ANum); } - ~A() { printf("Destroyed A #%d\n", ANum); } -}; - -static bool ShouldThrow = false; - -int throws() - try -{ - if (ShouldThrow) throw 7; return 123; -} catch (...) { - printf("'throws' threw an exception: rethrowing!\n"); - throw; -} - -struct B { - A a0, a1, a2; - int i; - A a3, a4; - - B(); - ~B() { printf("B destructor!\n"); } -}; - -B::B() -try -: i(throws()) -{ - printf("In B constructor!\n"); -} -catch (int i) { - printf("In B catch block with int %d: auto rethrowing\n", i); -} - - -int main() { - { - B b; // Shouldn't throw. - } - - try { - ShouldThrow = true; - B b; - } catch (...) { - printf("Caught exception!\n"); - } -} diff --git a/test/C++Frontend/EH/simple_rethrow.cpp b/test/C++Frontend/EH/simple_rethrow.cpp deleted file mode 100644 index 34c46812c18..00000000000 --- a/test/C++Frontend/EH/simple_rethrow.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -int throws() { - printf("Throwing int\n"); - throw 16; -}; - -int callsthrows() { - try { - throws(); - } catch (...) { - printf("Caught something, rethrowing...\n"); - throw; - } -} - -int main() { - try { - callsthrows(); - } catch (int i) { - printf("Caught int: %d\n", i); - return i-16; - } - return 1; -} diff --git a/test/C++Frontend/EH/simple_throw.cpp b/test/C++Frontend/EH/simple_throw.cpp deleted file mode 100644 index 7289c6d065c..00000000000 --- a/test/C++Frontend/EH/simple_throw.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// Test throwing a constant int -#include - -static void foo() { throw 5; } -int main() { - try { - foo(); - } catch (...) { - printf("All ok\n"); - return 0; - } - return 1; -} diff --git a/test/C++Frontend/EH/throw_rethrow_test.cpp b/test/C++Frontend/EH/throw_rethrow_test.cpp deleted file mode 100644 index cbaaa1bf568..00000000000 --- a/test/C++Frontend/EH/throw_rethrow_test.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// This tests hard situations for throwing, including the case where an -// exception is active in more than one handler at a time (ie, it needs -// refcounting) -#include - -struct foo { - int i; - foo() : i(1) { } - foo(const foo&) : i(2) {} -}; - -int callee(unsigned i) { - if (i < 3) throw (int)i; - if (i < 6) throw 1.0; - if (i < 9) throw foo(); - return 0; -} - -void rethrow() { - throw; -} - -int main() { - for (unsigned i = 0; i < 10; ++i) { - try { - return callee(i); - } catch (foo &F) { - try { - rethrow(); - } catch (foo &F) { - std::printf("%d: 3\n", i); - } - } catch (int) { - std::printf("%d: 1\n", i); - } catch (...) { - std::printf("%d: 2\n", i); - } - } -} - -- 2.11.0