LLVM  14.0.0git
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_NATIVE_INFOSTREAMBUILDER_H
10 #define LLVM_DEBUGINFO_PDB_NATIVE_INFOSTREAMBUILDER_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;
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 
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
RawConstants.h
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
Optional.h
NamedStreamMap.h
llvm::pdb::InfoStreamBuilder::setHashPDBContentsToGUID
void setHashPDBContentsToGUID(bool B)
Definition: InfoStreamBuilder.cpp:38
llvm::codeview::GUID
This represents the 'GUID' type from windows.h.
Definition: GUID.h:21
Error.h
llvm::Optional< uint32_t >
llvm::pdb::InfoStreamBuilder::setGuid
void setGuid(codeview::GUID G)
Definition: InfoStreamBuilder.cpp:46
llvm::pdb::InfoStreamBuilder::setAge
void setAge(uint32_t A)
Definition: InfoStreamBuilder.cpp:42
llvm::msf::MSFBuilder
Definition: MSFBuilder.h:26
llvm::pdb::PdbRaw_FeatureSig
PdbRaw_FeatureSig
Definition: RawConstants.h:36
llvm::msf::MSFLayout
Definition: MSFCommon.h:51
llvm::pdb::InfoStreamBuilder::setVersion
void setVersion(PdbRaw_ImplVer V)
Definition: InfoStreamBuilder.cpp:32
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::pdb::InfoStreamBuilder
Definition: InfoStreamBuilder.h:30
llvm::pdb::InfoStreamBuilder::hashPDBContentsToGUID
bool hashPDBContentsToGUID() const
Definition: InfoStreamBuilder.h:48
PDBTypes.h
llvm::pdb::InfoStreamBuilder::finalize
uint32_t finalize()
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:202
llvm::pdb::InfoStreamBuilder::getAge
uint32_t getAge() const
Definition: InfoStreamBuilder.h:49
llvm::pdb::InfoStreamBuilder::getSignature
Optional< uint32_t > getSignature() const
Definition: InfoStreamBuilder.h:51
llvm::pdb::NamedStreamMap
Definition: NamedStreamMap.h:37
llvm::pdb::InfoStreamBuilder::addFeature
void addFeature(PdbRaw_FeatureSig Sig)
Definition: InfoStreamBuilder.cpp:34
llvm::pdb::InfoStreamBuilder::operator=
InfoStreamBuilder & operator=(const InfoStreamBuilder &)=delete
llvm::pdb::InfoStreamBuilder::setSignature
void setSignature(uint32_t S)
Definition: InfoStreamBuilder.cpp:44
uint32_t
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::pdb::PdbRaw_ImplVer
PdbRaw_ImplVer
Definition: RawConstants.h:21
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::pdb::InfoStreamBuilder::finalizeMsfLayout
Error finalizeMsfLayout()
Definition: InfoStreamBuilder.cpp:49
llvm::pdb::InfoStreamBuilder::commit
Error commit(const msf::MSFLayout &Layout, WritableBinaryStreamRef Buffer) const
Definition: InfoStreamBuilder.cpp:58
PDBFile.h
llvm::pdb::InfoStreamBuilder::InfoStreamBuilder
InfoStreamBuilder(msf::MSFBuilder &Msf, NamedStreamMap &NamedStreams)
Definition: InfoStreamBuilder.cpp:25
llvm::pdb::InfoStreamBuilder::getGuid
codeview::GUID getGuid() const
Definition: InfoStreamBuilder.h:50
llvm::WritableBinaryStreamRef
Definition: BinaryStreamRef.h:221