diff options
author | Zachary Turner <zturner@google.com> | 2016-12-16 22:48:14 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-12-16 22:48:14 +0000 |
commit | 46225b193fd956545be97a83cecb4a3b6d3d6f17 (patch) | |
tree | b1e3c659ee6958c39782deaf35bb09fbd15fdc43 /llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp | |
parent | 3a4e2dd92fc47098b9b5d6d42756ce59c4a67267 (diff) | |
download | bcm5719-llvm-46225b193fd956545be97a83cecb4a3b6d3d6f17.tar.gz bcm5719-llvm-46225b193fd956545be97a83cecb4a3b6d3d6f17.zip |
Resubmit "[CodeView] Hook CodeViewRecordIO for reading/writing symbols."
The original patch was broken due to some undefined behavior
as well as warnings that were triggering -Werror.
llvm-svn: 290000
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp b/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp index 19facaec9f0..9bd85cf9dc6 100644 --- a/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp +++ b/llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp @@ -75,6 +75,16 @@ Error CodeViewRecordIO::mapByteVectorTail(ArrayRef<uint8_t> &Bytes) { return Error::success(); } +Error CodeViewRecordIO::mapByteVectorTail(std::vector<uint8_t> &Bytes) { + ArrayRef<uint8_t> BytesRef(Bytes); + if (auto EC = mapByteVectorTail(BytesRef)) + return EC; + if (!isWriting()) + Bytes.assign(BytesRef.begin(), BytesRef.end()); + + return Error::success(); +} + Error CodeViewRecordIO::mapInteger(TypeIndex &TypeInd) { if (isWriting()) { if (auto EC = Writer->writeInteger(TypeInd.getIndex())) @@ -160,6 +170,27 @@ Error CodeViewRecordIO::mapGuid(StringRef &Guid) { return Error::success(); } +Error CodeViewRecordIO::mapStringZVectorZ(std::vector<StringRef> &Value) { + if (isWriting()) { + for (auto V : Value) { + if (auto EC = mapStringZ(V)) + return EC; + } + if (auto EC = Writer->writeInteger(uint8_t(0))) + return EC; + } else { + StringRef S; + if (auto EC = mapStringZ(S)) + return EC; + while (!S.empty()) { + Value.push_back(S); + if (auto EC = mapStringZ(S)) + return EC; + }; + } + return Error::success(); +} + Error CodeViewRecordIO::writeEncodedSignedInteger(const int64_t &Value) { assert(Value < 0 && "Encoded integer is not signed!"); if (Value >= std::numeric_limits<int8_t>::min()) { |