From 784ad24bad4764ba99b68f6eaf7eda83be6c97ce Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 14 Jul 2011 19:09:08 +0000 Subject: Add LLVMConstNamedStruct to the C api to let its users create constants of named struct types. llvm-svn: 135178 --- llvm/lib/VMCore/Core.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/lib/VMCore/Core.cpp') diff --git a/llvm/lib/VMCore/Core.cpp b/llvm/lib/VMCore/Core.cpp index b59f6c78c52..f5bec303a4e 100644 --- a/llvm/lib/VMCore/Core.cpp +++ b/llvm/lib/VMCore/Core.cpp @@ -595,6 +595,16 @@ LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count, return LLVMConstStructInContext(LLVMGetGlobalContext(), ConstantVals, Count, Packed); } + +LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy, + LLVMValueRef *ConstantVals, + unsigned Count) { + Constant **Elements = unwrap(ConstantVals, Count); + const StructType *Ty = cast(unwrap(StructTy)); + + return wrap(ConstantStruct::get(Ty, ArrayRef(Elements, Count))); +} + LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size) { return wrap(ConstantVector::get(ArrayRef( unwrap(ScalarConstantVals, Size), Size))); -- cgit v1.2.3