1 //===- InfoStreamBuilder.h - PDB Info Stream Creation -----------*- C++ -*-===//
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
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"
21 class WritableBinaryStreamRef
;
30 class InfoStreamBuilder
{
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
; }
55 Error
finalizeMsfLayout();
57 Error
commit(const msf::MSFLayout
&Layout
,
58 WritableBinaryStreamRef Buffer
) const;
63 std::vector
<PdbRaw_FeatureSig
> Features
;
66 Optional
<uint32_t> Signature
;
69 bool HashPDBContentsToGUID
= false;
71 NamedStreamMap
&NamedStreams
;