Home | History | Annotate | Download | only in Native
      1 //===- PublicsStream.h - PDB Public Symbol Stream -------- ------*- 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_PUBLICSSTREAM_H
     11 #define LLVM_DEBUGINFO_PDB_RAW_PUBLICSSTREAM_H
     12 
     13 #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
     14 #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
     15 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
     16 #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
     17 #include "llvm/DebugInfo/PDB/PDBTypes.h"
     18 #include "llvm/Support/BinaryStreamArray.h"
     19 #include "llvm/Support/Error.h"
     20 
     21 namespace llvm {
     22 namespace pdb {
     23 class DbiStream;
     24 struct GSIHashHeader;
     25 class PDBFile;
     26 
     27 class PublicsStream {
     28   struct HeaderInfo;
     29 
     30 public:
     31   PublicsStream(PDBFile &File, std::unique_ptr<msf::MappedBlockStream> Stream);
     32   ~PublicsStream();
     33   Error reload();
     34 
     35   uint32_t getSymHash() const;
     36   uint32_t getAddrMap() const;
     37   uint32_t getNumBuckets() const { return NumBuckets; }
     38   Expected<const codeview::CVSymbolArray &> getSymbolArray() const;
     39   iterator_range<codeview::CVSymbolArray::Iterator>
     40   getSymbols(bool *HadError) const;
     41   FixedStreamArray<support::ulittle32_t> getHashBuckets() const {
     42     return HashBuckets;
     43   }
     44   FixedStreamArray<support::ulittle32_t> getAddressMap() const {
     45     return AddressMap;
     46   }
     47   FixedStreamArray<support::ulittle32_t> getThunkMap() const {
     48     return ThunkMap;
     49   }
     50   FixedStreamArray<SectionOffset> getSectionOffsets() const {
     51     return SectionOffsets;
     52   }
     53 
     54   Error commit();
     55 
     56 private:
     57   PDBFile &Pdb;
     58 
     59   std::unique_ptr<msf::MappedBlockStream> Stream;
     60   uint32_t NumBuckets = 0;
     61   ArrayRef<uint8_t> Bitmap;
     62   FixedStreamArray<PSHashRecord> HashRecords;
     63   FixedStreamArray<support::ulittle32_t> HashBuckets;
     64   FixedStreamArray<support::ulittle32_t> AddressMap;
     65   FixedStreamArray<support::ulittle32_t> ThunkMap;
     66   FixedStreamArray<SectionOffset> SectionOffsets;
     67 
     68   const HeaderInfo *Header;
     69   const GSIHashHeader *HashHdr;
     70 };
     71 }
     72 }
     73 
     74 #endif
     75