[llvm] r183353 - Remove error-prone methods of BinaryRef.

Sean Silva silvas at purdue.edu
Wed Jun 5 16:55:26 PDT 2013


Author: silvas
Date: Wed Jun  5 18:55:26 2013
New Revision: 183353

URL: http://llvm.org/viewvc/llvm-project?rev=183353&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/Object/YAML.h

Modified: llvm/trunk/include/llvm/Object/YAML.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/YAML.h?rev=183353&r1=183352&r2=183353&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/YAML.h (original)
+++ llvm/trunk/include/llvm/Object/YAML.h Wed Jun  5 18:55:26 2013
@@ -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 {





More information about the llvm-commits mailing list