Update prebuilt Clang to r416183b from Android.
https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef
clang 12.0.5 (based on r416183b) from build 7284624.
Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/include/lldb/Utility/DataEncoder.h b/linux-x64/clang/include/lldb/Utility/DataEncoder.h
index 19b7cef..8edec54 100644
--- a/linux-x64/clang/include/lldb/Utility/DataEncoder.h
+++ b/linux-x64/clang/include/lldb/Utility/DataEncoder.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_DataEncoder_h_
-#define liblldb_DataEncoder_h_
+#ifndef LLDB_UTILITY_DATAENCODER_H
+#define LLDB_UTILITY_DATAENCODER_H
#if defined(__cplusplus)
@@ -21,8 +21,9 @@
namespace lldb_private {
-/// \class DataEncoder DataEncoder.h "lldb/Core/DataEncoder.h" An binary data
-/// encoding class.
+/// \class DataEncoder
+///
+/// An binary data encoding class.
///
/// DataEncoder is a class that can encode binary data (swapping if needed) to
/// a data buffer. The data buffer can be caller owned, or can be shared data
@@ -86,74 +87,6 @@
/// any references to shared data that this object may contain.
void Clear();
- /// Get the current address size.
- ///
- /// Return the size in bytes of any address values this object will extract.
- ///
- /// \return
- /// The size in bytes of address values that will be extracted.
- uint8_t GetAddressByteSize() const { return m_addr_size; }
-
- /// Get the number of bytes contained in this object.
- ///
- /// \return
- /// The total number of bytes of data this object refers to.
- size_t GetByteSize() const { return m_end - m_start; }
-
- /// Get the data end pointer.
- ///
- /// \return
- /// Returns a pointer to the next byte contained in this
- /// object's data, or NULL of there is no data in this object.
- uint8_t *GetDataEnd() { return m_end; }
-
- const uint8_t *GetDataEnd() const { return m_end; }
-
- /// Get the shared data offset.
- ///
- /// Get the offset of the first byte of data in the shared data (if any).
- ///
- /// \return
- /// If this object contains shared data, this function returns
- /// the offset in bytes into that shared data, zero otherwise.
- size_t GetSharedDataOffset() const;
-
- /// Get the current byte order value.
- ///
- /// \return
- /// The current byte order value from this object's internal
- /// state.
- lldb::ByteOrder GetByteOrder() const { return m_byte_order; }
-
- /// Get the data start pointer.
- ///
- /// \return
- /// Returns a pointer to the first byte contained in this
- /// object's data, or NULL of there is no data in this object.
- uint8_t *GetDataStart() { return m_start; }
-
- const uint8_t *GetDataStart() const { return m_start; }
-
- /// Encode unsigned integer values into the data at \a offset.
- ///
- /// \param[in] offset
- /// The offset within the contained data at which to put the
- /// data.
- ///
- /// \param[in] value
- /// The value to encode into the data.
- ///
- /// \return
- /// The next offset in the bytes of this data if the data
- /// was successfully encoded, UINT32_MAX if the encoding failed.
- uint32_t PutU8(uint32_t offset, uint8_t value);
-
- uint32_t PutU16(uint32_t offset, uint16_t value);
-
- uint32_t PutU32(uint32_t offset, uint32_t value);
-
- uint32_t PutU64(uint32_t offset, uint64_t value);
-
/// Encode an unsigned integer of size \a byte_size to \a offset.
///
/// Encode a single integer value at \a offset and return the offset that
@@ -176,7 +109,7 @@
/// \return
/// The next offset in the bytes of this data if the integer
/// was successfully encoded, UINT32_MAX if the encoding failed.
- uint32_t PutMaxU64(uint32_t offset, uint32_t byte_size, uint64_t value);
+ uint32_t PutUnsigned(uint32_t offset, uint32_t byte_size, uint64_t value);
/// Encode an arbitrary number of bytes.
///
@@ -204,12 +137,11 @@
/// m_addr_size member variable and should be set correctly prior to
/// extracting any address values.
///
- /// \param[in,out] offset_ptr
- /// A pointer to an offset within the data that will be advanced
- /// by the appropriate number of bytes if the value is extracted
- /// correctly. If the offset is out of bounds or there are not
- /// enough bytes to extract this value, the offset will be left
- /// unmodified.
+ /// \param[in] offset
+ /// The offset where to encode the address.
+ ///
+ /// \param[in] addr
+ /// The address to encode.
///
/// \return
/// The next valid offset within data if the put operation
@@ -220,50 +152,40 @@
///
/// Encodes a C string into the existing data including the terminating
///
- /// \param[in,out] offset_ptr
- /// A pointer to an offset within the data that will be advanced
- /// by the appropriate number of bytes if the value is extracted
- /// correctly. If the offset is out of bounds or there are not
- /// enough bytes to extract this value, the offset will be left
- /// unmodified.
+ /// \param[in] offset
+ /// The offset where to encode the string.
+ ///
+ /// \param[in] cstr
+ /// The string to encode.
///
/// \return
/// A pointer to the C string value in the data. If the offset
/// pointed to by \a offset_ptr is out of bounds, or if the
/// offset plus the length of the C string is out of bounds,
/// NULL will be returned.
- uint32_t PutCString(uint32_t offset_ptr, const char *cstr);
+ uint32_t PutCString(uint32_t offset, const char *cstr);
- lldb::DataBufferSP &GetSharedDataBuffer() { return m_data_sp; }
+private:
+ uint32_t PutU8(uint32_t offset, uint8_t value);
+ uint32_t PutU16(uint32_t offset, uint16_t value);
+ uint32_t PutU32(uint32_t offset, uint32_t value);
+ uint32_t PutU64(uint32_t offset, uint64_t value);
- /// Set the address byte size.
- ///
- /// Set the size in bytes that will be used when extracting any address and
- /// pointer values from data contained in this object.
- ///
- /// \param[in] addr_size
- /// The size in bytes to use when extracting addresses.
- void SetAddressByteSize(uint8_t addr_size) { m_addr_size = addr_size; }
+ uint32_t BytesLeft(uint32_t offset) const {
+ const uint32_t size = GetByteSize();
+ if (size > offset)
+ return size - offset;
+ return 0;
+ }
- /// Set data with a buffer that is caller owned.
- ///
- /// Use data that is owned by the caller when extracting values. The data
- /// must stay around as long as this object, or any object that copies a
- /// subset of this object's data, is valid. If \a bytes is NULL, or \a
- /// length is zero, this object will contain no data.
- ///
- /// \param[in] bytes
- /// A pointer to caller owned data.
- ///
- /// \param[in] length
- /// The length in bytes of \a bytes.
- ///
- /// \param[in] byte_order
- /// A byte order of the data that we are extracting from.
+ /// Test the availability of \a length bytes of data from \a offset.
///
/// \return
- /// The number of bytes that this object now contains.
- uint32_t SetData(void *bytes, uint32_t length, lldb::ByteOrder byte_order);
+ /// \b true if \a offset is a valid offset and there are \a
+ /// length bytes available at that offset, \b false otherwise.
+ bool ValidOffsetForDataOfSize(uint32_t offset, uint32_t length) const {
+ return length <= BytesLeft(offset);
+ }
/// Adopt a subset of shared data in \a data_sp.
///
@@ -290,15 +212,6 @@
uint32_t SetData(const lldb::DataBufferSP &data_sp, uint32_t offset = 0,
uint32_t length = UINT32_MAX);
- /// Set the byte_order value.
- ///
- /// Sets the byte order of the data to extract. Extracted values will be
- /// swapped if necessary when decoding.
- ///
- /// \param[in] byte_order
- /// The byte order value to use when extracting data.
- void SetByteOrder(lldb::ByteOrder byte_order) { m_byte_order = byte_order; }
-
/// Test the validity of \a offset.
///
/// \return
@@ -306,38 +219,34 @@
/// object, \b false otherwise.
bool ValidOffset(uint32_t offset) const { return offset < GetByteSize(); }
- /// Test the availability of \a length bytes of data from \a offset.
+ /// Get the number of bytes contained in this object.
///
/// \return
- /// \b true if \a offset is a valid offset and there are \a
- /// length bytes available at that offset, \b false otherwise.
- bool ValidOffsetForDataOfSize(uint32_t offset, uint32_t length) const {
- return length <= BytesLeft(offset);
- }
+ /// The total number of bytes of data this object refers to.
+ size_t GetByteSize() const { return m_end - m_start; }
- uint32_t BytesLeft(uint32_t offset) const {
- const uint32_t size = GetByteSize();
- if (size > offset)
- return size - offset;
- return 0;
- }
+ /// A pointer to the first byte of data.
+ uint8_t *m_start;
-protected:
- // Member variables
- uint8_t *m_start; ///< A pointer to the first byte of data.
- uint8_t *m_end; ///< A pointer to the byte that is past the end of the data.
- lldb::ByteOrder
- m_byte_order; ///< The byte order of the data we are extracting from.
- uint8_t m_addr_size; ///< The address size to use when extracting pointers or
- /// addresses
- mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can
- /// be shared among multiple instances
+ /// A pointer to the byte that is past the end of the data.
+ uint8_t *m_end;
-private:
- DISALLOW_COPY_AND_ASSIGN(DataEncoder);
+ /// The byte order of the data we are extracting from.
+ lldb::ByteOrder m_byte_order;
+
+ /// The address size to use when extracting pointers or
+ /// addresses
+ uint8_t m_addr_size;
+
+ /// The shared pointer to data that can
+ /// be shared among multiple instances
+ mutable lldb::DataBufferSP m_data_sp;
+
+ DataEncoder(const DataEncoder &) = delete;
+ const DataEncoder &operator=(const DataEncoder &) = delete;
};
} // namespace lldb_private
#endif // #if defined (__cplusplus)
-#endif // #ifndef liblldb_DataEncoder_h_
+#endif // LLDB_UTILITY_DATAENCODER_H