]> granicus.if.org Git - llvm/commitdiff
Hide dbgs() stream for when built with -fmodules.
authorFrederich Munch <colsebas@hotmail.com>
Wed, 14 Jun 2017 19:16:22 +0000 (19:16 +0000)
committerFrederich Munch <colsebas@hotmail.com>
Wed, 14 Jun 2017 19:16:22 +0000 (19:16 +0000)
Summary: Make DebugCounter::print and dump methods to be const correct.

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D34214

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

include/llvm/Support/DebugCounter.h
include/llvm/Transforms/Scalar/GVNExpression.h
lib/Support/DebugCounter.cpp
lib/Transforms/Scalar/GVNSink.cpp

index 9687cb7b9d95fa835b55e7a0c9991f04e94e4695..a533feae7fa38e1a1d98345520374b5b57654d23 100644 (file)
@@ -121,10 +121,10 @@ public:
     Us.Counters[ID] = Val;
   }
 
-  // Dump or print the current counter set.
-  LLVM_DUMP_METHOD void dump() { print(dbgs()); }
+  // Dump or print the current counter set into llvm::dbgs().
+  LLVM_DUMP_METHOD void dump() const;
 
-  void print(raw_ostream &OS);
+  void print(raw_ostream &OS) const;
 
   // Get the counter ID for a given named counter, or return 0 if none is found.
   unsigned getCounterId(const std::string &Name) const {
index 0083413049959e00ef5330e8cdf55d150b7ac068..f603ebcbca7cc924ab9f9692e763e22bdfd8370f 100644 (file)
@@ -121,10 +121,7 @@ public:
     OS << "}";
   }
 
-  LLVM_DUMP_METHOD void dump() const {
-    print(dbgs());
-    dbgs() << "\n";
-  }
+  LLVM_DUMP_METHOD void dump() const;
 };
 
 inline raw_ostream &operator<<(raw_ostream &OS, const Expression &E) {
index a10ac8e853966cab99101c742a79970b0f07cf13..1d46de04ee6aff60dea3658110ec0edf9afa575f 100644 (file)
@@ -102,9 +102,13 @@ void DebugCounter::push_back(const std::string &Val) {
   }
 }
 
-void DebugCounter::print(raw_ostream &OS) {
+void DebugCounter::print(raw_ostream &OS) const {
   OS << "Counters and values:\n";
   for (const auto &KV : Counters)
     OS << left_justify(RegisteredCounters[KV.first], 32) << ": {"
        << KV.second.first << "," << KV.second.second << "}\n";
 }
+
+LLVM_DUMP_METHOD void DebugCounter::dump() const {
+  print(dbgs());
+}
index 8634816e702fbcedbf5e0d8f23605b91f9265403..5fd2dfc118b4b44d72ee2cefd092d3468efba16e 100644 (file)
@@ -64,6 +64,17 @@ using namespace llvm;
 
 STATISTIC(NumRemoved, "Number of instructions removed");
 
+namespace llvm {
+namespace GVNExpression {
+
+LLVM_DUMP_METHOD void Expression::dump() const {
+  print(dbgs());
+  dbgs() << "\n";
+}
+
+}
+}
+
 namespace {
 
 static bool isMemoryInst(const Instruction *I) {