Update StructType to LLVM 3.x (incomplete).

Bring back StructType.elements.
This commit is contained in:
Siu Kwan Lam 2012-07-22 00:00:04 -07:00
commit b71d22b570
6 changed files with 444 additions and 300 deletions

View file

@ -90,6 +90,25 @@ char *do_print(W obj)
return strdup(buf.str().c_str());
}
LLVMTypeRef LLVMStructTypeIdentified(const char * name)
{
using namespace llvm;
return wrap(StructType::create(getGlobalContext(), name));
}
void LLVMSetStructBody(LLVMTypeRef type, LLVMTypeRef* elemtys, unsigned elemct, int is_packed)
{
using namespace llvm;
ArrayRef<Type*> elemtys_aryref(unwrap(elemtys), elemct);
unwrap<StructType>(type)->setBody(elemtys_aryref, is_packed);
}
void LLVMSetStructName(LLVMTypeRef type, const char * name)
{
llvm::StructType *st = llvm::unwrap<llvm::StructType>(type);
st->setName(name);
}
char *LLVMGetModuleIdentifier(LLVMModuleRef module)
{
return strdup(llvm::unwrap(module)->getModuleIdentifier().c_str());