[llvm] r293436 - llvm-c: Keep LLVMDumpModule() even in release builds

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 29 09:52:03 PST 2017


Author: matze
Date: Sun Jan 29 11:52:03 2017
New Revision: 293436

URL: http://llvm.org/viewvc/llvm-project?rev=293436&view=rev
Log:
llvm-c: Keep LLVMDumpModule() even in release builds

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.

Modified:
    llvm/trunk/lib/IR/Core.cpp

Modified: llvm/trunk/lib/IR/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=293436&r1=293435&r2=293436&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Core.cpp (original)
+++ llvm/trunk/lib/IR/Core.cpp Sun Jan 29 11:52:03 2017
@@ -258,11 +258,10 @@ void LLVMSetTarget(LLVMModuleRef M, cons
   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) {




More information about the llvm-commits mailing list