Skip to content

Commit eac0261

Browse files
authored
[Linker] Remove a use of StructType::setBody. NFC. (#116653)
This falls out naturally after inlining finishType into its only remaining use.
1 parent 3d172f3 commit eac0261

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

llvm/lib/Linker/IRMover.cpp

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ class TypeMapTy : public ValueMapTypeRemapper {
8282
Type *get(Type *SrcTy);
8383
Type *get(Type *SrcTy, SmallPtrSet<StructType *, 8> &Visited);
8484

85-
void finishType(StructType *DTy, StructType *STy, ArrayRef<Type *> ETypes);
86-
8785
FunctionType *get(FunctionType *T) {
8886
return cast<FunctionType>(get((Type *)T));
8987
}
@@ -233,20 +231,6 @@ Error TypeMapTy::linkDefinedTypeBodies() {
233231
return Error::success();
234232
}
235233

236-
void TypeMapTy::finishType(StructType *DTy, StructType *STy,
237-
ArrayRef<Type *> ETypes) {
238-
DTy->setBody(ETypes, STy->isPacked());
239-
240-
// Steal STy's name.
241-
if (STy->hasName()) {
242-
SmallString<16> TmpName = STy->getName();
243-
STy->setName("");
244-
DTy->setName(TmpName);
245-
}
246-
247-
DstStructTypesSet.addNonOpaque(DTy);
248-
}
249-
250234
Type *TypeMapTy::get(Type *Ty) {
251235
SmallPtrSet<StructType *, 8> Visited;
252236
return get(Ty, Visited);
@@ -342,8 +326,17 @@ Type *TypeMapTy::get(Type *Ty, SmallPtrSet<StructType *, 8> &Visited) {
342326
return *Entry = Ty;
343327
}
344328

345-
StructType *DTy = StructType::create(Ty->getContext());
346-
finishType(DTy, STy, ElementTypes);
329+
StructType *DTy =
330+
StructType::create(Ty->getContext(), ElementTypes, "", STy->isPacked());
331+
332+
// Steal STy's name.
333+
if (STy->hasName()) {
334+
SmallString<16> TmpName = STy->getName();
335+
STy->setName("");
336+
DTy->setName(TmpName);
337+
}
338+
339+
DstStructTypesSet.addNonOpaque(DTy);
347340
return *Entry = DTy;
348341
}
349342
}

0 commit comments

Comments
 (0)