Files
swift-mirror/test/DebugInfo/structs.swift
Arnold Schwaighofer 39fa2f0228 Use the swift calling convention for swift functions
Use the generic type lowering algorithm described in
"docs/CallingConvention.rst#physical-lowering" to map from IRGen's explosion
type to the type expected by the ABI.

Change IRGen to use the swift calling convention (swiftcc) for native swift
functions.

Use the 'swiftself' attribute on self parameters and for closures contexts.

Use the 'swifterror' parameter for swift error parameters.

Change functions in the runtime that are called as native swift functions to use
the swift calling convention.

rdar://19978563
2017-02-14 12:17:57 -08:00

31 lines
970 B
Swift

// RUN: %target-swift-frontend -Xllvm -new-mangling-for-tests -primary-file %s -emit-ir -g -o - | %FileCheck %s
// Capture the pointer size from type Int
// CHECK: %Si = type <{ i[[PTRSIZE:[0-9]+]] }>
struct A {
var fn : () -> ()
}
func test(_ x : A) {
var _ = x
}
// CHECK: define hidden {{.*}}void @_T07structs4test{{[_0-9a-zA-Z]*}}F
// CHECK: [[X_DBG:%.*]] = alloca
// CHECK: call void @llvm.dbg.declare(metadata {{.*}}* [[X_DBG]], metadata [[X_MD:!.*]], metadata
// CHECK: ![[A_DI:.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "A",{{.*}}identifier
class C {
var lots_of_extra_storage: (Int, Int, Int) = (1, 2, 3)
var member: C = C()
}
// CHECK: [[X_MD]] = !DILocalVariable(name: "x", arg: 1
// CHECK-SAME: type: ![[A_DI]]
// A class is represented by a pointer, so B's total size should be PTRSIZE.
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "B",{{.*}}size: [[PTRSIZE]]
struct B {
var c : C
}