summaryrefslogtreecommitdiff
path: root/lib/IR
diff options
context:
space:
mode:
authorPeter Zotov <whitequark@whitequark.org>2013-11-06 09:21:01 +0000
committerPeter Zotov <whitequark@whitequark.org>2013-11-06 09:21:01 +0000
commit14bbb1d9b083c7935185e7c11ddf059f352aa3fc (patch)
tree1d21b2b46322845d1ad2a51d30102d9b806197aa /lib/IR
parent7851bc1871dcb7c31b603b17cf975ae0b55f4c30 (diff)
downloadllvm-14bbb1d9b083c7935185e7c11ddf059f352aa3fc.tar.gz
llvm-14bbb1d9b083c7935185e7c11ddf059f352aa3fc.tar.bz2
llvm-14bbb1d9b083c7935185e7c11ddf059f352aa3fc.tar.xz
[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
Diffstat (limited to 'lib/IR')
-rw-r--r--lib/IR/Core.cpp10
1 files changed, 10 insertions, 0 deletions
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));
}