[PATCH] [llvm-c] Add LLVMPrintModule.

Hans Wennborg hans at chromium.org
Tue Oct 15 16:54:36 PDT 2013





================
Comment at: lib/IR/Core.cpp:156
@@ +155,3 @@
+
+  p->print(os, NULL);
+
----------------
I would probably have gone for "m" instead of "p" :) Or maybe just unwrap(M)->print(...)

Maybe it would be a good idea to do os.flush(), or use "os.str()" below instead of "buf".

================
Comment at: lib/IR/Core.cpp:150
@@ -149,1 +149,3 @@
 
+char *LLVMPrintModule(LLVMModuleRef M) {
+  Module *p = unwrap(M);
----------------
I'm a little bit concerned about the function name. When I see "PrintModule" I don't immediately think of something that returns a string.

How about LLVMPrintModuleToString or LLVMGetModuleAsString, or maybe LLVMDumpModuleToString?


http://llvm-reviews.chandlerc.com/D1941



More information about the llvm-commits mailing list