David Majnemer | dfa6d20 | 2015-03-11 18:36:39 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -o - -triple=i386-pc-win32 -std=c++11 %s -fcxx-exceptions | FileCheck %s |
David Majnemer | 7c23707 | 2015-03-05 00:46:22 +0000 | [diff] [blame] | 2 | |
| 3 | // CHECK-DAG: @"\01??_R0?AUY@@@8" = linkonce_odr global %rtti.TypeDescriptor7 { i8** @"\01??_7type_info@@6B@", i8* null, [8 x i8] c".?AUY@@\00" }, comdat |
David Majnemer | 322fe41 | 2015-03-06 23:45:23 +0000 | [diff] [blame] | 4 | // CHECK-DAG: @"_CT??_R0?AUY@@@8??0Y@@QAE@ABU0@@Z8" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 4, i8* bitcast (%rtti.TypeDescriptor7* @"\01??_R0?AUY@@@8" to i8*), i32 0, i32 -1, i32 0, i32 8, i8* bitcast (%struct.Y* (%struct.Y*, %struct.Y*, i32)* @"\01??0Y@@QAE@ABU0@@Z" to i8*) }, section ".xdata", comdat |
David Majnemer | 7c23707 | 2015-03-05 00:46:22 +0000 | [diff] [blame] | 5 | // CHECK-DAG: @"\01??_R0?AUZ@@@8" = linkonce_odr global %rtti.TypeDescriptor7 { i8** @"\01??_7type_info@@6B@", i8* null, [8 x i8] c".?AUZ@@\00" }, comdat |
David Majnemer | 322fe41 | 2015-03-06 23:45:23 +0000 | [diff] [blame] | 6 | // CHECK-DAG: @"_CT??_R0?AUZ@@@81" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 0, i8* bitcast (%rtti.TypeDescriptor7* @"\01??_R0?AUZ@@@8" to i8*), i32 0, i32 -1, i32 0, i32 1, i8* null }, section ".xdata", comdat |
David Majnemer | 7c23707 | 2015-03-05 00:46:22 +0000 | [diff] [blame] | 7 | // CHECK-DAG: @"\01??_R0?AUW@@@8" = linkonce_odr global %rtti.TypeDescriptor7 { i8** @"\01??_7type_info@@6B@", i8* null, [8 x i8] c".?AUW@@\00" }, comdat |
David Majnemer | 999cbf9 | 2015-03-10 19:01:51 +0000 | [diff] [blame] | 8 | // CHECK-DAG: @"_CT??_R0?AUW@@@8??0W@@QAE@ABU0@@Z44" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 4, i8* bitcast (%rtti.TypeDescriptor7* @"\01??_R0?AUW@@@8" to i8*), i32 4, i32 -1, i32 0, i32 4, i8* bitcast (%struct.W* (%struct.W*, %struct.W*, i32)* @"\01??0W@@QAE@ABU0@@Z" to i8*) }, section ".xdata", comdat |
David Majnemer | 7c23707 | 2015-03-05 00:46:22 +0000 | [diff] [blame] | 9 | // CHECK-DAG: @"\01??_R0?AUM@@@8" = linkonce_odr global %rtti.TypeDescriptor7 { i8** @"\01??_7type_info@@6B@", i8* null, [8 x i8] c".?AUM@@\00" }, comdat |
David Majnemer | 999cbf9 | 2015-03-10 19:01:51 +0000 | [diff] [blame] | 10 | // CHECK-DAG: @"_CT??_R0?AUM@@@818" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 0, i8* bitcast (%rtti.TypeDescriptor7* @"\01??_R0?AUM@@@8" to i8*), i32 8, i32 -1, i32 0, i32 1, i8* null }, section ".xdata", comdat |
David Majnemer | 7c23707 | 2015-03-05 00:46:22 +0000 | [diff] [blame] | 11 | // CHECK-DAG: @"\01??_R0?AUV@@@8" = linkonce_odr global %rtti.TypeDescriptor7 { i8** @"\01??_7type_info@@6B@", i8* null, [8 x i8] c".?AUV@@\00" }, comdat |
David Majnemer | 999cbf9 | 2015-03-10 19:01:51 +0000 | [diff] [blame] | 12 | // CHECK-DAG: @"_CT??_R0?AUV@@@81044" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 0, i8* bitcast (%rtti.TypeDescriptor7* @"\01??_R0?AUV@@@8" to i8*), i32 0, i32 4, i32 4, i32 1, i8* null }, section ".xdata", comdat |
| 13 | // CHECK-DAG: @"_CTA5?AUY@@" = linkonce_odr unnamed_addr constant %eh.CatchableTypeArray.5 { i32 5, [5 x %eh.CatchableType*] [%eh.CatchableType* @"_CT??_R0?AUY@@@8??0Y@@QAE@ABU0@@Z8", %eh.CatchableType* @"_CT??_R0?AUZ@@@81", %eh.CatchableType* @"_CT??_R0?AUW@@@8??0W@@QAE@ABU0@@Z44", %eh.CatchableType* @"_CT??_R0?AUM@@@818", %eh.CatchableType* @"_CT??_R0?AUV@@@81044"] }, section ".xdata", comdat |
David Majnemer | 322fe41 | 2015-03-06 23:45:23 +0000 | [diff] [blame] | 14 | // CHECK-DAG: @"_TI5?AUY@@" = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 0, i8* bitcast (void (%struct.Y*)* @"\01??_DY@@QAE@XZ" to i8*), i8* null, i8* bitcast (%eh.CatchableTypeArray.5* @"_CTA5?AUY@@" to i8*) }, section ".xdata", comdat |
David Majnemer | dfa6d20 | 2015-03-11 18:36:39 +0000 | [diff] [blame] | 15 | // CHECK-DAG: @"_CT??_R0?AUDefault@@@8??_ODefault@@QAEXAAU0@@Z1" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 0, i8* bitcast (%rtti.TypeDescriptor13* @"\01??_R0?AUDefault@@@8" to i8*), i32 0, i32 -1, i32 0, i32 1, i8* bitcast (void (%struct.Default*, %struct.Default*)* @"\01??_ODefault@@QAEXAAU0@@Z" to i8*) }, section ".xdata", comdat |
| 16 | // CHECK-DAG: @"_CT??_R0?AUVariadic@@@8??_OVariadic@@QAEXAAU0@@Z1" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 0, i8* bitcast (%rtti.TypeDescriptor14* @"\01??_R0?AUVariadic@@@8" to i8*), i32 0, i32 -1, i32 0, i32 1, i8* bitcast (void (%struct.Variadic*, %struct.Variadic*)* @"\01??_OVariadic@@QAEXAAU0@@Z" to i8*) }, section ".xdata", comdat |
| 17 | // CHECK-DAG: @"_CT??_R0?AUTemplateWithDefault@@@8??$?_OH@TemplateWithDefault@@QAEXAAU0@@Z1" = linkonce_odr unnamed_addr constant %eh.CatchableType { i32 0, i8* bitcast (%rtti.TypeDescriptor25* @"\01??_R0?AUTemplateWithDefault@@@8" to i8*), i32 0, i32 -1, i32 0, i32 1, i8* bitcast (void (%struct.TemplateWithDefault*, %struct.TemplateWithDefault*)* @"\01??$?_OH@TemplateWithDefault@@QAEXAAU0@@Z" to i8*) }, section ".xdata", comdat |
David Majnemer | 7c23707 | 2015-03-05 00:46:22 +0000 | [diff] [blame] | 18 | |
| 19 | |
| 20 | struct N { ~N(); }; |
| 21 | struct M : private N {}; |
| 22 | struct X {}; |
| 23 | struct Z {}; |
| 24 | struct V : private X {}; |
| 25 | struct W : M, virtual V {}; |
| 26 | struct Y : Z, W, virtual V {}; |
| 27 | |
| 28 | void f(const Y &y) { |
| 29 | // CHECK-LABEL: @"\01?f@@YAXABUY@@@Z" |
| 30 | // CHECK: call x86_thiscallcc %struct.Y* @"\01??0Y@@QAE@ABU0@@Z"(%struct.Y* %[[mem:.*]], %struct.Y* |
| 31 | // CHECK: %[[cast:.*]] = bitcast %struct.Y* %[[mem]] to i8* |
David Majnemer | d3d7669 | 2015-03-06 23:45:20 +0000 | [diff] [blame] | 32 | // CHECK: call void @_CxxThrowException(i8* %[[cast]], %eh.ThrowInfo* @"_TI5?AUY@@") |
| 33 | throw y; |
| 34 | } |
| 35 | |
| 36 | void g(const int *const *y) { |
| 37 | // CHECK-LABEL: @"\01?g@@YAXPBQBH@Z" |
| 38 | // CHECK: call void @_CxxThrowException(i8* %{{.*}}, %eh.ThrowInfo* @_TIC2PAPBH) |
David Majnemer | 7c23707 | 2015-03-05 00:46:22 +0000 | [diff] [blame] | 39 | throw y; |
| 40 | } |
David Majnemer | dfa6d20 | 2015-03-11 18:36:39 +0000 | [diff] [blame] | 41 | |
| 42 | struct Default { |
| 43 | Default(Default &, int = 42); |
| 44 | }; |
| 45 | |
| 46 | // CHECK-LABEL: @"\01??_ODefault@@QAEXAAU0@@Z" |
| 47 | // CHECK: %[[src_addr:.*]] = alloca |
| 48 | // CHECK: %[[this_addr:.*]] = alloca |
| 49 | // CHECK: store {{.*}} %src, {{.*}} %[[src_addr]], align 4 |
| 50 | // CHECK: store {{.*}} %this, {{.*}} %[[this_addr]], align 4 |
| 51 | // CHECK: %[[this:.*]] = load {{.*}} %[[this_addr]] |
| 52 | // CHECK: %[[src:.*]] = load {{.*}} %[[src_addr]] |
| 53 | // CHECK: call x86_thiscallcc {{.*}} @"\01??0Default@@QAE@AAU0@H@Z"({{.*}} %[[this]], {{.*}} %[[src]], i32 42) |
| 54 | // CHECK: ret void |
| 55 | |
| 56 | void h(Default &d) { |
| 57 | throw d; |
| 58 | } |
| 59 | |
| 60 | struct Variadic { |
| 61 | Variadic(Variadic &, ...); |
| 62 | }; |
| 63 | |
| 64 | void i(Variadic &v) { |
| 65 | throw v; |
| 66 | } |
| 67 | |
| 68 | // CHECK-LABEL: @"\01??_OVariadic@@QAEXAAU0@@Z" |
| 69 | // CHECK: %[[src_addr:.*]] = alloca |
| 70 | // CHECK: %[[this_addr:.*]] = alloca |
| 71 | // CHECK: store {{.*}} %src, {{.*}} %[[src_addr:.*]], align |
| 72 | // CHECK: store {{.*}} %this, {{.*}} %[[this_addr:.*]], align |
| 73 | // CHECK: %[[this:.*]] = load {{.*}} %[[this_addr]] |
| 74 | // CHECK: %[[src:.*]] = load {{.*}} %[[src_addr]] |
| 75 | // CHECK: %call = call {{.*}} @"\01??0Variadic@@QAA@AAU0@ZZ"({{.*}} %[[this]], {{.*}} %[[src]]) |
| 76 | // CHECK: ret void |
| 77 | |
| 78 | struct TemplateWithDefault { |
| 79 | template <typename T> |
| 80 | static int f() { |
| 81 | return 0; |
| 82 | } |
| 83 | template <typename T = int> |
| 84 | TemplateWithDefault(TemplateWithDefault &, T = f<T>()); |
| 85 | }; |
| 86 | |
| 87 | void j(TemplateWithDefault &twd) { |
| 88 | throw twd; |
| 89 | } |