mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
51 lines
2.0 KiB
Plaintext
51 lines
2.0 KiB
Plaintext
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -emit-ir %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
|
|
|
|
import Swift
|
|
|
|
// CHECK-64: @_T013indirect_enum5TreeAOWV = internal constant {{.*}} i8* inttoptr ([[WORD:i64]] 8 to i8*), i8* inttoptr (i64 2162695 to i8*), i8* inttoptr (i64 8 to i8*)
|
|
// CHECK-32: @_T013indirect_enum5TreeAOWV = internal constant {{.*}} i8* inttoptr ([[WORD:i32]] 4 to i8*), i8* inttoptr (i32 2162691 to i8*), i8* inttoptr (i32 4 to i8*)
|
|
|
|
// CHECK-LABEL: define{{( protected)?}} private %swift.type** @get_field_types_TreeA
|
|
// -- Leaf(T)
|
|
// CHECK: [[BITS:%.*]] = ptrtoint %swift.type* %T to [[WORD]]
|
|
// CHECK: [[INDIRECT_FLAG:%.*]] = or [[WORD]] [[BITS]], 1
|
|
// -- Branch(TreeA, TreeA)
|
|
// CHECK: [[TUPLE:%.*]] = call %swift.type* @swift_getTupleTypeMetadata2
|
|
// CHECK: [[BITS:%.*]] = ptrtoint %swift.type* [[TUPLE]]
|
|
// CHECK: [[INDIRECT_FLAG:%.*]] = or [[WORD]] [[BITS]], 1
|
|
indirect enum TreeA<T> {
|
|
case Nil
|
|
case Leaf(T)
|
|
case Branch(left: TreeA<T>, right: TreeA<T>)
|
|
}
|
|
|
|
// CHECK-LABEL: define{{( protected)?}} private %swift.type** @get_field_types_TreeB
|
|
// -- Leaf(T)
|
|
// CHECK-NOT: ptrtoint %swift.type* %T
|
|
// -- Branch(TreeA, TreeA)
|
|
// CHECK: [[TUPLE:%.*]] = call %swift.type* @swift_getTupleTypeMetadata2
|
|
// CHECK: [[BITS:%.*]] = ptrtoint %swift.type* [[TUPLE]]
|
|
// CHECK: [[INDIRECT_FLAG:%.*]] = or [[WORD]] [[BITS]], 1
|
|
enum TreeB<T> {
|
|
case Nil
|
|
case Leaf(T)
|
|
indirect case Branch(left: TreeB<T>, right: TreeB<T>)
|
|
}
|
|
|
|
// CHECK-LABEL: define{{( protected)?}} private %swift.type** @get_field_types_Foo
|
|
// -- Foo(Int)
|
|
// CHECK-64: (i64 or (i64 ptrtoint (%swift.type* @_T0SiN {{.*}}), [[WORD]] 1)
|
|
// CHECK-32: (i32 or (i32 ptrtoint (%swift.type* @_T0SiN {{.*}}), [[WORD]] 1)
|
|
// -- Bar(T)
|
|
// CHECK-NOT: ptrtoint %swift.type* %T
|
|
enum Foo<T> {
|
|
indirect case Foo(Int)
|
|
case Bar(T)
|
|
}
|
|
|
|
// rdar://problem/22169679
|
|
enum E<T> {
|
|
indirect case A(E)
|
|
case B(T)
|
|
}
|