forked from OSchip/llvm-project
60 lines
981 B
C++
60 lines
981 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);
|
|
}
|
|
|
|
void never_throws() throw () {
|
|
printf("this statement is cold and should be outlined\n");
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
for(unsigned i = 0; i < 1000000; ++i) {
|
|
try {
|
|
if (argc == 2) {
|
|
never_throws(); // should be cold
|
|
}
|
|
try {
|
|
if (argc == 2) {
|
|
never_throws(); // should be cold
|
|
}
|
|
throw ExcA();
|
|
} catch (ExcA) {
|
|
printf("catch 2\n");
|
|
throw new int();
|
|
}
|
|
} catch (...) {
|
|
printf("catch 1\n");
|
|
}
|
|
|
|
try {
|
|
try {
|
|
filter_only(argc);
|
|
} catch (ExcC) {
|
|
printf("caught ExcC\n");
|
|
}
|
|
} catch (ExcG) {
|
|
printf("caught ExcG\n");
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|