[Alignment][NFC] Convert StoreInst to MaybeAlign
[llvm-complete.git] / include / llvm / DebugInfo / PDB / Native / InfoStreamBuilder.h
blob208a37c45d4988d23f35de6b45368430bb0c4c0b
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_PDB_RAW_PDBINFOSTREAMBUILDER_H
10 #define LLVM_DEBUGINFO_PDB_RAW_PDBINFOSTREAMBUILDER_H
12 #include "llvm/ADT/Optional.h"
13 #include "llvm/Support/Error.h"
15 #include "llvm/DebugInfo/PDB/Native/NamedStreamMap.h"
16 #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
17 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
18 #include "llvm/DebugInfo/PDB/PDBTypes.h"
20 namespace llvm {
21 class WritableBinaryStreamRef;
23 namespace msf {
24 class MSFBuilder;
26 namespace pdb {
27 class PDBFile;
28 class NamedStreamMap;
30 class InfoStreamBuilder {
31 public:
32 InfoStreamBuilder(msf::MSFBuilder &Msf, NamedStreamMap &NamedStreams);
33 InfoStreamBuilder(const InfoStreamBuilder &) = delete;
34 InfoStreamBuilder &operator=(const InfoStreamBuilder &) = delete;
36 void setVersion(PdbRaw_ImplVer V);
37 void addFeature(PdbRaw_FeatureSig Sig);
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);
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);
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; }
53 uint32_t finalize();
55 Error finalizeMsfLayout();
57 Error commit(const msf::MSFLayout &Layout,
58 WritableBinaryStreamRef Buffer) const;
60 private:
61 msf::MSFBuilder &Msf;
63 std::vector<PdbRaw_FeatureSig> Features;
64 PdbRaw_ImplVer Ver;
65 uint32_t Age;
66 Optional<uint32_t> Signature;
67 codeview::GUID Guid;
69 bool HashPDBContentsToGUID = false;
71 NamedStreamMap &NamedStreams;
76 #endif