From 14bbb1d9b083c7935185e7c11ddf059f352aa3fc Mon Sep 17 00:00:00 2001 From: Peter Zotov Date: Wed, 6 Nov 2013 09:21:01 +0000 Subject: [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 --- lib/IR/Core.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/IR') diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index 40db69b370..63cc2f6f06 100644 --- a/lib/IR/Core.cpp +++ b/lib/IR/Core.cpp @@ -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)); } -- cgit v1.2.3