From c44943ed4f4f2d44b6668e6b51eb355f8310660c Mon Sep 17 00:00:00 2001 From: Torok Edwin Date: Thu, 6 Oct 2011 12:12:50 +0000 Subject: C/OCaml API to retrieve struct name. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141285 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Core.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/VMCore/Core.cpp') diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp index e2b659b6a2..8560de4455 100644 --- a/lib/VMCore/Core.cpp +++ b/lib/VMCore/Core.cpp @@ -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(Ty); + if (!Type->hasName()) + return 0; + return Type->getName().data(); +} + void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed) { ArrayRef Tys(unwrap(ElementTypes), ElementCount); -- cgit v1.2.3-18-g5258