blob: fe85e212b6695b07c043f2017fb1e17f8b31e5aa [file] [log] [blame]
Anders Carlssonabea9512011-02-28 00:40:07 +00001// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -o - | FileCheck %s
Anders Carlsson6f0e4852009-12-18 14:55:04 +00002struct A { virtual void f(); };
3struct B : A { };
4
Douglas Gregor485ee322010-05-14 21:14:41 +00005// CHECK: {{define.*@_Z1fP1A}}
6B fail;
Anders Carlsson6f0e4852009-12-18 14:55:04 +00007const B& f(A *a) {
Douglas Gregor485ee322010-05-14 21:14:41 +00008 try {
9 // CHECK: call i8* @__dynamic_cast
10 // CHECK: br i1
Bill Wendling4e1125f2013-02-22 09:10:20 +000011 // CHECK: invoke void @__cxa_bad_cast() [[NR:#[0-9]+]]
Douglas Gregor69cfeb12010-05-14 21:31:02 +000012 dynamic_cast<const B&>(*a);
Douglas Gregore37706d2010-05-14 21:50:50 +000013 } catch (...) {
Bill Wendling285cfd82011-09-19 20:31:14 +000014 // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
15 // CHECK-NEXT: catch i8* null
Douglas Gregor485ee322010-05-14 21:14:41 +000016 }
17 return fail;
Anders Carlsson6f0e4852009-12-18 14:55:04 +000018}
Benjamin Kramer21f6b392013-02-03 17:44:25 +000019
Bill Wendling89924572013-02-27 00:06:04 +000020// CHECK: declare i8* @__dynamic_cast(i8*, i8*, i8*, i64) [[NUW_RO:#[0-9]+]]
Bill Wendlingf7a9da02013-02-20 07:22:19 +000021
Bill Wendling89924572013-02-27 00:06:04 +000022// CHECK: attributes [[NUW_RO]] = { nounwind readonly }
Bill Wendling4e1125f2013-02-22 09:10:20 +000023// CHECK: attributes [[NR]] = { noreturn }