mirror of
https://github.com/RPCSX/llvm.git
synced 2025-05-13 19:06:05 +00:00

In preparation for introducing writing capabilities for each of these classes, I would like to adopt a Foo / FooRef naming convention, where Foo indicates that the class can manipulate and serialize Foos, and FooRef indicates that it is an immutable view of an existing Foo. In other words, Foo is a writer and FooRef is a reader. This patch names some existing readers to conform to the FooRef convention, while offering no functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301810 91177308-0d34-0410-b5e6-96231b3b80d8
51 lines
1.6 KiB
C++
51 lines
1.6 KiB
C++
//===- ModuleDebugFileChecksumFragment.cpp ----------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h"
|
|
|
|
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
|
#include "llvm/Support/BinaryStreamReader.h"
|
|
|
|
using namespace llvm;
|
|
using namespace llvm::codeview;
|
|
|
|
struct FileChecksumEntryHeader {
|
|
using ulittle32_t = support::ulittle32_t;
|
|
|
|
ulittle32_t FileNameOffset; // Byte offset of filename in global string table.
|
|
uint8_t ChecksumSize; // Number of bytes of checksum.
|
|
uint8_t ChecksumKind; // FileChecksumKind
|
|
// Checksum bytes follow.
|
|
};
|
|
|
|
Error llvm::VarStreamArrayExtractor<FileChecksumEntry>::extract(
|
|
BinaryStreamRef Stream, uint32_t &Len, FileChecksumEntry &Item, void *Ctx) {
|
|
BinaryStreamReader Reader(Stream);
|
|
|
|
const FileChecksumEntryHeader *Header;
|
|
if (auto EC = Reader.readObject(Header))
|
|
return EC;
|
|
|
|
Item.FileNameOffset = Header->FileNameOffset;
|
|
Item.Kind = static_cast<FileChecksumKind>(Header->ChecksumKind);
|
|
if (auto EC = Reader.readBytes(Item.Checksum, Header->ChecksumSize))
|
|
return EC;
|
|
|
|
Len = alignTo(Header->ChecksumSize + sizeof(FileChecksumEntryHeader), 4);
|
|
return Error::success();
|
|
}
|
|
|
|
Error ModuleDebugFileChecksumFragmentRef::initialize(
|
|
BinaryStreamReader Reader) {
|
|
if (auto EC = Reader.readArray(Checksums, Reader.bytesRemaining()))
|
|
return EC;
|
|
|
|
return Error::success();
|
|
}
|