summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrits van Bommel <fvbommel@gmail.com>2011-07-14 11:44:09 +0000
committerFrits van Bommel <fvbommel@gmail.com>2011-07-14 11:44:09 +0000
commit78ee70bbe71b5b91a10d420ed7140e637162ed3b (patch)
tree3c0a27d3f5add281ad1dcb36ca89e8f75afd54a0
parent771f29677f1a6669ff8aa9e698e4367a6a218785 (diff)
downloadbcm5719-llvm-78ee70bbe71b5b91a10d420ed7140e637162ed3b.tar.gz
bcm5719-llvm-78ee70bbe71b5b91a10d420ed7140e637162ed3b.zip
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.
llvm-svn: 135145
-rw-r--r--llvm/lib/VMCore/Core.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/llvm/lib/VMCore/Core.cpp b/llvm/lib/VMCore/Core.cpp
index da7ac42e033..51d12eb8f93 100644
--- a/llvm/lib/VMCore/Core.cpp
+++ b/llvm/lib/VMCore/Core.cpp
@@ -260,10 +260,7 @@ LLVMTypeRef LLVMX86MMXType(void) {
LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType,
LLVMTypeRef *ParamTypes, unsigned ParamCount,
LLVMBool IsVarArg) {
- std::vector<Type*> Tys;
- for (LLVMTypeRef *I = ParamTypes, *E = ParamTypes + ParamCount; I != E; ++I)
- Tys.push_back(unwrap(*I));
-
+ ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
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,
unsigned ElementCount, LLVMBool Packed) {
- std::vector<Type*> Tys;
- for (LLVMTypeRef *I = ElementTypes,
- *E = ElementTypes + ElementCount; I != E; ++I)
- Tys.push_back(unwrap(*I));
-
+ ArrayRef<Type*> Tys(unwrap(ElementTypes), ElementCount);
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,
unsigned ElementCount, LLVMBool Packed) {
- std::vector<Type*> Tys;
- for (LLVMTypeRef *I = ElementTypes,
- *E = ElementTypes + ElementCount; I != E; ++I)
- Tys.push_back(unwrap(*I));
+ ArrayRef<Type*> Tys(unwrap(ElementTypes), ElementCount);
unwrap<StructType>(StructTy)->setBody(Tys, Packed != 0);
}
OpenPOWER on IntegriCloud