[llvm] eac0261 - [Linker] Remove a use of StructType::setBody. NFC. (#116653)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 18 12:11:30 PST 2024
Author: Jay Foad
Date: 2024-11-18T20:11:27Z
New Revision: eac02611048a81bd78e461b651158c3c6557cb74
URL: https://github.com/llvm/llvm-project/commit/eac02611048a81bd78e461b651158c3c6557cb74
DIFF: https://github.com/llvm/llvm-project/commit/eac02611048a81bd78e461b651158c3c6557cb74.diff
LOG: [Linker] Remove a use of StructType::setBody. NFC. (#116653)
This falls out naturally after inlining finishType into its only
remaining use.
Added:
Modified:
llvm/lib/Linker/IRMover.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index c653900c632cc9..4bb0ddf891744b 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -82,8 +82,6 @@ class TypeMapTy : public ValueMapTypeRemapper {
Type *get(Type *SrcTy);
Type *get(Type *SrcTy, SmallPtrSet<StructType *, 8> &Visited);
- void finishType(StructType *DTy, StructType *STy, ArrayRef<Type *> ETypes);
-
FunctionType *get(FunctionType *T) {
return cast<FunctionType>(get((Type *)T));
}
@@ -233,20 +231,6 @@ Error TypeMapTy::linkDefinedTypeBodies() {
return Error::success();
}
-void TypeMapTy::finishType(StructType *DTy, StructType *STy,
- ArrayRef<Type *> ETypes) {
- DTy->setBody(ETypes, STy->isPacked());
-
- // Steal STy's name.
- if (STy->hasName()) {
- SmallString<16> TmpName = STy->getName();
- STy->setName("");
- DTy->setName(TmpName);
- }
-
- DstStructTypesSet.addNonOpaque(DTy);
-}
-
Type *TypeMapTy::get(Type *Ty) {
SmallPtrSet<StructType *, 8> Visited;
return get(Ty, Visited);
@@ -342,8 +326,17 @@ Type *TypeMapTy::get(Type *Ty, SmallPtrSet<StructType *, 8> &Visited) {
return *Entry = Ty;
}
- StructType *DTy = StructType::create(Ty->getContext());
- finishType(DTy, STy, ElementTypes);
+ StructType *DTy =
+ StructType::create(Ty->getContext(), ElementTypes, "", STy->isPacked());
+
+ // Steal STy's name.
+ if (STy->hasName()) {
+ SmallString<16> TmpName = STy->getName();
+ STy->setName("");
+ DTy->setName(TmpName);
+ }
+
+ DstStructTypesSet.addNonOpaque(DTy);
return *Entry = DTy;
}
}
More information about the llvm-commits
mailing list