mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Remove error-prone methods of BinaryRef.
A user shouldn't care about the internal state, and these methods by their very nature require asserting a predicate on the internal state. As such, they cannot be used safely without introducing hidden long-distance dependencies on the manner of construction of the BinaryRef. Use writeAsBinary(raw_ostream &) and writeAsHex(raw_ostream &) if you need to access the data in a binary or hex format. llvm-svn: 183353
This commit is contained in:
parent
66fceb99ee
commit
e61870890f
@ -36,14 +36,6 @@ public:
|
||||
: Data(reinterpret_cast<const uint8_t *>(Data.data()), Data.size()),
|
||||
DataIsHexString(true) {}
|
||||
BinaryRef() : DataIsHexString(true) {}
|
||||
StringRef getHex() const {
|
||||
assert(DataIsHexString);
|
||||
return StringRef(reinterpret_cast<const char *>(Data.data()), Data.size());
|
||||
}
|
||||
ArrayRef<uint8_t> getBinary() const {
|
||||
assert(!DataIsHexString);
|
||||
return Data;
|
||||
}
|
||||
/// \brief The number of bytes that are represented by this BinaryRef.
|
||||
/// This is the number of bytes that writeAsBinary() will write.
|
||||
ArrayRef<uint8_t>::size_type binary_size() const {
|
||||
|
Loading…
Reference in New Issue
Block a user