[clang-repl] [codegen] Reduce the state in TBAA. NFC for static compilation. (#98138)
[llvm-project.git] / bolt / test / runtime / X86 / Inputs / exception4.cpp
blob73bb8afd409a42733a08f6d2bf9663e7cfb8ca19
1 #include <stdio.h>
3 class ExcA {};
4 class ExcB {};
5 class ExcC {};
6 class ExcD {};
7 class ExcE {};
8 class ExcF {};
9 class ExcG {};
11 void foo(int a)
13 if (a > 1)
14 throw ExcG();
15 else
16 throw ExcC();
19 void never_throws() throw () {
20 printf("this statement is cold and should be outlined\n");
23 int main(int argc, char **argv)
25 for (unsigned i = 0; i < 1000; ++i) {
26 try {
27 if (argc == 2) {
28 never_throws(); // should be cold
30 try {
31 if (argc == 2) {
32 never_throws(); // should be cold
34 throw ExcA();
35 } catch (ExcA) {
36 printf("catch 2\n");
37 throw new int();
39 } catch (...) {
40 printf("catch 1\n");
43 try {
44 try {
45 foo(argc);
46 } catch (ExcC) {
47 printf("caught ExcC\n");
49 } catch (ExcG) {
50 printf("caught ExcG\n");
54 return 0;