Anders Carlsson | abea951 | 2011-02-28 00:40:07 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -o - | FileCheck %s |
Anders Carlsson | 6f0e485 | 2009-12-18 14:55:04 +0000 | [diff] [blame] | 2 | struct A { virtual void f(); }; |
| 3 | struct B : A { }; |
| 4 | |
Douglas Gregor | 485ee32 | 2010-05-14 21:14:41 +0000 | [diff] [blame] | 5 | // CHECK: {{define.*@_Z1fP1A}} |
| 6 | B fail; |
Anders Carlsson | 6f0e485 | 2009-12-18 14:55:04 +0000 | [diff] [blame] | 7 | const B& f(A *a) { |
Douglas Gregor | 485ee32 | 2010-05-14 21:14:41 +0000 | [diff] [blame] | 8 | try { |
| 9 | // CHECK: call i8* @__dynamic_cast |
| 10 | // CHECK: br i1 |
Bill Wendling | 4e1125f | 2013-02-22 09:10:20 +0000 | [diff] [blame] | 11 | // CHECK: invoke void @__cxa_bad_cast() [[NR:#[0-9]+]] |
Douglas Gregor | 69cfeb1 | 2010-05-14 21:31:02 +0000 | [diff] [blame] | 12 | dynamic_cast<const B&>(*a); |
Douglas Gregor | e37706d | 2010-05-14 21:50:50 +0000 | [diff] [blame] | 13 | } catch (...) { |
Bill Wendling | 285cfd8 | 2011-09-19 20:31:14 +0000 | [diff] [blame] | 14 | // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) |
| 15 | // CHECK-NEXT: catch i8* null |
Douglas Gregor | 485ee32 | 2010-05-14 21:14:41 +0000 | [diff] [blame] | 16 | } |
| 17 | return fail; |
Anders Carlsson | 6f0e485 | 2009-12-18 14:55:04 +0000 | [diff] [blame] | 18 | } |
Benjamin Kramer | 21f6b39 | 2013-02-03 17:44:25 +0000 | [diff] [blame] | 19 | |
Bill Wendling | 8992457 | 2013-02-27 00:06:04 +0000 | [diff] [blame] | 20 | // CHECK: declare i8* @__dynamic_cast(i8*, i8*, i8*, i64) [[NUW_RO:#[0-9]+]] |
Bill Wendling | f7a9da0 | 2013-02-20 07:22:19 +0000 | [diff] [blame] | 21 | |
Bill Wendling | 8992457 | 2013-02-27 00:06:04 +0000 | [diff] [blame] | 22 | // CHECK: attributes [[NUW_RO]] = { nounwind readonly } |
Bill Wendling | 4e1125f | 2013-02-22 09:10:20 +0000 | [diff] [blame] | 23 | // CHECK: attributes [[NR]] = { noreturn } |