File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -1045,6 +1045,9 @@ struct IRLinkage {
1045
1045
static const IRLinkage InternalLinkOnceODR;
1046
1046
static const IRLinkage InternalWeakODR;
1047
1047
static const IRLinkage Internal;
1048
+
1049
+ static const IRLinkage ExternalImport;
1050
+ static const IRLinkage ExternalExport;
1048
1051
};
1049
1052
1050
1053
class ApplyIRLinkage {
Original file line number Diff line number Diff line change @@ -960,9 +960,7 @@ void IRGenModule::addLinkLibrary(const LinkLibrary &linkLib) {
960
960
encodeForceLoadSymbolName (buf, linkLib.getName ());
961
961
auto ForceImportThunk =
962
962
Module.getOrInsertFunction (buf, llvm::FunctionType::get (VoidTy, false ));
963
- ApplyIRLinkage ({llvm::GlobalValue::ExternalLinkage,
964
- llvm::GlobalValue::DefaultVisibility,
965
- llvm::GlobalValue::DLLImportStorageClass})
963
+ ApplyIRLinkage (IRLinkage::ExternalImport)
966
964
.to (cast<llvm::GlobalValue>(ForceImportThunk));
967
965
968
966
buf += " _$" ;
@@ -1084,10 +1082,7 @@ void IRGenModule::emitAutolinkInfo() {
1084
1082
llvm::Function::Create (llvm::FunctionType::get (VoidTy, false ),
1085
1083
llvm::GlobalValue::ExternalLinkage, buf,
1086
1084
&Module);
1087
- ApplyIRLinkage ({llvm::GlobalValue::ExternalLinkage,
1088
- llvm::GlobalValue::DefaultVisibility,
1089
- llvm::GlobalValue::DLLExportStorageClass})
1090
- .to (ForceImportThunk);
1085
+ ApplyIRLinkage (IRLinkage::ExternalExport).to (ForceImportThunk);
1091
1086
1092
1087
auto BB = llvm::BasicBlock::Create (getLLVMContext (), " " , ForceImportThunk);
1093
1088
llvm::IRBuilder<> IRB (BB);
Original file line number Diff line number Diff line change @@ -49,6 +49,18 @@ const IRLinkage IRLinkage::Internal = {
49
49
llvm::GlobalValue::DefaultStorageClass,
50
50
};
51
51
52
+ const IRLinkage IRLinkage::ExternalImport = {
53
+ llvm::GlobalValue::ExternalLinkage,
54
+ llvm::GlobalValue::DefaultVisibility,
55
+ llvm::GlobalValue::DLLImportStorageClass,
56
+ };
57
+
58
+ const IRLinkage IRLinkage::ExternalExport = {
59
+ llvm::GlobalValue::ExternalLinkage,
60
+ llvm::GlobalValue::DefaultVisibility,
61
+ llvm::GlobalValue::DLLExportStorageClass,
62
+ };
63
+
52
64
bool swift::irgen::useDllStorage (const llvm::Triple &triple) {
53
65
return triple.isOSBinFormatCOFF () && !triple.isOSCygMing ();
54
66
}
You can’t perform that action at this time.
0 commit comments