Home | History | Annotate | Download | only in WinEH
      1 ; RUN: opt -lint -disable-output < %s
      2 
      3 ; This test is meant to prove that the verifier does not report errors for correct
      4 ; use of the llvm.eh.exceptionpointer intrinsic.
      5 
      6 target triple = "x86_64-pc-windows-msvc"
      7 
      8 declare i8* @llvm.eh.exceptionpointer.p0i8(token)
      9 declare i8 addrspace(1)* @llvm.eh.exceptionpointer.p1i8(token)
     10 
     11 declare void @f(...)
     12 
     13 define void @test1() personality i32 (...)* @__CxxFrameHandler3 {
     14 entry:
     15   invoke void (...) @f(i32 1)
     16      to label %exit unwind label %catchpad
     17 catchpad:
     18   %cs1 = catchswitch within none [label %do_catch] unwind to caller
     19 do_catch:
     20   %catch = catchpad within %cs1 [i32 1]
     21   %exn = call i8* @llvm.eh.exceptionpointer.p0i8(token %catch)
     22   call void (...) @f(i8* %exn)
     23   catchret from %catch to label %exit
     24 exit:
     25   ret void
     26 }
     27 
     28 define void @test2() personality i32 (...)* @ProcessManagedException {
     29 entry:
     30   invoke void (...) @f(i32 1)
     31      to label %exit unwind label %catchpad
     32 catchpad:
     33   %cs1 = catchswitch within none [label %do_catch] unwind to caller
     34 do_catch:
     35   %catch = catchpad within %cs1 [i32 1]
     36   %exn = call i8 addrspace(1)* @llvm.eh.exceptionpointer.p1i8(token %catch)
     37   call void (...) @f(i8 addrspace(1)* %exn)
     38   catchret from %catch to label %exit
     39 exit:
     40   ret void
     41 }
     42 
     43 declare i32 @__CxxFrameHandler3(...)
     44 declare i32 @ProcessManagedException(...)
     45