[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / CodeGenCXX / dynamic-cast.cpp
blobb39186c85b60aa90a2f984560543be1ca5ef77ab
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 { };
5 // CHECK: {{define.*@_Z1fP1A}}
6 // CHECK-SAME: personality ptr @__gxx_personality_v0
7 B fail;
8 const B& f(A *a) {
9 try {
10 // CHECK: call ptr @__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 { ptr, i32 }
16 // CHECK-NEXT: catch ptr null
18 return fail;
21 // CHECK: declare ptr @__dynamic_cast(ptr, ptr, ptr, i64) [[NUW_RO:#[0-9]+]]
23 // CHECK: attributes [[NUW_RO]] = { nounwind willreturn memory(read) }
24 // CHECK: attributes [[NR]] = { noreturn }