Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:44

0001 //===- InfoStreamBuilder.h - PDB Info Stream Creation -----------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_DEBUGINFO_PDB_NATIVE_INFOSTREAMBUILDER_H
0010 #define LLVM_DEBUGINFO_PDB_NATIVE_INFOSTREAMBUILDER_H
0011 
0012 #include "llvm/Support/Error.h"
0013 
0014 #include "llvm/DebugInfo/CodeView/GUID.h"
0015 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
0016 
0017 namespace llvm {
0018 class WritableBinaryStreamRef;
0019 
0020 namespace msf {
0021 class MSFBuilder;
0022 struct MSFLayout;
0023 }
0024 namespace pdb {
0025 class NamedStreamMap;
0026 
0027 class InfoStreamBuilder {
0028 public:
0029   InfoStreamBuilder(msf::MSFBuilder &Msf, NamedStreamMap &NamedStreams);
0030   InfoStreamBuilder(const InfoStreamBuilder &) = delete;
0031   InfoStreamBuilder &operator=(const InfoStreamBuilder &) = delete;
0032 
0033   void setVersion(PdbRaw_ImplVer V);
0034   void addFeature(PdbRaw_FeatureSig Sig);
0035 
0036   // If this is true, the PDB contents are hashed and this hash is used as
0037   // PDB GUID and as Signature. The age is always 1.
0038   void setHashPDBContentsToGUID(bool B);
0039 
0040   // These only have an effect if hashPDBContentsToGUID() is false.
0041   void setSignature(uint32_t S);
0042   void setAge(uint32_t A);
0043   void setGuid(codeview::GUID G);
0044 
0045   bool hashPDBContentsToGUID() const { return HashPDBContentsToGUID; }
0046   uint32_t getAge() const { return Age; }
0047   codeview::GUID getGuid() const { return Guid; }
0048   std::optional<uint32_t> getSignature() const { return Signature; }
0049 
0050   uint32_t finalize();
0051 
0052   Error finalizeMsfLayout();
0053 
0054   Error commit(const msf::MSFLayout &Layout,
0055                WritableBinaryStreamRef Buffer) const;
0056 
0057 private:
0058   msf::MSFBuilder &Msf;
0059 
0060   std::vector<PdbRaw_FeatureSig> Features;
0061   PdbRaw_ImplVer Ver;
0062   uint32_t Age;
0063   std::optional<uint32_t> Signature;
0064   codeview::GUID Guid;
0065 
0066   bool HashPDBContentsToGUID = false;
0067 
0068   NamedStreamMap &NamedStreams;
0069 };
0070 } // namespace pdb
0071 }
0072 
0073 #endif