Files
swift-mirror/test/DebugInfo/generic_arg.swift
Adrian Prantl bab3000069 Use depth and index to lookup type metadata artificial variables
instead of using name and decl context.

The advantages of this approach are three-fold:
- This is necessary to support inlined generic functions.
- We can retire the debugger-specific type name manfgling mode for archetypes.
- This saves 270kb of debug information in the x86_64 libSwiftCore.dylib alone.

<rdar://problem/38306256>
2018-06-12 12:48:15 -07:00

22 lines
1006 B
Swift

// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
import StdlibUnittest
func foo<T>(_ x: T) -> () {
// CHECK: define {{.*}} @"$S11generic_arg3fooyyxlF"
// CHECK: %[[T:.*]] = alloca %swift.type*
// CHECK: call void @llvm.dbg.declare(metadata %swift.type** %[[T]],
// CHECK-SAME: metadata ![[T1:.*]], metadata !DIExpression())
// CHECK: %[[X:.*]] = alloca %swift.opaque*
// CHECK: call void @llvm.dbg.declare(metadata %swift.opaque** %[[X]],
// CHECK-SAME: metadata ![[X1:.*]], metadata !DIExpression())
// CHECK: store %swift.type* %T, %swift.type** %[[T]],
// CHECK: store %swift.opaque* %0, %swift.opaque** %[[X]],
// CHECK: ![[T1]] = !DILocalVariable(name: "$\CF\84_0_0",
// CHECK-SAME: flags: DIFlagArtificial)
// CHECK: ![[X1]] = !DILocalVariable(name: "x", arg: 1,
// CHECK-SAME: line: 3, type: ![[TY:.*]])
// CHECK: ![[TY]] = !DICompositeType({{.*}}identifier: "$SxD")
_blackHole(x)
}
foo(42)