File: windows-itanium-exceptions.cpp

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (48 lines) | stat: -rw-r--r-- 1,701 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// RUN: %clang_cc1 -no-opaque-pointers -emit-llvm -triple thumbv7-windows-itanium -fexceptions -fcxx-exceptions %s -o - | FileCheck %s
// RUN: %clang_cc1 -no-opaque-pointers -emit-llvm -triple i686-windows-itanium -fexceptions -fcxx-exceptions %s -o - | FileCheck %s
// REQUIRES: asserts

void except() {
  throw 32;
}

void attempt() {
  try { except(); } catch (...) { }
}

// CHECK: @_ZTIi = external dso_local constant i8*

// CHECK: define {{.*}}void @_Z6exceptv() {{.*}} {
// CHECK:   %exception = call {{.*}}i8* @__cxa_allocate_exception(i32 4)
// CHECK:   %0 = bitcast i8* %exception to i32*
// CHECK:   store i32 32, i32* %0
// CHECK:   call {{.*}}void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null)
// CHECK:   unreachable
// CHECK: }

// CHECK: define {{.*}}void @_Z7attemptv()
// CHECK-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
// CHECK:   %exn.slot = alloca i8*
// CHECK:   %ehselector.slot = alloca i32
// CHECK:   invoke {{.*}}void @_Z6exceptv()
// CHECK:     to label %invoke.cont unwind label %lpad
// CHECK: invoke.cont:
// CHECK:    br label %try.cont
// CHECK: lpad:
// CHECK:    %0 = landingpad { i8*, i32 }
// CHECK:      catch i8* null
// CHECK:    %1 = extractvalue { i8*, i32 } %0, 0
// CHECK:    store i8* %1, i8** %exn.slot
// CHECK:    %2 = extractvalue { i8*, i32 } %0, 1
// CHECK:    store i32 %2, i32* %ehselector.slot
// CHECK:    br label %catch
// CHECK: catch:
// CHECK:    %exn = load i8*, i8** %exn.slot
// CHECK:    %3 = call {{.*}}i8* @__cxa_begin_catch(i8* %{{2|exn}})
// CHECK:    call {{.*}}void @__cxa_end_catch()
// CHECK:    br label %try.cont
// CHECK: try.cont:
// CHECK:    ret void
// CHECK: }