bulbazord created this revision. bulbazord added reviewers: JDevlieghere, mib, jingham, jasonmolenda. Herald added a project: All. bulbazord requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
lldbUtility seems like a more suitable place for StreamBuffer. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D157463 Files: lldb/include/lldb/Core/StreamBuffer.h lldb/include/lldb/Utility/StreamBuffer.h lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
Index: lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp =================================================================== --- lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp +++ lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp @@ -10,10 +10,10 @@ #include "Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.h" -#include "lldb/Core/StreamBuffer.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/StreamBuffer.h" #include "lldb/Utility/StreamString.h" #include "llvm/DebugInfo/DIContext.h" #include "llvm/DebugInfo/DWARF/DWARFExpression.h" Index: lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp +++ lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp @@ -9,11 +9,11 @@ #include "PDBLocationToDWARFExpression.h" #include "lldb/Core/Section.h" -#include "lldb/Core/StreamBuffer.h" #include "lldb/Core/dwarf.h" #include "lldb/Expression/DWARFExpression.h" #include "lldb/Symbol/Variable.h" #include "lldb/Utility/DataBufferHeap.h" +#include "lldb/Utility/StreamBuffer.h" #include "llvm/DebugInfo/CodeView/CodeView.h" #include "llvm/DebugInfo/PDB/IPDBSession.h" Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -14,7 +14,6 @@ #include "Plugins/TypeSystem/Clang/TypeSystemClang.h" #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" -#include "lldb/Core/StreamBuffer.h" #include "lldb/Core/StreamFile.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/LineTable.h" Index: lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp +++ lldb/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp @@ -9,7 +9,6 @@ #include "PdbFPOProgramToDWARFExpression.h" #include "CodeViewRegisterMapping.h" -#include "lldb/Core/StreamBuffer.h" #include "lldb/Symbol/PostfixExpression.h" #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/Stream.h" Index: lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp +++ lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp @@ -10,10 +10,10 @@ #include "lldb/Core/Module.h" #include "lldb/Core/Section.h" -#include "lldb/Core/StreamBuffer.h" #include "lldb/Expression/DWARFExpression.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/DataBufferHeap.h" +#include "lldb/Utility/StreamBuffer.h" #include "llvm/BinaryFormat/Dwarf.h" #include "llvm/DebugInfo/CodeView/TypeDeserializer.h" Index: lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp +++ lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp @@ -10,7 +10,6 @@ #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" -#include "lldb/Core/StreamBuffer.h" #include "lldb/Host/Config.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/Function.h" @@ -26,6 +25,7 @@ #include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/RegularExpression.h" +#include "lldb/Utility/StreamBuffer.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/Timer.h" #include "llvm/Support/MemoryBuffer.h" Index: lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h =================================================================== --- lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h +++ lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h @@ -14,9 +14,9 @@ #include <string> #include "lldb/Core/Communication.h" -#include "lldb/Core/StreamBuffer.h" #include "lldb/Utility/Listener.h" #include "lldb/Utility/Predicate.h" +#include "lldb/Utility/StreamBuffer.h" #include "lldb/lldb-private.h" class CommunicationKDP : public lldb_private::Communication { Index: lldb/include/lldb/Core/StreamBuffer.h =================================================================== --- /dev/null +++ lldb/include/lldb/Core/StreamBuffer.h @@ -1,54 +0,0 @@ -//===-- StreamBuffer.h ------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef LLDB_CORE_STREAMBUFFER_H -#define LLDB_CORE_STREAMBUFFER_H - -#include "lldb/Utility/Stream.h" -#include "llvm/ADT/SmallVector.h" -#include <cstdio> -#include <string> - -namespace lldb_private { - -template <unsigned N> class StreamBuffer : public Stream { -public: - StreamBuffer() : Stream(0, 4, lldb::eByteOrderBig), m_packet() {} - - StreamBuffer(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order) - : Stream(flags, addr_size, byte_order), m_packet() {} - - ~StreamBuffer() override = default; - - void Flush() override { - // Nothing to do when flushing a buffer based stream... - } - - void Clear() { m_packet.clear(); } - - // Beware, this might not be NULL terminated as you can expect from - // StringString as there may be random bits in the llvm::SmallVector. If you - // are using this class to create a C string, be sure the call PutChar ('\0') - // after you have created your string, or use StreamString. - const char *GetData() const { return m_packet.data(); } - - size_t GetSize() const { return m_packet.size(); } - -protected: - llvm::SmallVector<char, N> m_packet; - - size_t WriteImpl(const void *s, size_t length) override { - if (s && length) - m_packet.append((const char *)s, ((const char *)s) + length); - return length; - } -}; - -} // namespace lldb_private - -#endif // LLDB_CORE_STREAMBUFFER_H
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits