summaryrefslogtreecommitdiff
path: root/lib/IR/Core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/IR/Core.cpp')
-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 95c516a251..cf1c1df0ed 100644
--- a/lib/IR/Core.cpp
+++ b/lib/IR/Core.cpp
@@ -147,6 +147,16 @@ LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename,
return false;
}
+char *LLVMPrintModuleToString(LLVMModuleRef M) {
+ std::string buf;
+ raw_string_ostream os(buf);
+
+ unwrap(M)->print(os, NULL);
+ os.flush();
+
+ return strdup(buf.c_str());
+}
+
/*--.. Operations on inline assembler ......................................--*/
void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm) {
unwrap(M)->setModuleInlineAsm(StringRef(Asm));