summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/DebugInfo/PDB/Raw/GlobalsStream.cpp
blob: 31afc9200b1b5f2d92d7845168e7a1a6bba905a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//===- GlobalsStream.cpp - PDB Index of Symbols by Name ---- ----*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "GSI.h"
#include "llvm/DebugInfo/MSF/StreamReader.h"
#include "llvm/DebugInfo/PDB/Raw/GlobalsStream.h"
#include "llvm/Support/Error.h"
#include <algorithm>

using namespace llvm;
using namespace llvm::msf;
using namespace llvm::pdb;

GlobalsStream::GlobalsStream(std::unique_ptr<MappedBlockStream> Stream)
    : Stream(std::move(Stream)) {}

GlobalsStream::~GlobalsStream() = default;

Error GlobalsStream::reload() {
  StreamReader Reader(*Stream);

  const GSIHashHeader *HashHdr;
  if (auto EC = readGSIHashHeader(HashHdr, Reader))
    return EC;

  if (auto EC = readGSIHashRecords(HashRecords, HashHdr, Reader))
    return EC;

  if (auto EC = readGSIHashBuckets(HashBuckets, HashHdr, Reader))
    return EC;
  NumBuckets = HashBuckets.size();

  return Error::success();
}

Error GlobalsStream::commit() { return Error::success(); }
OpenPOWER on IntegriCloud