1 // REQUIRES: system-linux
2 // RUN: %clangxx -no-pie -Wl,-q %s -o %t.exe
3 // RUN: llvm-bolt %t.exe -o %t.bolt.exe -lite=false
4 // RUN: not --crash %t.bolt.exe 2>&1 | FileCheck %s --check-prefix=CHECK-FAIL
5 // CHECK-FAIL: Should pass one argument
6 // RUN: not %t.bolt.exe -1 | FileCheck %s --check-prefix=CHECK-BAD
7 // CHECK-BAD: Bad value
8 // RUN: not %t.bolt.exe 0 | FileCheck %s --check-prefix=CHECK-ZERO
9 // CHECK-ZERO: Value is zero
10 // RUN: %t.bolt.exe 1 | FileCheck %s --check-prefix=CHECK-GOOD
11 // CHECK-GOOD: Good value
16 const char *error
= "Value is zero\n";
24 throw std::out_of_range("Bad value");
27 int main(int argc
, char **argv
) {
29 throw std::invalid_argument("Should pass one argument");
31 dummy(std::strtol(argv
[1], nullptr, 10));
32 } catch (std::out_of_range
&e
) {
33 std::cout
<< e
.what() << "\n";
35 } catch (ValIsZero
&e
) {
39 std::cout
<< "Good value\n";