Expose getTypeName to the C API. Patch by Patrick Walton.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 18 Feb 2011 16:35:37 +0000 (16:35 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 18 Feb 2011 16:35:37 +0000 (16:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125845 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm-c/Core.h
lib/VMCore/Core.cpp

index d8a491d82be4c242b7f7e84876ad00458b529fec..39c3cb40117c1554ed7aae7f01137cd52fe658a4 100644 (file)
@@ -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);
index 5fd37351e2db2534c8092a180322ba56e56f5211..35c3a2e9258775cbd1738ac1e763ddcff9e9effc 100644 (file)
@@ -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();
 }