Files
swift-mirror/test/DebugInfo/LoadableByAddress.swift
Adrian Prantl 521de91ba7 Fix the debug info generated by the LoadableByAddress transformation.
And unbreak the LLDB testsuite.

This patch fixes three problems with the original implementation:
- Use SILBuilderWithScope instead of SILBuilder to avoid holes in the
  lexical scopes.
- Use an artificial location for stores to the alloca to avoid the debugger
  stopping before the variable is initialized.
- Recognize debug_value_addr instructions referring to an alloc_stack
  instruction to avoid introducing an extra indirection in the debug info.

rdar://problem/31975108
2017-12-02 16:48:34 -08:00

26 lines
676 B
Swift

// RUN: %target-swift-frontend %s -module-name A -emit-ir -g -o - | %FileCheck %s
// REQUIRES: CPU=x86_64
public struct Continuation<A> {
private let magicToken = "Hello World"
fileprivate let f: (() -> A)?
public func run() {}
}
public typealias ContinuationU = Continuation<()>
// CHECK: %2 = alloca %T1A12ContinuationV, align 8
// CHECK-NEXT: call void @llvm.dbg.declare(metadata %T1A12ContinuationV* %2,
// CHECK-SAME: metadata ![[X:.*]], metadata !DIExpression())
// CHECK: ![[X]] = !DILocalVariable(name: "x",
public func f<A>(_ xs: [Continuation<A>]) -> (() -> A?) {
return {
for x in xs {
x.run()
}
return nil
}
}