[PATCH] D34214: Hide dbgs() stream for when built with -fmodules.

Frederich Munch via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 11:09:39 PDT 2017


marsupial created this revision.

Also makes using these functions a compile time error rather than link error if not build in Debug mode.


https://reviews.llvm.org/D34214

Files:
  include/llvm/Support/DebugCounter.h
  include/llvm/Transforms/Scalar/GVNExpression.h


Index: include/llvm/Transforms/Scalar/GVNExpression.h
===================================================================
--- include/llvm/Transforms/Scalar/GVNExpression.h
+++ include/llvm/Transforms/Scalar/GVNExpression.h
@@ -121,10 +121,12 @@
     OS << "}";
   }
 
+#ifndef NDEBUG
   LLVM_DUMP_METHOD void dump() const {
     print(dbgs());
     dbgs() << "\n";
   }
+#endif
 };
 
 inline raw_ostream &operator<<(raw_ostream &OS, const Expression &E) {
Index: include/llvm/Support/DebugCounter.h
===================================================================
--- include/llvm/Support/DebugCounter.h
+++ include/llvm/Support/DebugCounter.h
@@ -121,8 +121,12 @@
     Us.Counters[ID] = Val;
   }
 
+#ifndef NDEBUG
   // Dump or print the current counter set.
-  LLVM_DUMP_METHOD void dump() { print(dbgs()); }
+  LLVM_DUMP_METHOD void dump() {
+    print(dbgs());
+  }
+#endif
 
   void print(raw_ostream &OS);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34214.102579.patch
Type: text/x-patch
Size: 919 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170614/4c38557d/attachment.bin>


More information about the llvm-commits mailing list