Home | History | Annotate | Download | only in Raw
      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/StreamArray.h"
     14 #include "llvm/DebugInfo/CodeView/StreamRef.h"
     15 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
     16 #include "llvm/DebugInfo/PDB/PDBTypes.h"
     17 #include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
     18 #include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
     19 #include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
     20 #include "llvm/Support/raw_ostream.h"
     21 
     22 #include "llvm/Support/Error.h"
     23 
     24 namespace llvm {
     25 namespace pdb {
     26 class PDBFile;
     27 
     28 class TpiStream {
     29   struct HeaderInfo;
     30 
     31 public:
     32   TpiStream(const PDBFile &File, std::unique_ptr<MappedBlockStream> Stream);
     33   ~TpiStream();
     34   Error reload();
     35 
     36   PdbRaw_TpiVer getTpiVersion() const;
     37 
     38   uint32_t TypeIndexBegin() const;
     39   uint32_t TypeIndexEnd() const;
     40   uint32_t NumTypeRecords() const;
     41   uint16_t getTypeHashStreamIndex() const;
     42   uint16_t getTypeHashStreamAuxIndex() const;
     43 
     44   uint32_t getHashKeySize() const;
     45   uint32_t NumHashBuckets() const;
     46   codeview::FixedStreamArray<support::ulittle32_t> getHashValues() const;
     47   codeview::FixedStreamArray<TypeIndexOffset> getTypeIndexOffsets() const;
     48   codeview::FixedStreamArray<TypeIndexOffset> getHashAdjustments() const;
     49 
     50   iterator_range<codeview::CVTypeArray::Iterator> types(bool *HadError) const;
     51 
     52   Error commit();
     53 
     54 private:
     55   Error verifyHashValues();
     56 
     57   const PDBFile &Pdb;
     58   std::unique_ptr<MappedBlockStream> Stream;
     59 
     60   codeview::CVTypeArray TypeRecords;
     61 
     62   std::unique_ptr<MappedBlockStream> HashStream;
     63   codeview::FixedStreamArray<support::ulittle32_t> HashValues;
     64   codeview::FixedStreamArray<TypeIndexOffset> TypeIndexOffsets;
     65   codeview::FixedStreamArray<TypeIndexOffset> HashAdjustments;
     66 
     67   const HeaderInfo *Header;
     68 };
     69 }
     70 }
     71 
     72 #endif
     73