[llvm] r305408 - Hide dbgs() stream for when built with -fmodules.

Frederich Munch via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 12:16:22 PDT 2017


Author: marsupial
Date: Wed Jun 14 14:16:22 2017
New Revision: 305408

URL: http://llvm.org/viewvc/llvm-project?rev=305408&view=rev
Log:
Hide dbgs() stream for when built with -fmodules.

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

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

Modified: llvm/trunk/include/llvm/Support/DebugCounter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DebugCounter.h?rev=305408&r1=305407&r2=305408&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/DebugCounter.h (original)
+++ llvm/trunk/include/llvm/Support/DebugCounter.h Wed Jun 14 14:16:22 2017
@@ -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 {

Modified: llvm/trunk/include/llvm/Transforms/Scalar/GVNExpression.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/GVNExpression.h?rev=305408&r1=305407&r2=305408&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/GVNExpression.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/GVNExpression.h Wed Jun 14 14:16:22 2017
@@ -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) {

Modified: llvm/trunk/lib/Support/DebugCounter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/DebugCounter.cpp?rev=305408&r1=305407&r2=305408&view=diff
==============================================================================
--- llvm/trunk/lib/Support/DebugCounter.cpp (original)
+++ llvm/trunk/lib/Support/DebugCounter.cpp Wed Jun 14 14:16:22 2017
@@ -102,9 +102,13 @@ void DebugCounter::push_back(const std::
   }
 }
 
-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());
+}

Modified: llvm/trunk/lib/Transforms/Scalar/GVNSink.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVNSink.cpp?rev=305408&r1=305407&r2=305408&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVNSink.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVNSink.cpp Wed Jun 14 14:16:22 2017
@@ -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) {




More information about the llvm-commits mailing list