[PATCH] C API: implement LLVMDumpType

Peter Zotov whitequark at whitequark.org
Sat Oct 12 08:53:55 PDT 2013


The C API currently allows to dump values (LLVMDumpValue), but a similar method for types was not exported.

http://llvm-reviews.chandlerc.com/D1911

Files:
  include/llvm-c/Core.h
  lib/IR/Core.cpp

Index: include/llvm-c/Core.h
===================================================================
--- include/llvm-c/Core.h
+++ include/llvm-c/Core.h
@@ -692,6 +692,13 @@
 LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty);
 
 /**
+ * Dump a representation of a type to stderr.
+ *
+ * @see llvm::Type::dump()
+ */
+void LLVMDumpType(LLVMTypeRef Val);
+
+/**
  * @defgroup LLVMCCoreTypeInt Integer Types
  *
  * Functions in this section operate on integer types.
Index: lib/IR/Core.cpp
===================================================================
--- lib/IR/Core.cpp
+++ lib/IR/Core.cpp
@@ -210,6 +210,10 @@
   return wrap(&unwrap(Ty)->getContext());
 }
 
+void LLVMDumpType(LLVMTypeRef Ty) {
+  return unwrap(Ty)->dump();
+}
+
 /*--.. Operations on integer types .........................................--*/
 
 LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C)  {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1911.1.patch
Type: text/x-patch
Size: 874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131012/11bc51e9/attachment.bin>


More information about the llvm-commits mailing list