]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r302418, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / DebugInfo / PDB / Native / GlobalsStream.cpp
1 //===- GlobalsStream.cpp - PDB Index of Symbols by Name ---- ----*- 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 #include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
11 #include "GSI.h"
12 #include "llvm/Support/BinaryStreamReader.h"
13 #include "llvm/Support/Error.h"
14 #include <algorithm>
15
16 using namespace llvm;
17 using namespace llvm::msf;
18 using namespace llvm::pdb;
19
20 GlobalsStream::GlobalsStream(std::unique_ptr<MappedBlockStream> Stream)
21     : Stream(std::move(Stream)) {}
22
23 GlobalsStream::~GlobalsStream() = default;
24
25 Error GlobalsStream::reload() {
26   BinaryStreamReader Reader(*Stream);
27
28   const GSIHashHeader *HashHdr;
29   if (auto EC = readGSIHashHeader(HashHdr, Reader))
30     return EC;
31
32   if (auto EC = readGSIHashRecords(HashRecords, HashHdr, Reader))
33     return EC;
34
35   if (auto EC = readGSIHashBuckets(HashBuckets, HashHdr, Reader))
36     return EC;
37   NumBuckets = HashBuckets.size();
38
39   return Error::success();
40 }
41
42 Error GlobalsStream::commit() { return Error::success(); }