Skip to content

Commit adb4562

Browse files
committed
Forcibly disable static constant array emission for now
This code currently uses the "empty array" metadata for static arrays (because the "empty array" can never be freed and the metadata on the array storage is not actually used in Swift). But that doesn't work if the array is passed to Objective-C, which does rely on the metadata. So Objective-C code would see bridged arrays of this type as empty. Workaround for: rdar://101126543
1 parent 85399f5 commit adb4562

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/IRGen/IRGenModule.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,6 +1858,12 @@ bool IRGenModule::shouldPrespecializeGenericMetadata() {
18581858
}
18591859

18601860
bool IRGenModule::canMakeStaticObjectsReadOnly() {
1861+
// Unconditionally disable this until we can fix the metadata.
1862+
// The trick of using the Empty array metadata for static arrays
1863+
// breaks Obj-C interop quite badly.
1864+
// rdar://101126543
1865+
return false;
1866+
18611867
if (getOptions().DisableReadonlyStaticObjects)
18621868
return false;
18631869

0 commit comments

Comments
 (0)