LLVM  10.0.0svn
InfoStreamBuilder.h
Go to the documentation of this file.
1 //===- InfoStreamBuilder.h - PDB Info Stream Creation -----------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_DEBUGINFO_PDB_RAW_PDBINFOSTREAMBUILDER_H
10 #define LLVM_DEBUGINFO_PDB_RAW_PDBINFOSTREAMBUILDER_H
11 
12 #include "llvm/ADT/Optional.h"
13 #include "llvm/Support/Error.h"
14 
19 
20 namespace llvm {
21 class WritableBinaryStreamRef;
22 
23 namespace msf {
24 class MSFBuilder;
25 }
26 namespace pdb {
27 class PDBFile;
28 class NamedStreamMap;
29 
31 public:
33  InfoStreamBuilder(const InfoStreamBuilder &) = delete;
34  InfoStreamBuilder &operator=(const InfoStreamBuilder &) = delete;
35 
36  void setVersion(PdbRaw_ImplVer V);
37  void addFeature(PdbRaw_FeatureSig Sig);
38 
39  // If this is true, the PDB contents are hashed and this hash is used as
40  // PDB GUID and as Signature. The age is always 1.
41  void setHashPDBContentsToGUID(bool B);
42 
43  // These only have an effect if hashPDBContentsToGUID() is false.
44  void setSignature(uint32_t S);
45  void setAge(uint32_t A);
46  void setGuid(codeview::GUID G);
47 
48  bool hashPDBContentsToGUID() const { return HashPDBContentsToGUID; }
49  uint32_t getAge() const { return Age; }
50  codeview::GUID getGuid() const { return Guid; }
51  Optional<uint32_t> getSignature() const { return Signature; }
52 
54 
55  Error finalizeMsfLayout();
56 
57  Error commit(const msf::MSFLayout &Layout,
58  WritableBinaryStreamRef Buffer) const;
59 
60 private:
61  msf::MSFBuilder &Msf;
62 
63  std::vector<PdbRaw_FeatureSig> Features;
64  PdbRaw_ImplVer Ver;
65  uint32_t Age;
66  Optional<uint32_t> Signature;
67  codeview::GUID Guid;
68 
69  bool HashPDBContentsToGUID = false;
70 
71  NamedStreamMap &NamedStreams;
72 };
73 }
74 }
75 
76 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
arc branch finalize
Optional< uint32_t > getSignature() const
This represents the &#39;GUID&#39; type from windows.h.
Definition: GUID.h:21
codeview::GUID getGuid() const
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
const DataFlowGraph & G
Definition: RDFGraph.cpp:202
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157