| Eric Christopher | 79cc1e3 | 2014-09-02 22:28:02 +0000 | [diff] [blame] | 1 | ; RUN: %lli %s | 
| Rafael Espindola | 65c016b | 2013-05-13 00:18:24 +0000 | [diff] [blame] | 2 | ; XFAIL: arm, cygwin, win32, mingw | 
| Rafael Espindola | fa5942b | 2013-05-05 20:43:10 +0000 | [diff] [blame] | 3 | declare i8* @__cxa_allocate_exception(i64) | 
|  | 4 | declare void @__cxa_throw(i8*, i8*, i8*) | 
|  | 5 | declare i32 @__gxx_personality_v0(...) | 
| Rafael Espindola | 57dc142 | 2013-05-06 13:30:52 +0000 | [diff] [blame] | 6 | declare void @__cxa_end_catch() | 
|  | 7 | declare i8* @__cxa_begin_catch(i8*) | 
| Rafael Espindola | fa5942b | 2013-05-05 20:43:10 +0000 | [diff] [blame] | 8 |  | 
|  | 9 | @_ZTIi = external constant i8* | 
|  | 10 |  | 
|  | 11 | define 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 |  | 
|  | 17 | define i32 @main() { | 
|  | 18 | entry: | 
|  | 19 | invoke void @throwException() | 
|  | 20 | to label %try.cont unwind label %lpad | 
|  | 21 |  | 
|  | 22 | lpad: | 
|  | 23 | %p = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) | 
|  | 24 | catch i8* bitcast (i8** @_ZTIi to i8*) | 
| Rafael Espindola | 57dc142 | 2013-05-06 13:30:52 +0000 | [diff] [blame] | 25 | %e = extractvalue { i8*, i32 } %p, 0 | 
|  | 26 | call i8* @__cxa_begin_catch(i8* %e) | 
|  | 27 | call void @__cxa_end_catch() | 
| Rafael Espindola | fa5942b | 2013-05-05 20:43:10 +0000 | [diff] [blame] | 28 | br label %try.cont | 
|  | 29 |  | 
|  | 30 | try.cont: | 
|  | 31 | ret i32 0 | 
|  | 32 | } |