1 | // RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -o - | FileCheck %s |
2 | struct A { virtual void f(); }; |
3 | struct B : A { }; |
4 | |
5 | // CHECK: {{define.*@_Z1fP1A}} |
6 | // CHECK-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) |
7 | B fail; |
8 | const B& f(A *a) { |
9 | try { |
10 | // CHECK: call i8* @__dynamic_cast |
11 | // CHECK: br i1 |
12 | // CHECK: invoke void @__cxa_bad_cast() [[NR:#[0-9]+]] |
13 | dynamic_cast<const B&>(*a); |
14 | } catch (...) { |
15 | // CHECK: landingpad { i8*, i32 } |
16 | // CHECK-NEXT: catch i8* null |
17 | } |
18 | return fail; |
19 | } |
20 | |
21 | // CHECK: declare i8* @__dynamic_cast(i8*, i8*, i8*, i64) [[NUW_RO:#[0-9]+]] |
22 | |
23 | // CHECK: attributes [[NUW_RO]] = { nounwind readonly } |
24 | // CHECK: attributes [[NR]] = { noreturn } |
25 | |