llvm-c: Add LLVMPrintTypeToString

Differential Revision: http://llvm-reviews.chandlerc.com/D1963



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193149 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anders Waldenborg 2013-10-22 06:58:34 +00:00
parent e877eebfe9
commit 18b9105d02
2 changed files with 18 additions and 0 deletions

View File

@ -722,6 +722,14 @@ LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty);
*/
void LLVMDumpType(LLVMTypeRef Val);
/**
* Return a string representation of the type. Use
* LLVMDisposeMessage to free the string.
*
* @see llvm::Type::print()
*/
char *LLVMPrintTypeToString(LLVMTypeRef Val);
/**
* @defgroup LLVMCCoreTypeInt Integer Types
*

View File

@ -224,6 +224,16 @@ void LLVMDumpType(LLVMTypeRef Ty) {
return unwrap(Ty)->dump();
}
char *LLVMPrintTypeToString(LLVMTypeRef Ty) {
std::string buf;
raw_string_ostream os(buf);
unwrap(Ty)->print(os);
os.flush();
return strdup(buf.c_str());
}
/*--.. Operations on integer types .........................................--*/
LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C) {