| 1 | // RUN: %clangxx -c -o %t %s |
| 2 | // RUN: %llvm_jitlink -slab-allocate=20Mb %t |
| 3 | // |
| 4 | // REQUIRES: system-darwin && host-arch-compatible |
| 5 | |
| 6 | // Test that we can throw and catch an exception through a large number of |
| 7 | // stack frames. The number (1022) is chosen to force emission of multiple |
| 8 | // unwind info second-level pages. |
| 9 | |
| 10 | template <int N> |
| 11 | void f() { try { f<N - 1>(); } catch (...) { throw; } } |
| 12 | |
| 13 | template <> |
| 14 | void f<0>() { throw 42; } |
| 15 | |
| 16 | int main(int argc, char *argv[]) { |
| 17 | try { |
| 18 | f<1020>(); |
| 19 | } catch (int n) { |
| 20 | return 42 - n; |
| 21 | } |
| 22 | return 1; |
| 23 | } |
| 24 | |
| 25 | |