mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
Simplify away some SmallVector copies. NFCI.
The lifetime of the initializer list is the full expression, so we can skip storing it in a temporary vector.
This commit is contained in:
parent
9b82c651ff
commit
9ae7d5aa56
@ -454,8 +454,7 @@ public:
|
||||
template <typename... Csts>
|
||||
static std::enable_if_t<are_base_of<Constant, Csts...>::value, Constant *>
|
||||
get(StructType *T, Csts *...Vs) {
|
||||
SmallVector<Constant *, 8> Values({Vs...});
|
||||
return get(T, Values);
|
||||
return get(T, ArrayRef<Constant *>({Vs...}));
|
||||
}
|
||||
|
||||
/// Return an anonymous struct that has the specified elements.
|
||||
|
@ -244,8 +244,7 @@ public:
|
||||
static std::enable_if_t<are_base_of<Type, Tys...>::value, StructType *>
|
||||
create(StringRef Name, Type *elt1, Tys *... elts) {
|
||||
assert(elt1 && "Cannot create a struct type with no elements with this");
|
||||
SmallVector<llvm::Type *, 8> StructFields({elt1, elts...});
|
||||
return create(StructFields, Name);
|
||||
return create(ArrayRef<Type *>({elt1, elts...}), Name);
|
||||
}
|
||||
|
||||
/// This static method is the primary way to create a literal StructType.
|
||||
@ -263,8 +262,7 @@ public:
|
||||
get(Type *elt1, Tys *... elts) {
|
||||
assert(elt1 && "Cannot create a struct type with no elements with this");
|
||||
LLVMContext &Ctx = elt1->getContext();
|
||||
SmallVector<llvm::Type *, 8> StructFields({elt1, elts...});
|
||||
return llvm::StructType::get(Ctx, StructFields);
|
||||
return StructType::get(Ctx, ArrayRef<Type *>({elt1, elts...}));
|
||||
}
|
||||
|
||||
/// Return the type with the specified name, or null if there is none by that
|
||||
@ -306,8 +304,7 @@ public:
|
||||
std::enable_if_t<are_base_of<Type, Tys...>::value, void>
|
||||
setBody(Type *elt1, Tys *... elts) {
|
||||
assert(elt1 && "Cannot create a struct type with no elements with this");
|
||||
SmallVector<llvm::Type *, 8> StructFields({elt1, elts...});
|
||||
setBody(StructFields);
|
||||
setBody(ArrayRef<Type *>({elt1, elts...}));
|
||||
}
|
||||
|
||||
/// Return true if the specified type is valid as a element type.
|
||||
|
Loading…
x
Reference in New Issue
Block a user