mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-17 06:33:21 +00:00
Simplify some functions in the C API by using an ArrayRef to directly reference the array passed to them instead of copying it to a std::vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135145 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d0f3ef807e
commit
d155945f15
@ -260,10 +260,7 @@ LLVMTypeRef LLVMX86MMXType(void) {
|
|||||||
LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType,
|
LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType,
|
||||||
LLVMTypeRef *ParamTypes, unsigned ParamCount,
|
LLVMTypeRef *ParamTypes, unsigned ParamCount,
|
||||||
LLVMBool IsVarArg) {
|
LLVMBool IsVarArg) {
|
||||||
std::vector<Type*> Tys;
|
ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
|
||||||
for (LLVMTypeRef *I = ParamTypes, *E = ParamTypes + ParamCount; I != E; ++I)
|
|
||||||
Tys.push_back(unwrap(*I));
|
|
||||||
|
|
||||||
return wrap(FunctionType::get(unwrap(ReturnType), Tys, IsVarArg != 0));
|
return wrap(FunctionType::get(unwrap(ReturnType), Tys, IsVarArg != 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,11 +287,7 @@ void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest) {
|
|||||||
|
|
||||||
LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes,
|
LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes,
|
||||||
unsigned ElementCount, LLVMBool Packed) {
|
unsigned ElementCount, LLVMBool Packed) {
|
||||||
std::vector<Type*> Tys;
|
ArrayRef<Type*> Tys(unwrap(ElementTypes), ElementCount);
|
||||||
for (LLVMTypeRef *I = ElementTypes,
|
|
||||||
*E = ElementTypes + ElementCount; I != E; ++I)
|
|
||||||
Tys.push_back(unwrap(*I));
|
|
||||||
|
|
||||||
return wrap(StructType::get(*unwrap(C), Tys, Packed != 0));
|
return wrap(StructType::get(*unwrap(C), Tys, Packed != 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,10 +304,7 @@ LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name)
|
|||||||
|
|
||||||
void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
|
void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
|
||||||
unsigned ElementCount, LLVMBool Packed) {
|
unsigned ElementCount, LLVMBool Packed) {
|
||||||
std::vector<Type*> Tys;
|
ArrayRef<Type*> Tys(unwrap(ElementTypes), ElementCount);
|
||||||
for (LLVMTypeRef *I = ElementTypes,
|
|
||||||
*E = ElementTypes + ElementCount; I != E; ++I)
|
|
||||||
Tys.push_back(unwrap(*I));
|
|
||||||
unwrap<StructType>(StructTy)->setBody(Tys, Packed != 0);
|
unwrap<StructType>(StructTy)->setBody(Tys, Packed != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user