Amir Ayupov e903671bbf [BOLT][TEST] Imported small tests, removed duplicate input
Summary:
Imported small internal tests.
- call_zero.s
- cfi_expr_rewrite.s
- cfi_insts_count.s
- exceptions_pic.test
- exceptions_run.test

Removed duplicate input file (switch_statement.cpp)

(cherry picked from FBD31355466)
2021-10-01 15:35:43 -07:00

56 lines
992 B
C++

#include <stdio.h>
class ExcA {};
class ExcB {};
class ExcC {};
class ExcD {};
class ExcE {};
class ExcF {};
class ExcG {};
void foo(int a)
{
if (a > 1)
throw ExcG();
else
throw ExcC();
}
void filter_only(int a) throw (ExcA, ExcB, ExcC, ExcD, ExcE, ExcF) {
foo(a);
}
int main(int argc, char **argv)
{
asm volatile ("nop;nop;nop;nop;nop");
try {
try {
asm volatile ("nop;nop;nop;nop;nop");
throw ExcA();
} catch (ExcA) {
asm volatile ("nop;nop;nop;nop;nop");
printf("catch 2\n");
throw new int();
}
} catch (...) {
asm volatile ("nop;nop;nop;nop;nop");
printf("catch 1\n");
}
try {
asm volatile ("nop;nop;nop;nop;nop");
try {
asm volatile ("nop;nop;nop;nop;nop");
filter_only(argc);
} catch (ExcC) {
asm volatile ("nop;nop;nop;nop;nop");
printf("caught ExcC\n");
}
} catch (ExcG) {
asm volatile ("nop;nop;nop;nop;nop");
printf("caught ExcG\n");
}
return 0;
}