LLVM  4.0.0
GlobalsStream.cpp
Go to the documentation of this file.
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 "GSI.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 
24 
26  StreamReader 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 
Error readGSIHashBuckets(msf::FixedStreamArray< support::ulittle32_t > &HashBuckets, const GSIHashHeader *HashHdr, msf::StreamReader &Reader)
Definition: GSI.cpp:31
Header of the hash tables found in the globals and publics sections.
Definition: GSI.h:48
uint32_t size() const
Definition: StreamArray.h:233
Error readGSIHashHeader(const GSIHashHeader *&HashHdr, msf::StreamReader &Reader)
Definition: GSI.cpp:59
static ErrorSuccess success()
Create a success value.
Lightweight error class with error context and mandatory checking.
Error readGSIHashRecords(msf::FixedStreamArray< PSHashRecord > &HashRecords, const GSIHashHeader *HashHdr, msf::StreamReader &Reader)
Definition: GSI.cpp:73