forked from OSchip/llvm-project
llvm-c: Add LLVMPrintTypeToString
Differential Revision: http://llvm-reviews.chandlerc.com/D1963 llvm-svn: 193149
This commit is contained in:
parent
3461bedbfd
commit
47b3bd3fbb
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue