File: witness_table_multifile.swift

package info (click to toggle)
swiftlang 6.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,532 kB
  • sloc: cpp: 9,901,743; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (19 lines) | stat: -rw-r--r-- 954 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// RUN: %target-swift-frontend -primary-file %s %S/Inputs/witness_table_multifile_2.swift -emit-ir -disable-objc-attr-requires-foundation-module | %FileCheck %s

// CHECK: [[P_WITNESS_TABLE:%[A-Za-z0-9_]+]] = type { [{{24|12}} x i8], ptr, ptr }

// CHECK-LABEL: define hidden swiftcc void @"$s23witness_table_multifile3baryyF"
func bar() {
  // CHECK: call swiftcc void @"$s23witness_table_multifile2goAA1P_pyF"
  // CHECK:  [[WITNESS_TABLE_ADDR:%[0-9]+]] = getelementptr inbounds [[P_WITNESS_TABLE]], ptr %0, i32 0, i32 2
  // CHECK:  [[WITNESS_TABLE:%[A-Za-z0-9_-]+]] = load ptr, ptr [[WITNESS_TABLE_ADDR]]
  // CHECK:  [[BUFFER:%[0-9]+]] = call ptr @__swift_project_boxed_opaque_existential_1
  // CHECK-NEXT: getelementptr inbounds ptr, ptr [[WITNESS_TABLE]], i32 4
  go().foo()
}

// Ensure that protocols from other files get fully validated even
// when they're only used as types.
func useAProtocol() -> ProtocolOnlyUsedAsAType? {
  return nil
}