summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-07-14 05:53:17 +0000
committerChris Lattner <sabre@nondot.org>2011-07-14 05:53:17 +0000
commite71ccde2498bd7f51107d2a9d37e3ca44a5061d3 (patch)
treedcbf170e4cdb20620ff5670ccfb019ac02e1856b
parentc7ac690ba2e4b10d9beb775a5cb859490a859dd1 (diff)
downloadbcm5719-llvm-e71ccde2498bd7f51107d2a9d37e3ca44a5061d3.tar.gz
bcm5719-llvm-e71ccde2498bd7f51107d2a9d37e3ca44a5061d3.zip
add C api for hte new type system rewrite API. Patch by Vitaly Lugovskiy!
llvm-svn: 135132
-rw-r--r--llvm/include/llvm-c/Core.h5
-rw-r--r--llvm/lib/VMCore/Core.cpp13
2 files changed, 17 insertions, 1 deletions
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index e7818c1e7a7..e3dce581eec 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -387,6 +387,10 @@ LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes,
unsigned ElementCount, LLVMBool Packed);
LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount,
LLVMBool Packed);
+LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name);
+void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
+ unsigned ElementCount, LLVMBool Packed);
+
unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy);
void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest);
LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy);
@@ -408,7 +412,6 @@ LLVMTypeRef LLVMX86MMXTypeInContext(LLVMContextRef C);
LLVMTypeRef LLVMVoidType(void);
LLVMTypeRef LLVMLabelType(void);
-LLVMTypeRef LLVMOpaqueType(void);
LLVMTypeRef LLVMX86MMXType(void);
/*===-- Values ------------------------------------------------------------===*/
diff --git a/llvm/lib/VMCore/Core.cpp b/llvm/lib/VMCore/Core.cpp
index 1df74de36b4..da7ac42e033 100644
--- a/llvm/lib/VMCore/Core.cpp
+++ b/llvm/lib/VMCore/Core.cpp
@@ -304,6 +304,19 @@ LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes,
ElementCount, Packed);
}
+LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name)
+{
+ return wrap(StructType::createNamed(*unwrap(C), 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));
+ unwrap<StructType>(StructTy)->setBody(Tys, Packed != 0);
+}
unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy) {
return unwrap<StructType>(StructTy)->getNumElements();
OpenPOWER on IntegriCloud