Use consume instead of manually using drop_front

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271137 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer 2016-05-28 19:17:48 +00:00
parent 32f7ec64e7
commit baa5e7155c

View File

@ -998,10 +998,10 @@ void COFFDumper::mergeCodeViewTypes(MemoryTypeTableBuilder &CVTypes) {
if (SectionName == ".debug$T") {
StringRef Data;
error(S.getContents(Data));
unsigned Magic = *reinterpret_cast<const ulittle32_t *>(Data.data());
uint32_t Magic;
error(consume(Data, Magic));
if (Magic != 4)
error(object_error::parse_failed);
Data = Data.drop_front(4);
ArrayRef<uint8_t> Bytes(reinterpret_cast<const uint8_t *>(Data.data()),
Data.size());
ByteStream Stream(Bytes);