LLVM  4.0.0
ModuleSubstream.cpp
Go to the documentation of this file.
1 //===- ModuleSubstream.cpp --------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
11 
13 
14 using namespace llvm;
15 using namespace llvm::codeview;
16 using namespace llvm::msf;
17 
19 
21  ReadableStreamRef Data)
22  : Kind(Kind), Data(Data) {}
23 
25  ModuleSubstream &Info) {
26  const ModuleSubsectionHeader *Header;
27  StreamReader Reader(Stream);
28  if (auto EC = Reader.readObject(Header))
29  return EC;
30 
31  ModuleSubstreamKind Kind =
32  static_cast<ModuleSubstreamKind>(uint32_t(Header->Kind));
33  if (auto EC = Reader.readStreamRef(Info.Data, Header->Length))
34  return EC;
35  Info.Kind = Kind;
36  return Error::success();
37 }
38 
40  return sizeof(ModuleSubsectionHeader) + Data.getLength();
41 }
42 
44 
ModuleSubstreamKind getSubstreamKind() const
uint32_t getLength() const
Definition: StreamRef.h:29
static Error initialize(msf::ReadableStreamRef Stream, ModuleSubstream &Info)
static ErrorSuccess success()
Create a success value.
Error readStreamRef(ReadableStreamRef &Ref)
const unsigned Kind
msf::ReadableStreamRef getRecordData() const
Lightweight error class with error context and mandatory checking.
Error readObject(const T *&Dest)
Definition: StreamReader.h:53