blob: 6b145d8343e16c9d4d266057786c13d2e5141bde [file] [log] [blame]
Anders Carlsson6774b1f2011-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 Carlsson0087bc82009-12-18 14:55:04 +00002struct A { virtual void f(); };
3struct B : A { };
4
Douglas Gregorfa8b4952010-05-14 21:14:41 +00005// CHECK: {{define.*@_Z1fP1A}}
6B fail;
Anders Carlsson0087bc82009-12-18 14:55:04 +00007const B& f(A *a) {
Douglas Gregorfa8b4952010-05-14 21:14:41 +00008 try {
9 // CHECK: call i8* @__dynamic_cast
10 // CHECK: br i1
11 // CHECK: invoke void @__cxa_bad_cast() noreturn
Douglas Gregor1c073f42010-05-14 21:31:02 +000012 dynamic_cast<const B&>(*a);
Douglas Gregor2d15eca2010-05-14 21:50:50 +000013 } catch (...) {
Bill Wendlingf0724e82011-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 Gregorfa8b4952010-05-14 21:14:41 +000016 }
17 return fail;
Anders Carlsson0087bc82009-12-18 14:55:04 +000018}
Benjamin Kramerb5206332013-02-03 17:44:25 +000019
Bill Wendlingc33fc4c2013-02-20 07:22:19 +000020// CHECK: declare i8* @__dynamic_cast(i8*, i8*, i8*, i64) #2
21
22// CHECK: attributes #0 = { inlinehint nounwind "target-features"={{.*}} }
23// CHECK: attributes #1 = { "target-features"={{.*}} }
24// CHECK: attributes #2 = { nounwind readonly }