LLVM  15.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 
17 
18 namespace llvm {
19 class WritableBinaryStreamRef;
20 
21 namespace msf {
22 class MSFBuilder;
23 struct MSFLayout;
24 }
25 namespace pdb {
26 class NamedStreamMap;
27 
29 public:
31  InfoStreamBuilder(const InfoStreamBuilder &) = delete;
33 
34  void setVersion(PdbRaw_ImplVer V);
35  void addFeature(PdbRaw_FeatureSig Sig);
36 
37  // If this is true, the PDB contents are hashed and this hash is used as
38  // PDB GUID and as Signature. The age is always 1.
39  void setHashPDBContentsToGUID(bool B);
40 
41  // These only have an effect if hashPDBContentsToGUID() is false.
42  void setSignature(uint32_t S);
43  void setAge(uint32_t A);
44  void setGuid(codeview::GUID G);
45 
46  bool hashPDBContentsToGUID() const { return HashPDBContentsToGUID; }
47  uint32_t getAge() const { return Age; }
48  codeview::GUID getGuid() const { return Guid; }
49  Optional<uint32_t> getSignature() const { return Signature; }
50 
52 
54 
55  Error commit(const msf::MSFLayout &Layout,
56  WritableBinaryStreamRef Buffer) const;
57 
58 private:
59  msf::MSFBuilder &Msf;
60 
61  std::vector<PdbRaw_FeatureSig> Features;
62  PdbRaw_ImplVer Ver;
63  uint32_t Age;
64  Optional<uint32_t> Signature;
65  codeview::GUID Guid;
66 
67  bool HashPDBContentsToGUID = false;
68 
69  NamedStreamMap &NamedStreams;
70 };
71 } // namespace pdb
72 }
73 
74 #endif
RawConstants.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
GUID.h
Optional.h
llvm::pdb::InfoStreamBuilder::setHashPDBContentsToGUID
void setHashPDBContentsToGUID(bool B)
Definition: InfoStreamBuilder.cpp:36
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:44
llvm::pdb::InfoStreamBuilder::setAge
void setAge(uint32_t A)
Definition: InfoStreamBuilder.cpp:40
llvm::msf::MSFBuilder
Definition: MSFBuilder.h:27
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:30
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::pdb::InfoStreamBuilder
Definition: InfoStreamBuilder.h:28
llvm::pdb::InfoStreamBuilder::hashPDBContentsToGUID
bool hashPDBContentsToGUID() const
Definition: InfoStreamBuilder.h:46
llvm::pdb::InfoStreamBuilder::finalize
uint32_t finalize()
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:200
llvm::pdb::InfoStreamBuilder::getAge
uint32_t getAge() const
Definition: InfoStreamBuilder.h:47
llvm::pdb::InfoStreamBuilder::getSignature
Optional< uint32_t > getSignature() const
Definition: InfoStreamBuilder.h:49
llvm::pdb::NamedStreamMap
Definition: NamedStreamMap.h:36
llvm::pdb::InfoStreamBuilder::addFeature
void addFeature(PdbRaw_FeatureSig Sig)
Definition: InfoStreamBuilder.cpp:32
llvm::pdb::InfoStreamBuilder::operator=
InfoStreamBuilder & operator=(const InfoStreamBuilder &)=delete
llvm::pdb::InfoStreamBuilder::setSignature
void setSignature(uint32_t S)
Definition: InfoStreamBuilder.cpp:42
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:155
llvm::pdb::InfoStreamBuilder::finalizeMsfLayout
Error finalizeMsfLayout()
Definition: InfoStreamBuilder.cpp:47
llvm::pdb::InfoStreamBuilder::commit
Error commit(const msf::MSFLayout &Layout, WritableBinaryStreamRef Buffer) const
Definition: InfoStreamBuilder.cpp:56
llvm::pdb::InfoStreamBuilder::InfoStreamBuilder
InfoStreamBuilder(msf::MSFBuilder &Msf, NamedStreamMap &NamedStreams)
Definition: InfoStreamBuilder.cpp:23
llvm::pdb::InfoStreamBuilder::getGuid
codeview::GUID getGuid() const
Definition: InfoStreamBuilder.h:48
llvm::WritableBinaryStreamRef
Definition: BinaryStreamRef.h:220