Home | History | Annotate | Download | only in Native
      1 //===- TpiStream.cpp - PDB Type Info (TPI) Stream 2 Access ------*- 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_PDBTPISTREAM_H
     11 #define LLVM_DEBUGINFO_PDB_RAW_PDBTPISTREAM_H
     12 
     13 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
     14 #include "llvm/DebugInfo/PDB/Native/HashTable.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/raw_ostream.h"
     20 
     21 #include "llvm/Support/Error.h"
     22 
     23 namespace llvm {
     24 namespace msf {
     25 class MappedBlockStream;
     26 }
     27 namespace pdb {
     28 class PDBFile;
     29 
     30 class TpiStream {
     31   friend class TpiStreamBuilder;
     32 
     33 public:
     34   TpiStream(const PDBFile &File,
     35             std::unique_ptr<msf::MappedBlockStream> Stream);
     36   ~TpiStream();
     37   Error reload();
     38 
     39   PdbRaw_TpiVer getTpiVersion() const;
     40 
     41   uint32_t TypeIndexBegin() const;
     42   uint32_t TypeIndexEnd() const;
     43   uint32_t NumTypeRecords() const;
     44   uint16_t getTypeHashStreamIndex() const;
     45   uint16_t getTypeHashStreamAuxIndex() const;
     46 
     47   uint32_t getHashKeySize() const;
     48   uint32_t NumHashBuckets() const;
     49   FixedStreamArray<support::ulittle32_t> getHashValues() const;
     50   FixedStreamArray<TypeIndexOffset> getTypeIndexOffsets() const;
     51   HashTable &getHashAdjusters();
     52 
     53   codeview::CVTypeRange types(bool *HadError) const;
     54 
     55   Error commit();
     56 
     57 private:
     58   Error verifyHashValues();
     59 
     60   const PDBFile &Pdb;
     61   std::unique_ptr<msf::MappedBlockStream> Stream;
     62 
     63   codeview::CVTypeArray TypeRecords;
     64 
     65   std::unique_ptr<BinaryStream> HashStream;
     66   FixedStreamArray<support::ulittle32_t> HashValues;
     67   FixedStreamArray<TypeIndexOffset> TypeIndexOffsets;
     68   HashTable HashAdjusters;
     69 
     70   const TpiStreamHeader *Header;
     71 };
     72 }
     73 }
     74 
     75 #endif
     76