LLVM  4.0.0
InfoStreamBuilder.cpp
Go to the documentation of this file.
1 //===- InfoStreamBuilder.cpp - PDB Info Stream Creation ---------*- 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 
18 
19 using namespace llvm;
20 using namespace llvm::codeview;
21 using namespace llvm::msf;
22 using namespace llvm::pdb;
23 
24 InfoStreamBuilder::InfoStreamBuilder(msf::MSFBuilder &Msf)
25  : Msf(Msf), Ver(PdbRaw_ImplVer::PdbImplVC70), Sig(-1), Age(0) {}
26 
28 
30 
32 
34 
36  return NamedStreams;
37 }
38 
40  return sizeof(InfoStreamHeader) + NamedStreams.calculateSerializedLength();
41 }
42 
45  if (auto EC = Msf.setStreamSize(StreamPDB, Length))
46  return EC;
47  return Error::success();
48 }
49 
51  const msf::WritableStream &Buffer) const {
52  auto InfoS =
53  WritableMappedBlockStream::createIndexedStream(Layout, Buffer, StreamPDB);
54  StreamWriter Writer(*InfoS);
55 
57  H.Age = Age;
58  H.Signature = Sig;
59  H.Version = Ver;
60  H.Guid = Guid;
61  if (auto EC = Writer.writeObject(H))
62  return EC;
63 
64  return NamedStreams.commit(Writer);
65 }
support::ulittle32_t Version
Definition: RawTypes.h:299
NameMapBuilder & getNamedStreamsBuilder()
support::ulittle32_t Signature
Definition: RawTypes.h:300
Error writeObject(const T &Obj)
Definition: StreamWriter.h:49
void setVersion(PdbRaw_ImplVer V)
support::ulittle32_t Age
Definition: RawTypes.h:301
Defines a 128-bit unique identifier.
Definition: RawTypes.h:265
#define H(x, y, z)
Definition: MD5.cpp:53
Error setStreamSize(uint32_t Idx, uint32_t Size)
Update the size of an existing stream.
Definition: MSFBuilder.cpp:164
static ErrorSuccess success()
Create a success value.
const DataFlowGraph & G
Definition: RDFGraph.cpp:206
The header preceeding the global PDB Stream (Stream 1)
Definition: RawTypes.h:298
uint32_t calculateSerializedLength() const
Error commit(const msf::MSFLayout &Layout, const msf::WritableStream &Buffer) const
Error commit(msf::StreamWriter &Writer) const
Lightweight error class with error context and mandatory checking.
uint32_t calculateSerializedLength() const
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")