Skip to content

Commit a6df046

Browse files
committed
IRGen: create InternalWeakODR named IRLinkage (NFC)
Create a new named IRLinkage type: `InternalWeakODR`. This just gives the IRLinkage a semantic name rather than the computed value. NFC.
1 parent 50d6b19 commit a6df046

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

include/swift/IRGen/Linking.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,7 @@ struct IRLinkage {
10431043
llvm::GlobalValue::DLLStorageClassTypes DLLStorage;
10441044

10451045
static const IRLinkage InternalLinkOnceODR;
1046+
static const IRLinkage InternalWeakODR;
10461047
static const IRLinkage Internal;
10471048
};
10481049

lib/IRGen/IRGenModule.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -975,10 +975,7 @@ void IRGenModule::addLinkLibrary(const LinkLibrary &linkLib) {
975975
/*isConstant=*/true,
976976
llvm::GlobalValue::WeakODRLinkage,
977977
ForceImportThunk, buf.str());
978-
ApplyIRLinkage({llvm::GlobalValue::WeakODRLinkage,
979-
llvm::GlobalValue::HiddenVisibility,
980-
llvm::GlobalValue::DefaultStorageClass})
981-
.to(ref);
978+
ApplyIRLinkage(IRLinkage::InternalWeakODR).to(ref);
982979
auto casted = llvm::ConstantExpr::getBitCast(ref, Int8PtrTy);
983980
LLVMUsed.push_back(casted);
984981
}

lib/IRGen/Linking.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ const IRLinkage IRLinkage::InternalLinkOnceODR = {
3737
llvm::GlobalValue::DefaultStorageClass,
3838
};
3939

40+
const IRLinkage IRLinkage::InternalWeakODR = {
41+
llvm::GlobalValue::WeakODRLinkage,
42+
llvm::GlobalValue::HiddenVisibility,
43+
llvm::GlobalValue::DefaultStorageClass,
44+
};
45+
4046
const IRLinkage IRLinkage::Internal = {
4147
llvm::GlobalValue::InternalLinkage,
4248
llvm::GlobalValue::DefaultVisibility,

0 commit comments

Comments
 (0)