From f081ec20b502228c41c193994fa50f5f82b34e15 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 30 Jul 2022 10:35:51 -0700 Subject: [PATCH] [bolt] Remove redundaunt virtual specifiers (NFC) Identified with modernize-use-override. --- bolt/include/bolt/Core/DebugData.h | 38 +++++++++++++-------------- bolt/include/bolt/Core/JumpTable.h | 4 +-- bolt/include/bolt/Profile/DataReader.h | 12 ++++----- bolt/include/bolt/Profile/YAMLProfileReader.h | 4 +-- bolt/lib/Target/X86/X86MCPlusBuilder.cpp | 4 +-- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/bolt/include/bolt/Core/DebugData.h b/bolt/include/bolt/Core/DebugData.h index fad14c1..a937014 100644 --- a/bolt/include/bolt/Core/DebugData.h +++ b/bolt/include/bolt/Core/DebugData.h @@ -226,22 +226,22 @@ public: static void setAddressWriter(DebugAddrWriter *AddrW) { AddrWriter = AddrW; } /// Add ranges with caching. - virtual uint64_t addRanges( + uint64_t addRanges( DebugAddressRangesVector &&Ranges, std::map &CachedRanges) override; /// Add ranges and return offset into section. - virtual uint64_t addRanges(const DebugAddressRangesVector &Ranges) override; + uint64_t addRanges(const DebugAddressRangesVector &Ranges) override; - virtual std::unique_ptr releaseBuffer() override { + std::unique_ptr releaseBuffer() override { return std::move(RangesBuffer); } /// Needs to be invoked before each \p CU is processed. - void virtual initSection(DWARFUnit &CU) override; + void initSection(DWARFUnit &CU) override; /// Writes out range lists for a current CU being processed. - void virtual finalizeSection() override; + void finalizeSection() override; // Returns true if section is empty. bool empty() { return RangesBuffer->empty(); } @@ -391,15 +391,15 @@ public: DebugAddrWriterDwarf5(BinaryContext *BC) : DebugAddrWriter(BC) {} /// Creates consolidated .debug_addr section, and builds DWOID to offset map. - virtual AddressSectionBuffer finalize() override; + AddressSectionBuffer finalize() override; /// Given DWARFUnit \p Unit returns offset of this CU in to .debug_addr /// section. - virtual uint64_t getOffset(DWARFUnit &Unit) override; + uint64_t getOffset(DWARFUnit &Unit) override; protected: /// Given DWARFUnit \p Unit returns either DWO ID or it's offset within /// .debug_info. - virtual uint64_t getCUID(DWARFUnit &Unit) override { + uint64_t getCUID(DWARFUnit &Unit) override { if (Unit.isDWOUnit()) { DWARFUnit *SkeletonCU = Unit.getLinkedUnit(); return SkeletonCU->getOffset(); @@ -561,9 +561,9 @@ public: static void setAddressWriter(DebugAddrWriter *AddrW) { AddrWriter = AddrW; } /// Stores location lists internally to be written out during finalize phase. - virtual void addList(AttrInfo &AttrVal, DebugLocationsVector &LocList, - DebugInfoBinaryPatcher &DebugInfoPatcher, - DebugAbbrevWriter &AbbrevWriter) override; + void addList(AttrInfo &AttrVal, DebugLocationsVector &LocList, + DebugInfoBinaryPatcher &DebugInfoPatcher, + DebugAbbrevWriter &AbbrevWriter) override; /// Writes out locations in to a local buffer and applies debug info patches. void finalize(DebugInfoBinaryPatcher &DebugInfoPatcher, @@ -685,7 +685,7 @@ public: /// This function takes in \p BinaryContents, applies patches to it and /// returns an updated string. - virtual std::string patchBinary(StringRef BinaryContents) override; + std::string patchBinary(StringRef BinaryContents) override; }; class DebugInfoBinaryPatcher : public SimpleBinaryPatcher { @@ -843,7 +843,7 @@ public: std::string Value; }; - virtual PatcherKind getKind() const override { + PatcherKind getKind() const override { return PatcherKind::DebugInfoBinaryPatcher; } @@ -853,23 +853,23 @@ public: /// This function takes in \p BinaryContents, and re-writes it with new /// patches inserted into it. It returns an updated string. - virtual std::string patchBinary(StringRef BinaryContents) override; + std::string patchBinary(StringRef BinaryContents) override; /// Adds a patch to put the integer \p NewValue encoded as a 64-bit /// little-endian value at offset \p Offset. - virtual void addLE64Patch(uint64_t Offset, uint64_t NewValue) override; + void addLE64Patch(uint64_t Offset, uint64_t NewValue) override; /// Adds a patch to put the integer \p NewValue encoded as a 32-bit /// little-endian value at offset \p Offset. /// The \p OldValueSize is the size of the old value that will be replaced. - virtual void addLE32Patch(uint64_t Offset, uint32_t NewValue, - uint32_t OldValueSize = 4) override; + void addLE32Patch(uint64_t Offset, uint32_t NewValue, + uint32_t OldValueSize = 4) override; /// Add a patch at \p Offset with \p Value using unsigned LEB128 encoding with /// size \p OldValueSize. /// The \p OldValueSize is the size of the old value that will be replaced. - virtual void addUDataPatch(uint64_t Offset, uint64_t Value, - uint32_t OldValueSize) override; + void addUDataPatch(uint64_t Offset, uint64_t Value, + uint32_t OldValueSize) override; /// Adds a label \p Offset for DWARF UNit. /// Used to recompute relative references. diff --git a/bolt/include/bolt/Core/JumpTable.h b/bolt/include/bolt/Core/JumpTable.h index 9615025..2f85232 100644 --- a/bolt/include/bolt/Core/JumpTable.h +++ b/bolt/include/bolt/Core/JumpTable.h @@ -109,7 +109,7 @@ public: /// starting at (or containing) 'Addr'. std::pair getEntriesForAddress(const uint64_t Addr) const; - virtual bool isJumpTable() const override { return true; } + bool isJumpTable() const override { return true; } /// Change all entries of the jump table in \p JTAddress pointing to /// \p OldDest to \p NewDest. Return false if unsuccessful. @@ -120,7 +120,7 @@ public: void updateOriginal(); /// Print for debugging purposes. - virtual void print(raw_ostream &OS) const override; + void print(raw_ostream &OS) const override; }; } // namespace bolt diff --git a/bolt/include/bolt/Profile/DataReader.h b/bolt/include/bolt/Profile/DataReader.h index 60cedfe..4253fc1 100644 --- a/bolt/include/bolt/Profile/DataReader.h +++ b/bolt/include/bolt/Profile/DataReader.h @@ -268,18 +268,18 @@ public: bool isTrustedSource() const override { return false; } - virtual Error preprocessProfile(BinaryContext &BC) override; + Error preprocessProfile(BinaryContext &BC) override; - virtual Error readProfilePreCFG(BinaryContext &BC) override; + Error readProfilePreCFG(BinaryContext &BC) override; - virtual Error readProfile(BinaryContext &BC) override; + Error readProfile(BinaryContext &BC) override; - virtual bool hasLocalsWithFileName() const override; + bool hasLocalsWithFileName() const override; - virtual bool mayHaveProfileData(const BinaryFunction &BF) override; + bool mayHaveProfileData(const BinaryFunction &BF) override; /// Return all event names used to collect this profile - virtual StringSet<> getEventNames() const override { return EventNames; } + StringSet<> getEventNames() const override { return EventNames; } protected: /// Read profile information available for the function. diff --git a/bolt/include/bolt/Profile/YAMLProfileReader.h b/bolt/include/bolt/Profile/YAMLProfileReader.h index 3c21a8e..255ab07 100644 --- a/bolt/include/bolt/Profile/YAMLProfileReader.h +++ b/bolt/include/bolt/Profile/YAMLProfileReader.h @@ -33,9 +33,9 @@ public: Error preprocessProfile(BinaryContext &BC) override; - virtual bool hasLocalsWithFileName() const override; + bool hasLocalsWithFileName() const override; - virtual bool mayHaveProfileData(const BinaryFunction &BF) override; + bool mayHaveProfileData(const BinaryFunction &BF) override; /// Check if the file contains YAML. static bool isYAML(StringRef Filename); diff --git a/bolt/lib/Target/X86/X86MCPlusBuilder.cpp b/bolt/lib/Target/X86/X86MCPlusBuilder.cpp index b6343aa..c9a9228 100644 --- a/bolt/lib/Target/X86/X86MCPlusBuilder.cpp +++ b/bolt/lib/Target/X86/X86MCPlusBuilder.cpp @@ -574,7 +574,7 @@ public: } }; - virtual std::unique_ptr + std::unique_ptr matchAdd(std::unique_ptr A, std::unique_ptr B) const override { return std::unique_ptr( @@ -612,7 +612,7 @@ public: } }; - virtual std::unique_ptr + std::unique_ptr matchLoadAddr(std::unique_ptr Target) const override { return std::unique_ptr(new LEAMatcher(std::move(Target))); } -- 2.7.4