File: runtimecc.cpp

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (52 lines) | stat: -rw-r--r-- 1,742 bytes parent folder | download | duplicates (4)
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
49
50
51
52
// RUN: %clang_cc1 %s -triple=armv7-apple-darwin10 -emit-llvm -o - -fexceptions -fcxx-exceptions | FileCheck %s

// Check that we annotate all compiler-synthesized runtime calls and
// functions with the actual ABI-determined CC.  This usually doesn't
// matter as long as we're internally consistent (and the LLVM-default
// CC is consistent with the real one), but it's possible for user
// translation units to define these runtime functions (or, equivalently,
// for us to get LTO'ed with such a translation unit), and then the
// mismatch will kill us.
//
// rdar://12818655

// CHECK: [[A:%.*]] = type { double }

namespace test0 {
  struct A {
    double d;
    A();
    ~A();
  };

  A global;
// CHECK-LABEL:    define internal void @__cxx_global_var_init()
// CHECK:      call noundef ptr @_ZN5test01AC1Ev(ptr {{[^,]*}} @_ZN5test06globalE)
// CHECK-NEXT: call i32 @__cxa_atexit(ptr @_ZN5test01AD1Ev, ptr @_ZN5test06globalE, ptr @__dso_handle) [[NOUNWIND:#[0-9]+]]
// CHECK-NEXT: ret void
}

// CHECK: declare i32 @__cxa_atexit(ptr, ptr, ptr) [[NOUNWIND]]

namespace test1 {
  void test() {
    throw 0;
  }

// CHECK-LABEL:    define{{.*}} void @_ZN5test14testEv()
// CHECK:      [[T0:%.*]] = call ptr @__cxa_allocate_exception(i32 4) [[NOUNWIND]]
// CHECK-NEXT: store i32 0, ptr [[T0]]
// CHECK-NEXT: call void @__cxa_throw(ptr [[T0]], ptr @_ZTIi, ptr null) [[NORETURN:#[0-9]+]]
// CHECK-NEXT: unreachable
}

// CHECK: declare ptr @__cxa_allocate_exception(i32)

// CHECK: declare void @__cxa_throw(ptr, ptr, ptr)

// CHECK-LABEL: define internal void @_GLOBAL__sub_I_runtimecc.cpp()
// CHECK:   call void @__cxx_global_var_init()


// CHECK: attributes [[NOUNWIND]] = { nounwind }
// CHECK: attributes [[NORETURN]] = { noreturn }