IRGen: Correctly set and honor the "is reflectable" bit on structs and classes.

If we only emit an opaque reflection record for a struct or class, then we can't reflect its fields. We failed both to clear the "is reflectable" bit in the context descriptor for non-reflectable structs, and to check for the bit before trying to present a struct's fields as children in the runtime. rdar://problem/41274260
This commit is contained in:
Joe Groff
2018-07-03 13:14:29 -07:00
parent 55eb35c0f9
commit 06ac23842f
3 changed files with 29 additions and 1 deletions

View File

@@ -14,6 +14,7 @@
import Swift
import Foundation
import simd
#if os(macOS)
import AppKit
@@ -284,6 +285,11 @@ testQLO(HasStringQLO.self)
// CHECK-NEXT: HasStringQLO overboard
// CHECK-NEXT: CanaryBase overboard
// simd types get no reflection info, so should have no mirror children
let x = float4(0)
print("float4 has \(Mirror(reflecting: x).children.count) children")
// CHECK-NEXT: float4 has 0 children
// CHECK-LABEL: and now our song is done
print("and now our song is done")