blob: ed057e14512ff855fc6645e4f5e6a53dbeadedc2 [file] [log] [blame]
Eric Christopher79cc1e32014-09-02 22:28:02 +00001; RUN: %lli %s
Peter Collingbourne87debbb2015-12-15 23:46:21 +00002; XFAIL: arm, cygwin, win32, mingw
Rafael Espindolafa5942b2013-05-05 20:43:10 +00003declare i8* @__cxa_allocate_exception(i64)
4declare void @__cxa_throw(i8*, i8*, i8*)
5declare i32 @__gxx_personality_v0(...)
Rafael Espindola57dc1422013-05-06 13:30:52 +00006declare void @__cxa_end_catch()
7declare i8* @__cxa_begin_catch(i8*)
Rafael Espindolafa5942b2013-05-05 20:43:10 +00008
9@_ZTIi = external constant i8*
10
11define void @throwException() {
12 %exception = tail call i8* @__cxa_allocate_exception(i64 4)
13 call void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null)
14 unreachable
15}
16
David Majnemer7fddecc2015-06-17 20:52:32 +000017define i32 @main() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
Rafael Espindolafa5942b2013-05-05 20:43:10 +000018entry:
19 invoke void @throwException()
20 to label %try.cont unwind label %lpad
21
22lpad:
David Majnemer7fddecc2015-06-17 20:52:32 +000023 %p = landingpad { i8*, i32 }
Rafael Espindolafa5942b2013-05-05 20:43:10 +000024 catch i8* bitcast (i8** @_ZTIi to i8*)
Rafael Espindola57dc1422013-05-06 13:30:52 +000025 %e = extractvalue { i8*, i32 } %p, 0
26 call i8* @__cxa_begin_catch(i8* %e)
27 call void @__cxa_end_catch()
Rafael Espindolafa5942b2013-05-05 20:43:10 +000028 br label %try.cont
29
30try.cont:
31 ret i32 0
32}