[llvm] ad8f7f4 - [Support] Add "override" where appropriate (NFC) (#164190)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 19 21:56:34 PDT 2025


Author: Kazu Hirata
Date: 2025-10-19T21:56:30-07:00
New Revision: ad8f7f4e733cb2420331675f268b70c14ff643ad

URL: https://github.com/llvm/llvm-project/commit/ad8f7f4e733cb2420331675f268b70c14ff643ad
DIFF: https://github.com/llvm/llvm-project/commit/ad8f7f4e733cb2420331675f268b70c14ff643ad.diff

LOG: [Support] Add "override" where appropriate (NFC) (#164190)

Note that "override" makes "virtual" redundant.

Identified with modernize-use-override.

Added: 
    

Modified: 
    llvm/include/llvm/Support/DebugLog.h
    llvm/include/llvm/Support/ELFAttrParserCompact.h
    llvm/include/llvm/Support/ELFAttrParserExtended.h
    llvm/include/llvm/Support/FormatAdapters.h
    llvm/include/llvm/Support/ScopedPrinter.h
    llvm/include/llvm/Support/SuffixTreeNode.h
    llvm/include/llvm/Support/VirtualFileSystem.h
    llvm/include/llvm/Support/VirtualOutputFile.h
    llvm/include/llvm/Support/raw_socket_stream.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/DebugLog.h b/llvm/include/llvm/Support/DebugLog.h
index fd67d7aba85f0..e9bd2d83c46ba 100644
--- a/llvm/include/llvm/Support/DebugLog.h
+++ b/llvm/include/llvm/Support/DebugLog.h
@@ -293,7 +293,7 @@ class RAIINewLineStream final : public raw_ostream {
 
 public:
   RAIINewLineStream(raw_ostream &Os) : Os(Os) { SetUnbuffered(); }
-  ~RAIINewLineStream() { Os << '\n'; }
+  ~RAIINewLineStream() override { Os << '\n'; }
   void write_impl(const char *Ptr, size_t Size) final { Os.write(Ptr, Size); }
   uint64_t current_pos() const final { return Os.tell(); }
   RAIINewLineStream &asLvalue() { return *this; }

diff  --git a/llvm/include/llvm/Support/ELFAttrParserCompact.h b/llvm/include/llvm/Support/ELFAttrParserCompact.h
index e687483b21a8c..9bed36fdacd8b 100644
--- a/llvm/include/llvm/Support/ELFAttrParserCompact.h
+++ b/llvm/include/llvm/Support/ELFAttrParserCompact.h
@@ -49,7 +49,7 @@ class LLVM_ABI ELFCompactAttrParser : public ELFAttributeParser {
   }
 
 public:
-  virtual ~ELFCompactAttrParser() { static_cast<void>(!cursor.takeError()); }
+  ~ELFCompactAttrParser() override { static_cast<void>(!cursor.takeError()); }
   Error integerAttribute(unsigned tag);
   Error stringAttribute(unsigned tag);
 

diff  --git a/llvm/include/llvm/Support/ELFAttrParserExtended.h b/llvm/include/llvm/Support/ELFAttrParserExtended.h
index 1da666595cd01..d3dc74263d2b0 100644
--- a/llvm/include/llvm/Support/ELFAttrParserExtended.h
+++ b/llvm/include/llvm/Support/ELFAttrParserExtended.h
@@ -36,7 +36,7 @@ class LLVM_ABI ELFExtendedAttrParser : public ELFAttributeParser {
                        const unsigned Tag);
 
 public:
-  virtual ~ELFExtendedAttrParser() { static_cast<void>(!Cursor.takeError()); }
+  ~ELFExtendedAttrParser() override { static_cast<void>(!Cursor.takeError()); }
   Error parse(ArrayRef<uint8_t> Section, llvm::endianness Endian) override;
 
   std::optional<unsigned> getAttributeValue(unsigned Tag) const override;

diff  --git a/llvm/include/llvm/Support/FormatAdapters.h b/llvm/include/llvm/Support/FormatAdapters.h
index 4131e956873e9..91e9c41d8a395 100644
--- a/llvm/include/llvm/Support/FormatAdapters.h
+++ b/llvm/include/llvm/Support/FormatAdapters.h
@@ -77,7 +77,7 @@ class ErrorAdapter : public FormatAdapter<Error> {
 public:
   ErrorAdapter(Error &&Item) : FormatAdapter(std::move(Item)) {}
   ErrorAdapter(ErrorAdapter &&) = default;
-  ~ErrorAdapter() { consumeError(std::move(Item)); }
+  ~ErrorAdapter() override { consumeError(std::move(Item)); }
   void format(llvm::raw_ostream &Stream, StringRef Style) override {
     Stream << Item;
   }

diff  --git a/llvm/include/llvm/Support/ScopedPrinter.h b/llvm/include/llvm/Support/ScopedPrinter.h
index 7b87fdafd68ac..e9e9903b2482a 100644
--- a/llvm/include/llvm/Support/ScopedPrinter.h
+++ b/llvm/include/llvm/Support/ScopedPrinter.h
@@ -870,7 +870,7 @@ struct DictScope : DelimitedScope {
     W.objectBegin();
   }
 
-  ~DictScope() {
+  ~DictScope() override {
     if (W)
       W->objectEnd();
   }
@@ -889,7 +889,7 @@ struct ListScope : DelimitedScope {
     W.arrayBegin();
   }
 
-  ~ListScope() {
+  ~ListScope() override {
     if (W)
       W->arrayEnd();
   }

diff  --git a/llvm/include/llvm/Support/SuffixTreeNode.h b/llvm/include/llvm/Support/SuffixTreeNode.h
index b49febf16e01e..c3c0bf5d14926 100644
--- a/llvm/include/llvm/Support/SuffixTreeNode.h
+++ b/llvm/include/llvm/Support/SuffixTreeNode.h
@@ -155,7 +155,7 @@ struct LLVM_ABI SuffixTreeInternalNode : SuffixTreeNode {
       : SuffixTreeNode(NodeKind::ST_Internal, StartIdx), EndIdx(EndIdx),
         Link(Link) {}
 
-  virtual ~SuffixTreeInternalNode() = default;
+  ~SuffixTreeInternalNode() override = default;
 };
 
 // A node representing a suffix.
@@ -189,7 +189,7 @@ struct LLVM_ABI SuffixTreeLeafNode : SuffixTreeNode {
   SuffixTreeLeafNode(unsigned StartIdx, unsigned *EndIdx)
       : SuffixTreeNode(NodeKind::ST_Leaf, StartIdx), EndIdx(EndIdx) {}
 
-  virtual ~SuffixTreeLeafNode() = default;
+  ~SuffixTreeLeafNode() override = default;
 };
 } // namespace llvm
 #endif // LLVM_SUPPORT_SUFFIXTREE_NODE_H

diff  --git a/llvm/include/llvm/Support/VirtualFileSystem.h b/llvm/include/llvm/Support/VirtualFileSystem.h
index 8007f3c853f20..c8911a0225f86 100644
--- a/llvm/include/llvm/Support/VirtualFileSystem.h
+++ b/llvm/include/llvm/Support/VirtualFileSystem.h
@@ -268,7 +268,7 @@ class LLVM_ABI FileSystem : public llvm::ThreadSafeRefCountedBase<FileSystem>,
                             public RTTIExtends<FileSystem, RTTIRoot> {
 public:
   static const char ID;
-  virtual ~FileSystem();
+  ~FileSystem() override;
 
   /// Get the status of the entry at \p Path, if one exists.
   virtual llvm::ErrorOr<Status> status(const Twine &Path) = 0;
@@ -495,7 +495,7 @@ class LLVM_ABI ProxyFileSystem
 private:
   IntrusiveRefCntPtr<FileSystem> FS;
 
-  virtual void anchor() override;
+  void anchor() override;
 };
 
 namespace detail {

diff  --git a/llvm/include/llvm/Support/VirtualOutputFile.h b/llvm/include/llvm/Support/VirtualOutputFile.h
index cb6d1c3d78139..dd50437605deb 100644
--- a/llvm/include/llvm/Support/VirtualOutputFile.h
+++ b/llvm/include/llvm/Support/VirtualOutputFile.h
@@ -31,7 +31,7 @@ class OutputFileImpl : public RTTIExtends<OutputFileImpl, RTTIRoot> {
 
 public:
   static char ID;
-  virtual ~OutputFileImpl() = default;
+  ~OutputFileImpl() override = default;
 
   virtual Error keep() = 0;
   virtual Error discard() = 0;

diff  --git a/llvm/include/llvm/Support/raw_socket_stream.h b/llvm/include/llvm/Support/raw_socket_stream.h
index 47352e3c04220..2abff25920d16 100644
--- a/llvm/include/llvm/Support/raw_socket_stream.h
+++ b/llvm/include/llvm/Support/raw_socket_stream.h
@@ -126,7 +126,7 @@ class LLVM_ABI raw_socket_stream : public raw_fd_stream {
 
 public:
   raw_socket_stream(int SocketFD);
-  ~raw_socket_stream();
+  ~raw_socket_stream() override;
 
   /// Create a \p raw_socket_stream connected to the UNIX domain socket at \p
   /// SocketPath.


        


More information about the llvm-commits mailing list