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 B fail; 7 const B& f(A *a) { 8 try { 9 // CHECK: call i8* @__dynamic_cast 10 // CHECK: br i1 11 // CHECK: invoke void @__cxa_bad_cast() [[NR:#[0-9]+]] 12 dynamic_cast<const B&>(*a); 13 } catch (...) { 14 // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) 15 // CHECK-NEXT: catch i8* null 16 } 17 return fail; 18 } 19 20 // CHECK: declare i8* @__dynamic_cast(i8*, i8*, i8*, i64) [[NUW_RO:#[0-9]+]] 21 22 // CHECK: attributes [[NUW_RO]] = { nounwind readonly } 23 // CHECK: attributes [[NR]] = { noreturn } 24