aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-09-30 18:57:56 +0000
committerChris Lattner <sabre@nondot.org>2003-09-30 18:57:56 +0000
commit3a7fbe2e3e1524bfcf5a2255841982f3991625ee (patch)
treef50ececf5b50d9cdbda80bf705aee3c0b27a4a91
parent39882e847a47dc77648b9caf37ac37ec1cec6a27 (diff)
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
-rw-r--r--test/C++Frontend/EH/ctor_dtor_count.cpp23
-rw-r--r--test/C++Frontend/EH/dead_try_block.cpp13
-rw-r--r--test/C++Frontend/EH/exception_spec_test.cpp51
-rw-r--r--test/C++Frontend/EH/function_try_block.cpp55
-rw-r--r--test/C++Frontend/EH/simple_rethrow.cpp25
-rw-r--r--test/C++Frontend/EH/simple_throw.cpp13
-rw-r--r--test/C++Frontend/EH/throw_rethrow_test.cpp40
7 files changed, 0 insertions, 220 deletions
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 a399c09781..0000000000
--- a/test/C++Frontend/EH/ctor_dtor_count.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stdio.h>
-
-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 00a5b1108e..0000000000
--- a/test/C++Frontend/EH/dead_try_block.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// This testcase doesn't actually DO any EH
-#include <stdio.h>
-
-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 f80f0eeaab..0000000000
--- 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 <exception>
-#include <stdio.h>
-#include <stdlib.h>
-
-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 001b7c50b8..0000000000
--- a/test/C++Frontend/EH/function_try_block.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-#include <stdio.h>
-
-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 34c46812c1..0000000000
--- a/test/C++Frontend/EH/simple_rethrow.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <stdio.h>
-
-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 7289c6d065..0000000000
--- a/test/C++Frontend/EH/simple_throw.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// Test throwing a constant int
-#include <stdio.h>
-
-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 cbaaa1bf56..0000000000
--- 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 <cstdio>
-
-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);
- }
- }
-}
-