File: dllimport_gh3926.d

package info (click to toggle)
ldc 1%3A1.30.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 59,248 kB
  • sloc: cpp: 61,598; ansic: 14,545; sh: 1,014; makefile: 972; asm: 510; objc: 135; exp: 48; python: 12
file content (31 lines) | stat: -rw-r--r-- 950 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
// REQUIRES: Windows

// RUN: %ldc -output-ll -dllimport=all -of=%t.ll %s && FileCheck %s < %t.ll

import std.variant : Variant; // pre-instantiated template

void foo()
{
    // define TypeInfo_Struct referencing dllimported Variant vtable and init symbol
    auto t = typeid(Variant);
}

// no direct init symbol refs:
// CHECK-NOT: @_D3std7variant__T8VariantN{{.*}}6__initZ

// dllimported init symbol:
// CHECK: @_D3std7variant__T8VariantN{{.*}}6__initZ = external dllimport

// no direct init symbol refs:
// CHECK-NOT: @_D3std7variant__T8VariantN{{.*}}6__initZ

// check generated CRT constructor:
// CHECK:      define private void @ldc.dllimport_relocation()

// should set the vptr:
// CHECK:      if:
// CHECK-NEXT: store [{{[0-9]+}} x i8*]* @_D15TypeInfo_Struct6__vtblZ,

// should set m_init.ptr:
// CHECK:      if1:
// CHECK-NEXT: store i8* getelementptr inbounds ({{.*}} @_D3std7variant__T8VariantN{{.*}}6__initZ, i32 0, i32 0, i32 0),