From 1e09e5b979249ae08082569cbf0ab24d297ee0dd Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 18 Feb 2011 16:35:37 +0000 Subject: [PATCH] Expose getTypeName to the C API. Patch by Patrick Walton. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125845 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm-c/Core.h | 1 + lib/VMCore/Core.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index d8a491d82be..39c3cb40117 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -322,6 +322,7 @@ void LLVMSetTarget(LLVMModuleRef M, const char *Triple); LLVMBool LLVMAddTypeName(LLVMModuleRef M, const char *Name, LLVMTypeRef Ty); void LLVMDeleteTypeName(LLVMModuleRef M, const char *Name); LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name); +const char *LLVMGetTypeName(LLVMModuleRef M, LLVMTypeRef Ty); /** See Module::dump. */ void LLVMDumpModule(LLVMModuleRef M); diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp index 5fd37351e2d..35c3a2e9258 100644 --- a/lib/VMCore/Core.cpp +++ b/lib/VMCore/Core.cpp @@ -128,6 +128,10 @@ LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name) { return wrap(unwrap(M)->getTypeByName(Name)); } +const char *LLVMGetTypeName(LLVMModuleRef M, LLVMTypeRef Ty) { + return unwrap(M)->getTypeName(unwrap(Ty)).c_str(); +} + void LLVMDumpModule(LLVMModuleRef M) { unwrap(M)->dump(); }