]> granicus.if.org Git - llvm/commitdiff
llvm-c: Keep LLVMDumpModule() even in release builds
authorMatthias Braun <matze@braunis.de>
Sun, 29 Jan 2017 17:52:03 +0000 (17:52 +0000)
committerMatthias Braun <matze@braunis.de>
Sun, 29 Jan 2017 17:52:03 +0000 (17:52 +0000)
While this probably should be considered a dump debugger utility, the C
API currently has no other ways to print a module to stderr for error
reporting purposes, so keep it even in release builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293436 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/Core.cpp

index 07e67be63dfc203f402bfa6fcb7e7125eebc7953..9ea1a90b00b6b4d380daaa3e584738bd5e46942a 100644 (file)
@@ -258,11 +258,10 @@ void LLVMSetTarget(LLVMModuleRef M, const char *Triple) {
   unwrap(M)->setTargetTriple(Triple);
 }
 
-#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void LLVMDumpModule(LLVMModuleRef M) {
-  unwrap(M)->dump();
+void LLVMDumpModule(LLVMModuleRef M) {
+  unwrap(M)->print(errs(), nullptr,
+                   /*ShouldPreserveUseListOrder=*/false, /*IsForDebug=*/true);
 }
-#endif
 
 LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename,
                                char **ErrorMessage) {