diff options
author | Reid Kleckner <rnk@google.com> | 2015-09-16 20:15:55 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2015-09-16 20:15:55 +0000 |
commit | 837f189b75742d1a7c18e4664722c815043eeda7 (patch) | |
tree | cf56c51bff91e52c1ea13e9fed4d672f5b0346f5 /test/CodeGenCXX/microsoft-abi-eh-catch.cpp | |
parent | 911a7794522f96206fcd315f215cb4c3cffb9e71 (diff) |
[WinEH] Pass the catch adjectives to catchpad directly
This avoids building a fake LLVM IR global variable just to ferry an i32
down into LLVM codegen. It also puts a nail in the coffin of using MS
ABI C++ EH with landingpads, since now we'll assert in the lpad code
when flags are present.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247843 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/microsoft-abi-eh-catch.cpp')
-rw-r--r-- | test/CodeGenCXX/microsoft-abi-eh-catch.cpp | 82 |
1 files changed, 44 insertions, 38 deletions
diff --git a/test/CodeGenCXX/microsoft-abi-eh-catch.cpp b/test/CodeGenCXX/microsoft-abi-eh-catch.cpp index d7268bf385..d14edf8986 100644 --- a/test/CodeGenCXX/microsoft-abi-eh-catch.cpp +++ b/test/CodeGenCXX/microsoft-abi-eh-catch.cpp @@ -1,4 +1,6 @@ -// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=x86_64-pc-windows-msvc -mconstructor-aliases -fexceptions -fcxx-exceptions | FileCheck -check-prefix WIN64 %s +// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=x86_64-pc-windows-msvc \ +// RUN: -mconstructor-aliases -fexceptions -fcxx-exceptions -fnew-ms-eh \ +// RUN: | FileCheck -check-prefix WIN64 %s extern "C" void might_throw(); @@ -18,19 +20,22 @@ extern "C" void catch_all() { // WIN64: invoke void @might_throw() // WIN64-NEXT: to label %[[cont:[^ ]*]] unwind label %[[lpad:[^ ]*]] // -// WIN64: [[cont]] -// WIN64: br label %[[ret:[^ ]*]] -// // WIN64: [[lpad]] -// WIN64: landingpad { i8*, i32 } -// WIN64-NEXT: catch i8* null -// WIN64: call void @llvm.eh.begincatch(i8* %{{[^,]*}}, i8* null) +// WIN64: catchpad [i8* null, i32 64, i8* null] +// WIN64: to label %[[catchit:[^ ]*]] unwind label %{{.*}} +// +// WIN64: [[catchit]] // WIN64: call void @recover() -// WIN64: call void @llvm.eh.endcatch() -// WIN64: br label %[[ret]] +// WIN64: catchret %{{.*}} to label %[[catchret:[^ ]*]] +// +// WIN64: [[catchret]] +// WIN64-NEXT: br label %[[ret:[^ ]*]] // // WIN64: [[ret]] // WIN64: ret void +// +// WIN64: [[cont]] +// WIN64: br label %[[ret]] extern "C" void catch_int() { try { @@ -41,12 +46,10 @@ extern "C" void catch_int() { } // WIN64-LABEL: define void @catch_int() -// WIN64: landingpad { i8*, i32 } -// WIN64: %[[e_i8:[^ ]*]] = bitcast i32* %[[e_addr:[^ ]*]] to i8* -// WIN64: call void @llvm.eh.begincatch(i8* %{{.*}}, i8* %[[e_i8]]) +// WIN64: catchpad [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i32* %[[e_addr:[^\]]*]]] // WIN64: %[[e_i8:[^ ]*]] = bitcast i32* %[[e_addr]] to i8* // WIN64: call void @handle_exception(i8* %[[e_i8]]) -// WIN64: call void @llvm.eh.endcatch() +// WIN64: catchret extern "C" void catch_int_unnamed() { try { @@ -56,9 +59,8 @@ extern "C" void catch_int_unnamed() { } // WIN64-LABEL: define void @catch_int_unnamed() -// WIN64: landingpad { i8*, i32 } -// WIN64: call void @llvm.eh.begincatch(i8* %{{.*}}, i8* null) -// WIN64: call void @llvm.eh.endcatch() +// WIN64: catchpad [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i8* null] +// WIN64: catchret struct A { A(); @@ -84,12 +86,10 @@ extern "C" void catch_a_byval() { // WIN64-LABEL: define void @catch_a_byval() // WIN64: %[[e_addr:[^ ]*]] = alloca %struct.A -// WIN64: landingpad { i8*, i32 } -// WIN64: %[[e_i8:[^ ]*]] = bitcast %struct.A* %[[e_addr]] to i8* -// WIN64: call void @llvm.eh.begincatch(i8* %{{.*}}, i8* %[[e_i8]]) +// WIN64: catchpad [%rtti.TypeDescriptor7* @"\01??_R0?AUA@@@8", i32 0, %struct.A* %[[e_addr]]] // WIN64: %[[e_i8:[^ ]*]] = bitcast %struct.A* %[[e_addr]] to i8* // WIN64: call void @handle_exception(i8* %[[e_i8]]) -// WIN64: call void @llvm.eh.endcatch() +// WIN64: catchret extern "C" void catch_a_ref() { try { @@ -101,13 +101,11 @@ extern "C" void catch_a_ref() { // WIN64-LABEL: define void @catch_a_ref() // WIN64: %[[e_addr:[^ ]*]] = alloca %struct.A* -// WIN64: landingpad { i8*, i32 } -// WIN64: %[[e_i8:[^ ]*]] = bitcast %struct.A** %[[e_addr]] to i8* -// WIN64: call void @llvm.eh.begincatch(i8* %{{.*}}, i8* %[[e_i8]]) +// WIN64: catchpad [%rtti.TypeDescriptor7* @"\01??_R0?AUA@@@8", i32 8, %struct.A** %[[e_addr]]] // WIN64: %[[eptr:[^ ]*]] = load %struct.A*, %struct.A** %[[e_addr]] // WIN64: %[[eptr_i8:[^ ]*]] = bitcast %struct.A* %[[eptr]] to i8* // WIN64: call void @handle_exception(i8* %[[eptr_i8]]) -// WIN64: call void @llvm.eh.endcatch() +// WIN64: catchret extern "C" void fn_with_exc_spec() throw(int) { might_throw(); @@ -131,24 +129,32 @@ extern "C" void catch_nested() { // WIN64-LABEL: define void @catch_nested() // WIN64: invoke void @might_throw() -// WIN64-NEXT: to label %[[cont1:[^ ]*]] unwind label %[[lp1:[^ ]*]] -// WIN64: [[cont1]] +// WIN64-NEXT: to label %{{.*}} unwind label %[[lp1:[^ ]*]] // // WIN64: [[lp1]] -// WIN64: landingpad { i8*, i32 } -// WIN64: call void @llvm.eh.begincatch(i8* %{{.*}}, i8* null) +// WIN64: catchpad [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i8* null] +// WIN64: to label %[[catchit:[^ ]*]] unwind label %{{.*}} +// +// WIN64: [[catchit]] // WIN64: invoke void @might_throw() // WIN64-NEXT: to label %[[cont2:[^ ]*]] unwind label %[[lp2:[^ ]*]] // -// WIN64: [[cont2]] -// WIN64-NEXT: br label %[[trycont:[^ ]*]] -// // WIN64: [[lp2]] -// WIN64: landingpad { i8*, i32 } -// WIN64: call void @llvm.eh.begincatch(i8* %{{.*}}, i8* null) -// WIN64-NEXT: call void @might_throw() -// WIN64-NEXT: call void @llvm.eh.endcatch() -// WIN64-NEXT: br label %[[trycont]] +// WIN64: catchpad [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i8* null] +// WIN64: to label %[[catchit2:[^ ]*]] unwind label %[[endcatch2:[^ ]*]] +// +// WIN64: [[catchit2]] +// WIN64-NEXT: invoke void @might_throw() +// WIN64-NEXT: to label %[[catchret1:[^ ]*]] unwind label %[[endcatch2]] +// +// WIN64: [[catchret1]] +// WIN64: catchret {{.*}} to label %[[catchret2:[^ ]*]] +// +// WIN64: [[catchret2]] +// WIN64: catchret {{.*}} to label %[[mainret:[^ ]*]] +// +// WIN64: [[mainret]] +// WIN64: ret void // -// WIN64: [[trycont]] -// WIN64: call void @llvm.eh.endcatch() +// WIN64: [[endcatch2]] +// WIN64: catchendpad unwind label %{{.*}} |