mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 21:32:10 +00:00
[llvm-c] Implement LLVMPrintValueToString
Original patch by Chris Wailes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194135 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7851bc1871
commit
14bbb1d9b0
@ -1211,6 +1211,14 @@ void LLVMSetValueName(LLVMValueRef Val, const char *Name);
|
||||
*/
|
||||
void LLVMDumpValue(LLVMValueRef Val);
|
||||
|
||||
/**
|
||||
* Return a string representation of the value. Use
|
||||
* LLVMDisposeMessage to free the string.
|
||||
*
|
||||
* @see llvm::Value::print()
|
||||
*/
|
||||
char *LLVMPrintValueToString(LLVMValueRef Val);
|
||||
|
||||
/**
|
||||
* Replace all uses of a value with another one.
|
||||
*
|
||||
|
@ -474,6 +474,16 @@ void LLVMDumpValue(LLVMValueRef Val) {
|
||||
unwrap(Val)->dump();
|
||||
}
|
||||
|
||||
char* LLVMPrintValueToString(LLVMValueRef Val) {
|
||||
std::string buf;
|
||||
raw_string_ostream os(buf);
|
||||
|
||||
unwrap(Val)->print(os);
|
||||
os.flush();
|
||||
|
||||
return strdup(buf.c_str());
|
||||
}
|
||||
|
||||
void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal) {
|
||||
unwrap(OldVal)->replaceAllUsesWith(unwrap(NewVal));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user