diff options
| author | Zachary Turner <zturner@google.com> | 2016-12-16 19:20:35 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2016-12-16 19:20:35 +0000 |
| commit | a4e7dfbc16e6e9c786f01a325a3663e8028b4cc0 (patch) | |
| tree | a579cb615b50f1202e5aa91a951578bc47f867a4 /llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp | |
| parent | 8662305bae83768a73057cd9f9e3b93df8c3a037 (diff) | |
| download | bcm5719-llvm-a4e7dfbc16e6e9c786f01a325a3663e8028b4cc0.tar.gz bcm5719-llvm-a4e7dfbc16e6e9c786f01a325a3663e8028b4cc0.zip | |
[CodeView] Hook CodeViewRecordIO for reading/writing symbols.
This is the 3rd of 3 patches to get reading and writing of
CodeView symbol and type records to use a single codepath.
Differential Revision: https://reviews.llvm.org/D26427
llvm-svn: 289978
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()) { |

