Files
clang-p2996/bolt/test/runtime/X86/Inputs/exception4.cpp
Amir Ayupov 0224bdce92 [BOLT][TEST] Limit iterations in X86/exceptions-pic.test
The test has 3 invocations with 1M iterations each, which adds delay to fast
check-bolt testing. Reduce the number to 1K.

Reviewed By: #bolt, rafauler

Differential Revision: https://reviews.llvm.org/D139651
2022-12-22 19:47:28 -08:00

56 lines
889 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 never_throws() throw () {
printf("this statement is cold and should be outlined\n");
}
int main(int argc, char **argv)
{
for (unsigned i = 0; i < 1000; ++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 {
foo(argc);
} catch (ExcC) {
printf("caught ExcC\n");
}
} catch (ExcG) {
printf("caught ExcG\n");
}
}
return 0;
}