diff --git a/include/llvm/Object/COFFYAML.h b/include/llvm/Object/COFFYAML.h index 25c4601a972..4c20260222f 100644 --- a/include/llvm/Object/COFFYAML.h +++ b/include/llvm/Object/COFFYAML.h @@ -40,21 +40,21 @@ namespace COFFYAML { /// string. Using this avoid having to allocate temporary strings. /// FIXME: not COFF specific. class BinaryRef { - ArrayRef BinaryData; - StringRef HexData; + ArrayRef Data; bool isBinary; public: - BinaryRef(ArrayRef BinaryData) - : BinaryData(BinaryData), isBinary(true) {} - BinaryRef(StringRef HexData) : HexData(HexData), isBinary(false) {} + BinaryRef(ArrayRef Data) : Data(Data), isBinary(true) {} + BinaryRef(StringRef Data) + : Data(reinterpret_cast(Data.data()), Data.size()), + isBinary(false) {} BinaryRef() : isBinary(false) {} StringRef getHex() const { assert(!isBinary); - return HexData; + return StringRef(reinterpret_cast(Data.data()), Data.size()); } ArrayRef getBinary() const { assert(isBinary); - return BinaryData; + return Data; } };