Files
swift-mirror/test/DebugInfo/generic_arg5.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

26 lines
926 B
Swift

// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s
public struct S<Type>
{
let value : Type
}
public func foo<Type>(_ values : [S<Type>])
{
// CHECK: define {{.*}}$S12generic_arg53fooyySayAA1SVyxGGlFAESgAEXEfU_
// CHECK: call void @llvm.dbg.declare
// CHECK: call void @llvm.dbg.declare(metadata %[[TY:.*]]** %[[ALLOCA:[^,]+]],
// CHECK-SAME: metadata ![[ARG:[0-9]+]],
// CHECK-SAME: metadata !DIExpression(DW_OP_deref))
// CHECK: store %[[TY]]* %1, %[[TY]]** %[[ALLOCA]], align
// The argument is a by-ref struct and thus needs to be dereferenced.
// CHECK: ![[ARG]] = !DILocalVariable(name: "arg", arg: 1,
// CHECK-SAME: line: [[@LINE+4]],
// CHECK-SAME: type: ![[TY:.*]])
// CHECK: ![[TY]] = !DICompositeType(
// CHECK-SAME: identifier: "$S12generic_arg51SVyxGD")
let _ = values.flatMap { arg in
return .some(arg)
}
}