mirror of
https://github.com/RPCSX/llvm.git
synced 2025-04-13 05:20:27 +00:00

This provides a better layering of responsibilities among different aspects of PDB writing code. Some of the MSF related code was contained in CodeView, and some was in PDB prior to this. Further, we were often saying PDB when we meant MSF, and the two are actually independent of each other since in theory you can have other types of data besides PDB data in an MSF. So, this patch separates the MSF specific code into its own library, with no dependencies on anything else, and DebugInfoCodeView and DebugInfoPDB take dependencies on DebugInfoMsf. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276458 91177308-0d34-0410-b5e6-96231b3b80d8
44 lines
1.4 KiB
C++
44 lines
1.4 KiB
C++
//===- ModuleSubstream.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/ModuleSubstream.h"
|
|
|
|
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
|
|
|
using namespace llvm;
|
|
using namespace llvm::codeview;
|
|
using namespace llvm::msf;
|
|
|
|
ModuleSubstream::ModuleSubstream() : Kind(ModuleSubstreamKind::None) {}
|
|
|
|
ModuleSubstream::ModuleSubstream(ModuleSubstreamKind Kind, StreamRef Data)
|
|
: Kind(Kind), Data(Data) {}
|
|
|
|
Error ModuleSubstream::initialize(StreamRef Stream, ModuleSubstream &Info) {
|
|
const ModuleSubsectionHeader *Header;
|
|
StreamReader Reader(Stream);
|
|
if (auto EC = Reader.readObject(Header))
|
|
return EC;
|
|
|
|
ModuleSubstreamKind Kind =
|
|
static_cast<ModuleSubstreamKind>(uint32_t(Header->Kind));
|
|
if (auto EC = Reader.readStreamRef(Info.Data, Header->Length))
|
|
return EC;
|
|
Info.Kind = Kind;
|
|
return Error::success();
|
|
}
|
|
|
|
uint32_t ModuleSubstream::getRecordLength() const {
|
|
return sizeof(ModuleSubsectionHeader) + Data.getLength();
|
|
}
|
|
|
|
ModuleSubstreamKind ModuleSubstream::getSubstreamKind() const { return Kind; }
|
|
|
|
StreamRef ModuleSubstream::getRecordData() const { return Data; }
|