ModuleDebugStream.h revision 320572
196643Sobrien//===- ModuleDebugStream.h - PDB Module Info Stream Access ------*- C++ -*-===//
296643Sobrien//
396643Sobrien//                     The LLVM Compiler Infrastructure
496643Sobrien//
596643Sobrien// This file is distributed under the University of Illinois Open Source
6160819Ssimon// License. See LICENSE.TXT for details.
7160819Ssimon//
8162915Ssimon//===----------------------------------------------------------------------===//
9162915Ssimon
10162915Ssimon#ifndef LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
11162915Ssimon#define LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
12194207Ssimon
13194207Ssimon#include "llvm/ADT/iterator_range.h"
14194207Ssimon#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
15194207Ssimon#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
16194207Ssimon#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
17194207Ssimon#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
18194207Ssimon#include "llvm/Support/BinaryStreamRef.h"
19194207Ssimon#include "llvm/Support/Error.h"
20194207Ssimon#include <cstdint>
21194207Ssimon#include <memory>
22194207Ssimon
23194207Ssimonnamespace llvm {
24160819Ssimonnamespace pdb {
25160819Ssimon
26160819Ssimonclass DbiModuleDescriptor;
27160819Ssimon
28160819Ssimonclass ModuleDebugStreamRef {
29160819Ssimon  using DebugSubsectionIterator = codeview::DebugSubsectionArray::Iterator;
30160819Ssimon
31160819Ssimonpublic:
32160819Ssimon  ModuleDebugStreamRef(const DbiModuleDescriptor &Module,
33160819Ssimon                       std::unique_ptr<msf::MappedBlockStream> Stream);
34160819Ssimon  ModuleDebugStreamRef(ModuleDebugStreamRef &&Other) = default;
35160819Ssimon  ~ModuleDebugStreamRef();
36160819Ssimon
37160819Ssimon  Error reload();
38160819Ssimon
39160819Ssimon  uint32_t signature() const { return Signature; }
40160819Ssimon
41160819Ssimon  iterator_range<codeview::CVSymbolArray::Iterator>
42160819Ssimon  symbols(bool *HadError) const;
43160819Ssimon
44160819Ssimon  const codeview::CVSymbolArray &getSymbolArray() const { return SymbolArray; }
4596643Sobrien
46160819Ssimon  BinarySubstreamRef getSymbolsSubstream() const;
47160819Ssimon  BinarySubstreamRef getC11LinesSubstream() const;
4896643Sobrien  BinarySubstreamRef getC13LinesSubstream() const;
49160819Ssimon  BinarySubstreamRef getGlobalRefsSubstream() const;
50160819Ssimon
51160819Ssimon  ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = default;
52160819Ssimon
5396643Sobrien  iterator_range<DebugSubsectionIterator> subsections() const;
5496643Sobrien
5596643Sobrien  bool hasDebugSubsections() const;
5696643Sobrien
5796643Sobrien  Error commit();
5896643Sobrien
5996643Sobrien  Expected<codeview::DebugChecksumsSubsectionRef>
6096643Sobrien  findChecksumsSubsection() const;
6196643Sobrien
6296643Sobrienprivate:
6396643Sobrien  const DbiModuleDescriptor &Mod;
6496643Sobrien
6596643Sobrien  uint32_t Signature;
66160819Ssimon
6796643Sobrien  std::shared_ptr<msf::MappedBlockStream> Stream;
6896643Sobrien
6996643Sobrien  codeview::CVSymbolArray SymbolArray;
7096643Sobrien
71160819Ssimon  BinarySubstreamRef SymbolsSubstream;
7296643Sobrien  BinarySubstreamRef C11LinesSubstream;
7396643Sobrien  BinarySubstreamRef C13LinesSubstream;
74160819Ssimon  BinarySubstreamRef GlobalRefsSubstream;
75160819Ssimon
7696643Sobrien  codeview::DebugSubsectionArray Subsections;
7796643Sobrien};
7896643Sobrien
7996643Sobrien} // end namespace pdb
8096643Sobrien} // end namespace llvm
8196643Sobrien
8296643Sobrien#endif // LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
8396643Sobrien