brintos

brintos / llvm-project-archived public Read only

0
0
Text · 545 B · 60b0b08 Raw
27 lines · cpp
1// REQUIRES: system-linux,bolt-runtime2 3// RUN: %clangxx --target=aarch64-unknown-linux-gnu \4// RUN: -mbranch-protection=pac-ret -Wl,-q %s -o %t.exe5// RUN: llvm-bolt %t.exe -o %t.bolt.exe6// RUN: %t.bolt.exe | FileCheck %s7 8// CHECK: Exception caught: Exception from bar().9 10#include <cstdio>11#include <stdexcept>12 13void bar() { throw std::runtime_error("Exception from bar()."); }14 15void foo() {16  try {17    bar();18  } catch (const std::exception &e) {19    printf("Exception caught: %s\n", e.what());20  }21}22 23int main() {24  foo();25  return 0;26}27