Files
swift-mirror/test/DebugInfo/generic_enum_closure.swift
Slava Pestov 38f27c0496 Sema: Always add synthesized accessors in the same spot
We had some non-deterministic behavior where depending on
validation order, synthesized accessors would end up in
different places because we would sometimes just add them
at the end of the member list.

Now add the getter right after the storage, the setter
right after the getter and the materializeForSet right
after the setter.

This changes some test output where the declaration order
did not make sense before but should otherwise have no
functional effect.
2017-03-23 18:17:41 -07:00

21 lines
794 B
Swift

// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
struct __CurrentErrno {}
struct CErrorOr<T>
{
var value : T?
init(x : __CurrentErrno) {
// CHECK: define hidden {{.*}}void @_T020generic_enum_closure8CErrorOrVACyxGAA14__CurrentErrnoV1x_tcfC
// CHECK-NOT: define
// This is a SIL-level debug_value_addr instruction.
// CHECK: call void @llvm.dbg.value({{.*}}, metadata ![[SELF:.*]], metadata !{{[0-9]+}})
// CHECK: ![[T1:.*]] = !DICompositeType({{.*}}, identifier: "_T020generic_enum_closure8CErrorOrVyACQq_GD")
// CHECK: ![[SELF]] = !DILocalVariable(name: "self", scope: {{.*}}, type: ![[T1]])
value = .none
}
func isError() -> Bool {
assert(value != nil, "the object should not contain an error")
return false
}
}