mirror of
https://github.com/RPCS3/llvm.git
synced 2025-05-19 03:45:53 +00:00

This is part of a larger effort to get the Stream code moved up to Support. I don't want to do it in one large patch, in part because the changes are so big that it will treat everything as file deletions and add, losing history in the process. Aside from that though, it's just a good idea in general to make small changes. So this change only changes the names of the Stream related source files, and applies necessary source fix ups. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296211 91177308-0d34-0410-b5e6-96231b3b80d8
46 lines
1.5 KiB
C++
46 lines
1.5 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/BinaryStreamReader.h"
|
|
|
|
using namespace llvm;
|
|
using namespace llvm::codeview;
|
|
using namespace llvm::msf;
|
|
|
|
ModuleSubstream::ModuleSubstream() : Kind(ModuleSubstreamKind::None) {}
|
|
|
|
ModuleSubstream::ModuleSubstream(ModuleSubstreamKind Kind,
|
|
ReadableStreamRef Data)
|
|
: Kind(Kind), Data(Data) {}
|
|
|
|
Error ModuleSubstream::initialize(ReadableStreamRef 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; }
|
|
|
|
ReadableStreamRef ModuleSubstream::getRecordData() const { return Data; }
|