mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
IRGen: apply IR linkage to trivial property descriptors
This ensures that the trivial property descriptors is externally accessible on targets like Windows which does not export symbols by default. Thanks to Joe Groff for the pointer about the global aliases for trivial property descriptors!
This commit is contained in:
@@ -1274,9 +1274,13 @@ void IRGenModule::emitSILProperty(SILProperty *prop) {
|
||||
} else {
|
||||
auto entity = LinkEntity::forPropertyDescriptor(prop->getDecl());
|
||||
auto linkInfo = LinkInfo::get(*this, entity, ForDefinition);
|
||||
llvm::GlobalAlias::create(linkInfo.getLinkage(),
|
||||
auto *GA = llvm::GlobalAlias::create(linkInfo.getLinkage(),
|
||||
linkInfo.getName(),
|
||||
TheTrivialPropertyDescriptor);
|
||||
ApplyIRLinkage({linkInfo.getLinkage(),
|
||||
linkInfo.getVisibility(),
|
||||
llvm::GlobalValue::DLLExportStorageClass})
|
||||
.to(GA);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
10
test/IRGen/trivial-property-descriptors.swift
Normal file
10
test/IRGen/trivial-property-descriptors.swift
Normal file
@@ -0,0 +1,10 @@
|
||||
// RUN: %swift -target x86_64-unknown-windows-msvc -parse-stdlib -module-name Swift -enable-resilience -S -emit-ir -o - %s | %FileCheck %s
|
||||
|
||||
public struct S {}
|
||||
extension S {
|
||||
public var i: () { return () }
|
||||
public var j: () { return () }
|
||||
}
|
||||
|
||||
// CHECK: @"$ss1SV1jytvpMV" = dllexport alias { i32 }, { i32 }* @"$ss1SV1iytvpMV"
|
||||
|
||||
Reference in New Issue
Block a user