Home | History | Annotate | Download | only in Raw
      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/Optional.h"
     15 #include "llvm/Support/Endian.h"
     16 #include "llvm/Support/Error.h"
     17 
     18 #include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
     19 
     20 #include <memory>
     21 #include <vector>
     22 
     23 namespace llvm {
     24 namespace codeview {
     25 class StreamInterface;
     26 }
     27 namespace pdb {
     28 class DbiStreamBuilder;
     29 class InfoStreamBuilder;
     30 class PDBFile;
     31 
     32 class PDBFileBuilder {
     33 public:
     34   explicit PDBFileBuilder(
     35       std::unique_ptr<codeview::StreamInterface> PdbFileBuffer);
     36   PDBFileBuilder(const PDBFileBuilder &) = delete;
     37   PDBFileBuilder &operator=(const PDBFileBuilder &) = delete;
     38 
     39   Error setSuperBlock(const PDBFile::SuperBlock &B);
     40   void setStreamSizes(ArrayRef<support::ulittle32_t> S);
     41   void setDirectoryBlocks(ArrayRef<support::ulittle32_t> D);
     42   void setStreamMap(const std::vector<ArrayRef<support::ulittle32_t>> &S);
     43   Error generateSimpleStreamMap();
     44 
     45   InfoStreamBuilder &getInfoBuilder();
     46   DbiStreamBuilder &getDbiBuilder();
     47 
     48   Expected<std::unique_ptr<PDBFile>> build();
     49 
     50 private:
     51   std::unique_ptr<codeview::StreamInterface> PdbFileBuffer;
     52   std::unique_ptr<InfoStreamBuilder> Info;
     53   std::unique_ptr<DbiStreamBuilder> Dbi;
     54 
     55   std::unique_ptr<PDBFile> File;
     56 };
     57 }
     58 }
     59 
     60 #endif
     61