C/OCaml API to retrieve struct name.
[oota-llvm.git] / lib / VMCore / Core.cpp
index e2b659b6a2b78c802798c4f4258dc377abe354fa..8560de4455c0994eb1b56f1b58c3c25ed5a8f7b7 100644 (file)
@@ -302,6 +302,14 @@ LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name)
   return wrap(StructType::create(*unwrap(C), Name));
 }
 
+const char *LLVMGetStructName(LLVMTypeRef Ty)
+{
+    StructType *Type = unwrap<StructType>(Ty);
+    if (!Type->hasName())
+       return 0;
+    return Type->getName().data();
+}
+
 void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
                        unsigned ElementCount, LLVMBool Packed) {
   ArrayRef<Type*> Tys(unwrap(ElementTypes), ElementCount);