From 8095a0cda8f6caafaf8be180c4e07b29fed33301 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 10 Jul 2016 10:17:36 +0000 Subject: [PATCH] [codeview] Drop unused private inheritance. There is no polymorphism here, and StreamRef already contains a StreamInterface pointer. Dropping the base class makes StreamRef more transparent to the compiler, for example it can find unused variables. llvm-svn: 275013 --- include/llvm/DebugInfo/CodeView/StreamRef.h | 12 ++++++------ tools/llvm-pdbdump/LLVMOutputStyle.cpp | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/llvm/DebugInfo/CodeView/StreamRef.h b/include/llvm/DebugInfo/CodeView/StreamRef.h index 22c4bdb5941..a4f244a3228 100644 --- a/include/llvm/DebugInfo/CodeView/StreamRef.h +++ b/include/llvm/DebugInfo/CodeView/StreamRef.h @@ -16,7 +16,7 @@ namespace llvm { namespace codeview { -class StreamRef : private StreamInterface { +class StreamRef { public: StreamRef() : Stream(nullptr), ViewOffset(0), Length(0) {} StreamRef(const StreamInterface &Stream) @@ -28,7 +28,7 @@ public: StreamRef(const StreamRef &S, uint32_t Offset, uint32_t Length) = delete; Error readBytes(uint32_t Offset, uint32_t Size, - ArrayRef &Buffer) const override { + ArrayRef &Buffer) const { if (ViewOffset + Offset < Offset) return make_error(cv_error_code::insufficient_buffer); if (Size + Offset > Length) @@ -39,7 +39,7 @@ public: // Given an offset into the stream, read as much as possible without copying // any data. Error readLongestContiguousChunk(uint32_t Offset, - ArrayRef &Buffer) const override { + ArrayRef &Buffer) const { if (Offset >= Length) return make_error(cv_error_code::insufficient_buffer); @@ -54,15 +54,15 @@ public: return Error::success(); } - Error writeBytes(uint32_t Offset, ArrayRef Data) const override { + Error writeBytes(uint32_t Offset, ArrayRef Data) const { if (Data.size() + Offset > Length) return make_error(cv_error_code::insufficient_buffer); return Stream->writeBytes(ViewOffset + Offset, Data); } - uint32_t getLength() const override { return Length; } + uint32_t getLength() const { return Length; } - Error commit() const override { return Stream->commit(); } + Error commit() const { return Stream->commit(); } StreamRef drop_front(uint32_t N) const { if (!Stream) diff --git a/tools/llvm-pdbdump/LLVMOutputStyle.cpp b/tools/llvm-pdbdump/LLVMOutputStyle.cpp index c24d364885d..d8eefa08377 100644 --- a/tools/llvm-pdbdump/LLVMOutputStyle.cpp +++ b/tools/llvm-pdbdump/LLVMOutputStyle.cpp @@ -344,7 +344,6 @@ static void dumpTpiHash(ScopedPrinter &P, TpiStream &Tpi) { DictScope DD(P, "Hash"); P.printNumber("Number of Hash Buckets", Tpi.NumHashBuckets()); P.printNumber("Hash Key Size", Tpi.getHashKeySize()); - codeview::FixedStreamArray S = Tpi.getHashValues(); P.printList("Values", Tpi.getHashValues()); P.printList("Type Index Offsets", Tpi.getTypeIndexOffsets(), printTypeIndexOffset);