[Lldb-commits] [lldb] 150c8dd - [lldb] Remove some (almost) unused Stream::operator<<'s
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Dec 4 02:06:34 PST 2019
Author: Pavel Labath
Date: 2019-12-04T11:07:46+01:00
New Revision: 150c8dd13be4a9d9a9f631a507871359117871ca
URL: https://github.com/llvm/llvm-project/commit/150c8dd13be4a9d9a9f631a507871359117871ca
DIFF: https://github.com/llvm/llvm-project/commit/150c8dd13be4a9d9a9f631a507871359117871ca.diff
LOG: [lldb] Remove some (almost) unused Stream::operator<<'s
llvm::raw_ostream provides equivalent functionality.
Added:
Modified:
lldb/include/lldb/Utility/Stream.h
lldb/source/Symbol/Variable.cpp
lldb/source/Utility/Stream.cpp
lldb/unittests/Utility/StreamTest.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Utility/Stream.h b/lldb/include/lldb/Utility/Stream.h
index 9982d8236a65..a3a33178086e 100644
--- a/lldb/include/lldb/Utility/Stream.h
+++ b/lldb/include/lldb/Utility/Stream.h
@@ -217,46 +217,10 @@ class Stream {
Stream &operator<<(uint16_t uval) = delete;
Stream &operator<<(uint32_t uval) = delete;
Stream &operator<<(uint64_t uval) = delete;
-
- /// Output a int8_t \a sval to the stream \a s.
- ///
- /// \param[in] sval
- /// A int8_t value.
- ///
- /// \return
- /// A reference to this class so multiple things can be streamed
- /// in one statement.
- Stream &operator<<(int8_t sval);
-
- /// Output a int16_t \a sval to the stream \a s.
- ///
- /// \param[in] sval
- /// A int16_t value.
- ///
- /// \return
- /// A reference to this class so multiple things can be streamed
- /// in one statement.
- Stream &operator<<(int16_t sval);
-
- /// Output a int32_t \a sval to the stream \a s.
- ///
- /// \param[in] sval
- /// A int32_t value.
- ///
- /// \return
- /// A reference to this class so multiple things can be streamed
- /// in one statement.
- Stream &operator<<(int32_t sval);
-
- /// Output a int64_t \a sval to the stream \a s.
- ///
- /// \param[in] sval
- /// A int64_t value.
- ///
- /// \return
- /// A reference to this class so multiple things can be streamed
- /// in one statement.
- Stream &operator<<(int64_t sval);
+ Stream &operator<<(int8_t sval) = delete;
+ Stream &operator<<(int16_t sval) = delete;
+ Stream &operator<<(int32_t sval) = delete;
+ Stream &operator<<(int64_t sval) = delete;
/// Output an address value to this stream.
///
diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp
index 6e4b87c47700..fc7d127a326f 100644
--- a/lldb/source/Symbol/Variable.cpp
+++ b/lldb/source/Symbol/Variable.cpp
@@ -134,7 +134,7 @@ void Variable::Dump(Stream *s, bool show_context) const {
s->PutCString("thread local");
break;
default:
- *s << "??? (" << m_scope << ')';
+ s->AsRawOstream() << "??? (" << m_scope << ')';
}
}
diff --git a/lldb/source/Utility/Stream.cpp b/lldb/source/Utility/Stream.cpp
index 119d1e0f7964..2ef4cd78ab03 100644
--- a/lldb/source/Utility/Stream.cpp
+++ b/lldb/source/Utility/Stream.cpp
@@ -160,30 +160,6 @@ Stream &Stream::operator<<(const void *p) {
return *this;
}
-// Stream a int8_t "sval" out to this stream.
-Stream &Stream::operator<<(int8_t sval) {
- Printf("%i", static_cast<int>(sval));
- return *this;
-}
-
-// Stream a int16_t "sval" out to this stream.
-Stream &Stream::operator<<(int16_t sval) {
- Printf("%i", static_cast<int>(sval));
- return *this;
-}
-
-// Stream a int32_t "sval" out to this stream.
-Stream &Stream::operator<<(int32_t sval) {
- Printf("%i", static_cast<int>(sval));
- return *this;
-}
-
-// Stream a int64_t "sval" out to this stream.
-Stream &Stream::operator<<(int64_t sval) {
- Printf("%" PRIi64, sval);
- return *this;
-}
-
// Get the current indentation level
unsigned Stream::GetIndentLevel() const { return m_indent_level; }
diff --git a/lldb/unittests/Utility/StreamTest.cpp b/lldb/unittests/Utility/StreamTest.cpp
index 93c25166cdfd..6e42ac2d11f0 100644
--- a/lldb/unittests/Utility/StreamTest.cpp
+++ b/lldb/unittests/Utility/StreamTest.cpp
@@ -387,15 +387,6 @@ TEST_F(StreamTest, ShiftOperatorStrings) {
EXPECT_EQ("cstring\nllvm::StringRef\n", TakeValue());
}
-TEST_F(StreamTest, ShiftOperatorInts) {
- s << std::numeric_limits<int8_t>::max() << " ";
- s << std::numeric_limits<int16_t>::max() << " ";
- s << std::numeric_limits<int32_t>::max() << " ";
- s << std::numeric_limits<int64_t>::max();
- EXPECT_EQ(40U, s.GetWrittenBytes());
- EXPECT_EQ("127 32767 2147483647 9223372036854775807", TakeValue());
-}
-
TEST_F(StreamTest, ShiftOperatorPtr) {
// This test is a bit tricky because pretty much everything related to
// pointer printing seems to lead to UB or IB. So let's make the most basic
More information about the lldb-commits
mailing list