From b209206d2cefc3b57a763be45e423c3c356e0d49 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Wed, 21 Jun 2017 22:19:17 +0000 Subject: [PATCH] Mark dump() methods as const. NFC Add const qualifier to any dump() method where adding one was trivial. Differential Revision: https://reviews.llvm.org/D34481 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305963 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/DIE.h | 6 +++--- include/llvm/CodeGen/LexicalScopes.h | 2 +- include/llvm/CodeGen/MachineScheduler.h | 8 ++++---- include/llvm/MC/MCAssembler.h | 2 +- include/llvm/MC/MCFragment.h | 2 +- include/llvm/MC/MCSection.h | 2 +- include/llvm/Transforms/Scalar/GVN.h | 2 +- lib/CodeGen/AsmPrinter/DIE.cpp | 6 +++--- lib/CodeGen/LiveDebugVariables.cpp | 2 +- lib/CodeGen/LiveDebugVariables.h | 2 +- lib/CodeGen/MachineScheduler.cpp | 6 +++--- lib/MC/MCFragment.cpp | 8 ++++---- lib/MC/MCSection.cpp | 2 +- lib/Target/SystemZ/SystemZMachineScheduler.h | 2 +- lib/Transforms/Scalar/GVN.cpp | 2 +- 15 files changed, 27 insertions(+), 27 deletions(-) diff --git a/include/llvm/CodeGen/DIE.h b/include/llvm/CodeGen/DIE.h index 5ed5faa2c41..f809fc97fe5 100644 --- a/include/llvm/CodeGen/DIE.h +++ b/include/llvm/CodeGen/DIE.h @@ -121,8 +121,8 @@ public: /// Print the abbreviation using the specified asm printer. void Emit(const AsmPrinter *AP) const; - void print(raw_ostream &O); - void dump(); + void print(raw_ostream &O) const; + void dump() const; }; //===--------------------------------------------------------------------===// @@ -780,7 +780,7 @@ public: DIEValue findAttribute(dwarf::Attribute Attribute) const; void print(raw_ostream &O, unsigned IndentCount = 0) const; - void dump(); + void dump() const; }; //===--------------------------------------------------------------------===// diff --git a/include/llvm/CodeGen/LexicalScopes.h b/include/llvm/CodeGen/LexicalScopes.h index 79fa12ec2fb..3ba50348782 100644 --- a/include/llvm/CodeGen/LexicalScopes.h +++ b/include/llvm/CodeGen/LexicalScopes.h @@ -196,7 +196,7 @@ public: } /// dump - Print data structures to dbgs(). - void dump(); + void dump() const; /// getOrCreateAbstractScope - Find or create an abstract lexical scope. LexicalScope *getOrCreateAbstractScope(const DILocalScope *Scope); diff --git a/include/llvm/CodeGen/MachineScheduler.h b/include/llvm/CodeGen/MachineScheduler.h index 3b02ec400ab..34cbffa7820 100644 --- a/include/llvm/CodeGen/MachineScheduler.h +++ b/include/llvm/CodeGen/MachineScheduler.h @@ -203,7 +203,7 @@ public: MachineBasicBlock::iterator End, unsigned NumRegionInstrs) {} - virtual void dumpPolicy() {} + virtual void dumpPolicy() const {} /// Check if pressure tracking is needed before building the DAG and /// initializing this strategy. Called after initPolicy. @@ -555,7 +555,7 @@ public: return Queue.begin() + idx; } - void dump(); + void dump() const; }; /// Summarize the unscheduled region. @@ -756,7 +756,7 @@ public: SUnit *pickOnlyChoice(); #ifndef NDEBUG - void dumpScheduledState(); + void dumpScheduledState() const; #endif }; @@ -890,7 +890,7 @@ public: MachineBasicBlock::iterator End, unsigned NumRegionInstrs) override; - void dumpPolicy() override; + void dumpPolicy() const override; bool shouldTrackPressure() const override { return RegionPolicy.ShouldTrackPressure; diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h index 63f7057a707..a7e37817db1 100644 --- a/include/llvm/MC/MCAssembler.h +++ b/include/llvm/MC/MCAssembler.h @@ -413,7 +413,7 @@ public: /// @} - void dump(); + void dump() const; }; /// \brief Compute the amount of padding required before the fragment \p F to diff --git a/include/llvm/MC/MCFragment.h b/include/llvm/MC/MCFragment.h index 0aca922e3cf..284ca50e19d 100644 --- a/include/llvm/MC/MCFragment.h +++ b/include/llvm/MC/MCFragment.h @@ -130,7 +130,7 @@ public: /// \brief Return true if given frgment has FT_Dummy type. bool isDummy() const { return Kind == FT_Dummy; } - void dump(); + void dump() const; }; class MCDummyFragment : public MCFragment { diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h index cc306d47250..2771b1e67ea 100644 --- a/include/llvm/MC/MCSection.h +++ b/include/llvm/MC/MCSection.h @@ -167,7 +167,7 @@ public: MCSection::iterator getSubsectionInsertionPoint(unsigned Subsection); - void dump(); + void dump() const; virtual void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, diff --git a/include/llvm/Transforms/Scalar/GVN.h b/include/llvm/Transforms/Scalar/GVN.h index 589aaaca02f..f25ab40640d 100644 --- a/include/llvm/Transforms/Scalar/GVN.h +++ b/include/llvm/Transforms/Scalar/GVN.h @@ -209,7 +209,7 @@ private: // Other helper routines bool processInstruction(Instruction *I); bool processBlock(BasicBlock *BB); - void dump(DenseMap &d); + void dump(DenseMap &d) const; bool iterateOnFunction(Function &F); bool performPRE(Function &F); bool performScalarPRE(Instruction *I); diff --git a/lib/CodeGen/AsmPrinter/DIE.cpp b/lib/CodeGen/AsmPrinter/DIE.cpp index 30bfd7c94e6..886e6e264b3 100644 --- a/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/lib/CodeGen/AsmPrinter/DIE.cpp @@ -105,7 +105,7 @@ void DIEAbbrev::Emit(const AsmPrinter *AP) const { } LLVM_DUMP_METHOD -void DIEAbbrev::print(raw_ostream &O) { +void DIEAbbrev::print(raw_ostream &O) const { O << "Abbreviation @" << format("0x%lx", (long)(intptr_t)this) << " " @@ -128,7 +128,7 @@ void DIEAbbrev::print(raw_ostream &O) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -LLVM_DUMP_METHOD void DIEAbbrev::dump() { +LLVM_DUMP_METHOD void DIEAbbrev::dump() const { print(dbgs()); } #endif @@ -268,7 +268,7 @@ void DIE::print(raw_ostream &O, unsigned IndentCount) const { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -LLVM_DUMP_METHOD void DIE::dump() { +LLVM_DUMP_METHOD void DIE::dump() const { print(dbgs()); } #endif diff --git a/lib/CodeGen/LiveDebugVariables.cpp b/lib/CodeGen/LiveDebugVariables.cpp index bbd783367c9..0c76478af55 100644 --- a/lib/CodeGen/LiveDebugVariables.cpp +++ b/lib/CodeGen/LiveDebugVariables.cpp @@ -1006,7 +1006,7 @@ bool LiveDebugVariables::doInitialization(Module &M) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -LLVM_DUMP_METHOD void LiveDebugVariables::dump() { +LLVM_DUMP_METHOD void LiveDebugVariables::dump() const { if (pImpl) static_cast(pImpl)->print(dbgs()); } diff --git a/lib/CodeGen/LiveDebugVariables.h b/lib/CodeGen/LiveDebugVariables.h index afe87a52544..1d7e3d4371a 100644 --- a/lib/CodeGen/LiveDebugVariables.h +++ b/lib/CodeGen/LiveDebugVariables.h @@ -59,7 +59,7 @@ public: void emitDebugValues(VirtRegMap *VRM); /// dump - Print data structures to dbgs(). - void dump(); + void dump() const; private: diff --git a/lib/CodeGen/MachineScheduler.cpp b/lib/CodeGen/MachineScheduler.cpp index 7a6e7546a0d..eaba9a58557 100644 --- a/lib/CodeGen/MachineScheduler.cpp +++ b/lib/CodeGen/MachineScheduler.cpp @@ -542,7 +542,7 @@ void MachineSchedulerBase::print(raw_ostream &O, const Module* m) const { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -LLVM_DUMP_METHOD void ReadyQueue::dump() { +LLVM_DUMP_METHOD void ReadyQueue::dump() const { dbgs() << "Queue " << Name << ": "; for (const SUnit *SU : Queue) dbgs() << SU->NodeNum << " "; @@ -2309,7 +2309,7 @@ SUnit *SchedBoundary::pickOnlyChoice() { #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) // This is useful information to dump after bumpNode. // Note that the Queue contents are more useful before pickNodeFromQueue. -LLVM_DUMP_METHOD void SchedBoundary::dumpScheduledState() { +LLVM_DUMP_METHOD void SchedBoundary::dumpScheduledState() const { unsigned ResFactor; unsigned ResCount; if (ZoneCritResIdx) { @@ -2648,7 +2648,7 @@ void GenericScheduler::initPolicy(MachineBasicBlock::iterator Begin, } } -void GenericScheduler::dumpPolicy() { +void GenericScheduler::dumpPolicy() const { // Cannot completely remove virtual function even in release mode. #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) dbgs() << "GenericScheduler RegionPolicy: " diff --git a/lib/MC/MCFragment.cpp b/lib/MC/MCFragment.cpp index f3d0eb55eec..a7b505b68a0 100644 --- a/lib/MC/MCFragment.cpp +++ b/lib/MC/MCFragment.cpp @@ -307,7 +307,7 @@ raw_ostream &operator<<(raw_ostream &OS, const MCFixup &AF) { } // end namespace llvm #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -LLVM_DUMP_METHOD void MCFragment::dump() { +LLVM_DUMP_METHOD void MCFragment::dump() const { raw_ostream &OS = errs(); OS << "<"; @@ -445,19 +445,19 @@ LLVM_DUMP_METHOD void MCFragment::dump() { OS << ">"; } -LLVM_DUMP_METHOD void MCAssembler::dump() { +LLVM_DUMP_METHOD void MCAssembler::dump() const{ raw_ostream &OS = errs(); OS << "dump(); } OS << "],\n"; OS << " Symbols:["; - for (symbol_iterator it = symbol_begin(), ie = symbol_end(); it != ie; ++it) { + for (const_symbol_iterator it = symbol_begin(), ie = symbol_end(); it != ie; ++it) { if (it != symbol_begin()) OS << ",\n "; OS << "("; it->dump(); diff --git a/lib/MC/MCSection.cpp b/lib/MC/MCSection.cpp index b961cb3968e..d141dd6627c 100644 --- a/lib/MC/MCSection.cpp +++ b/lib/MC/MCSection.cpp @@ -86,7 +86,7 @@ MCSection::getSubsectionInsertionPoint(unsigned Subsection) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -LLVM_DUMP_METHOD void MCSection::dump() { +LLVM_DUMP_METHOD void MCSection::dump() const { raw_ostream &OS = errs(); OS << " { #ifndef NDEBUG - void dump(SystemZHazardRecognizer &HazardRec); + void dump(SystemZHazardRecognizer &HazardRec) const; #endif }; diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 0490d93f645..f1d7efb14b9 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -602,7 +602,7 @@ PreservedAnalyses GVN::run(Function &F, FunctionAnalysisManager &AM) { } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -LLVM_DUMP_METHOD void GVN::dump(DenseMap& d) { +LLVM_DUMP_METHOD void GVN::dump(DenseMap& d) const { errs() << "{\n"; for (DenseMap::iterator I = d.begin(), E = d.end(); I != E; ++I) { -- 2.50.1