LCOV - code coverage report
Current view: top level - include/llvm/DebugInfo/PDB/Native - PDBFileBuilder.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 0 1 0.0 %
Date: 2018-10-20 13:21:21 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- PDBFileBuilder.h - PDB File Creation ---------------------*- C++ -*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : 
      10             : #ifndef LLVM_DEBUGINFO_PDB_RAW_PDBFILEBUILDER_H
      11             : #define LLVM_DEBUGINFO_PDB_RAW_PDBFILEBUILDER_H
      12             : 
      13             : #include "llvm/ADT/ArrayRef.h"
      14             : #include "llvm/ADT/BitVector.h"
      15             : #include "llvm/ADT/Optional.h"
      16             : #include "llvm/DebugInfo/PDB/Native/NamedStreamMap.h"
      17             : #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
      18             : #include "llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h"
      19             : #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
      20             : #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
      21             : #include "llvm/Support/Allocator.h"
      22             : #include "llvm/Support/Endian.h"
      23             : #include "llvm/Support/Error.h"
      24             : #include "llvm/Support/MemoryBuffer.h"
      25             : 
      26             : #include <memory>
      27             : #include <vector>
      28             : 
      29             : namespace llvm {
      30             : namespace msf {
      31             : class MSFBuilder;
      32             : }
      33             : namespace pdb {
      34             : class DbiStreamBuilder;
      35             : class InfoStreamBuilder;
      36             : class GSIStreamBuilder;
      37             : class TpiStreamBuilder;
      38             : 
      39             : class PDBFileBuilder {
      40             : public:
      41             :   explicit PDBFileBuilder(BumpPtrAllocator &Allocator);
      42             :   ~PDBFileBuilder();
      43             :   PDBFileBuilder(const PDBFileBuilder &) = delete;
      44             :   PDBFileBuilder &operator=(const PDBFileBuilder &) = delete;
      45             : 
      46             :   Error initialize(uint32_t BlockSize);
      47             : 
      48             :   msf::MSFBuilder &getMsfBuilder();
      49             :   InfoStreamBuilder &getInfoBuilder();
      50             :   DbiStreamBuilder &getDbiBuilder();
      51             :   TpiStreamBuilder &getTpiBuilder();
      52             :   TpiStreamBuilder &getIpiBuilder();
      53             :   PDBStringTableBuilder &getStringTableBuilder();
      54             :   GSIStreamBuilder &getGsiBuilder();
      55             : 
      56             :   // If HashPDBContentsToGUID is true on the InfoStreamBuilder, Guid is filled
      57             :   // with the computed PDB GUID on return.
      58             :   Error commit(StringRef Filename, codeview::GUID *Guid);
      59             : 
      60             :   Expected<uint32_t> getNamedStreamIndex(StringRef Name) const;
      61             :   Error addNamedStream(StringRef Name, StringRef Data);
      62             :   void addInjectedSource(StringRef Name, std::unique_ptr<MemoryBuffer> Buffer);
      63             : 
      64             : private:
      65           0 :   struct InjectedSourceDescriptor {
      66             :     // The full name of the stream that contains the contents of this injected
      67             :     // source.  This is built as a concatenation of the literal "/src/files"
      68             :     // plus the "vname".
      69             :     std::string StreamName;
      70             : 
      71             :     // The exact name of the file name as specified by the user.
      72             :     uint32_t NameIndex;
      73             : 
      74             :     // The string table index of the "vname" of the file.  As far as we
      75             :     // understand, this is the same as the name, except it is lowercased and
      76             :     // forward slashes are converted to backslashes.
      77             :     uint32_t VNameIndex;
      78             :     std::unique_ptr<MemoryBuffer> Content;
      79             :   };
      80             : 
      81             :   Error finalizeMsfLayout();
      82             :   Expected<uint32_t> allocateNamedStream(StringRef Name, uint32_t Size);
      83             : 
      84             :   void commitFpm(WritableBinaryStream &MsfBuffer, const msf::MSFLayout &Layout);
      85             :   void commitInjectedSources(WritableBinaryStream &MsfBuffer,
      86             :                              const msf::MSFLayout &Layout);
      87             :   void commitSrcHeaderBlock(WritableBinaryStream &MsfBuffer,
      88             :                             const msf::MSFLayout &Layout);
      89             : 
      90             :   BumpPtrAllocator &Allocator;
      91             : 
      92             :   std::unique_ptr<msf::MSFBuilder> Msf;
      93             :   std::unique_ptr<InfoStreamBuilder> Info;
      94             :   std::unique_ptr<DbiStreamBuilder> Dbi;
      95             :   std::unique_ptr<GSIStreamBuilder> Gsi;
      96             :   std::unique_ptr<TpiStreamBuilder> Tpi;
      97             :   std::unique_ptr<TpiStreamBuilder> Ipi;
      98             : 
      99             :   PDBStringTableBuilder Strings;
     100             :   StringTableHashTraits InjectedSourceHashTraits;
     101             :   HashTable<SrcHeaderBlockEntry, StringTableHashTraits> InjectedSourceTable;
     102             : 
     103             :   SmallVector<InjectedSourceDescriptor, 2> InjectedSources;
     104             : 
     105             :   NamedStreamMap NamedStreams;
     106             :   DenseMap<uint32_t, std::string> NamedStreamData;
     107             : };
     108             : }
     109             : }
     110             : 
     111             : #endif

Generated by: LCOV version 1.13