LLVM  6.0.0svn
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 
20 
21 using namespace llvm;
22 using namespace llvm::codeview;
23 using namespace llvm::msf;
24 using namespace llvm::pdb;
25 
26 InfoStreamBuilder::InfoStreamBuilder(msf::MSFBuilder &Msf,
27  NamedStreamMap &NamedStreams)
28  : Msf(Msf), Ver(PdbRaw_ImplVer::PdbImplVC70), Sig(-1), Age(0),
29  NamedStreams(NamedStreams) {}
30 
32 
34 
35 void InfoStreamBuilder::setAge(uint32_t A) { Age = A; }
36 
38 
40  Features.push_back(Sig);
41 }
42 
44  uint32_t Length = sizeof(InfoStreamHeader) + NamedStreams.finalize() +
45  (Features.size() + 1) * sizeof(uint32_t);
46  if (auto EC = Msf.setStreamSize(StreamPDB, Length))
47  return EC;
48  return Error::success();
49 }
50 
52  WritableBinaryStreamRef Buffer) const {
53  auto InfoS = WritableMappedBlockStream::createIndexedStream(
54  Layout, Buffer, StreamPDB, Msf.getAllocator());
55  BinaryStreamWriter Writer(*InfoS);
56 
58  H.Age = Age;
59  H.Signature = Sig;
60  H.Version = Ver;
61  H.Guid = Guid;
62  if (auto EC = Writer.writeObject(H))
63  return EC;
64 
65  if (auto EC = NamedStreams.commit(Writer))
66  return EC;
67  if (auto EC = Writer.writeInteger(0))
68  return EC;
69  for (auto E : Features) {
70  if (auto EC = Writer.writeEnum(E))
71  return EC;
72  }
73  return Error::success();
74 }
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
support::ulittle32_t Version
Definition: RawTypes.h:316
void setGuid(codeview::GUID G)
support::ulittle32_t Signature
Definition: RawTypes.h:317
This represents the 'GUID' type from windows.h.
Definition: GUID.h:22
void setVersion(PdbRaw_ImplVer V)
support::ulittle32_t Age
Definition: RawTypes.h:318
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define H(x, y, z)
Definition: MD5.cpp:57
Provides write only access to a subclass of WritableBinaryStream.
Error setStreamSize(uint32_t Idx, uint32_t Size)
Update the size of an existing stream.
Definition: MSFBuilder.cpp:188
Error commit(BinaryStreamWriter &Writer) const
static ErrorSuccess success()
Create a success value.
Definition: Error.h:313
const DataFlowGraph & G
Definition: RDFGraph.cpp:211
The header preceeding the global PDB Stream (Stream 1)
Definition: RawTypes.h:315
Error commit(const msf::MSFLayout &Layout, WritableBinaryStreamRef Buffer) const
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
void addFeature(PdbRaw_FeatureSig Sig)
BumpPtrAllocator & getAllocator()
Definition: MSFBuilder.h:114