diff options
author | Zachary Turner <zturner@google.com> | 2016-04-29 17:28:47 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-04-29 17:28:47 +0000 |
commit | 2f09b5091ce055dbc3a803ecb2576540d6abb503 (patch) | |
tree | 13a919a417b0870502c6b5c87daa56aa55ed803f /llvm/lib/DebugInfo/PDB/Raw/InfoStream.cpp | |
parent | 6ba65deeb9b017e4144cdae341dcb9e3564c7c7b (diff) | |
download | llvm-2f09b5091ce055dbc3a803ecb2576540d6abb503.zip llvm-2f09b5091ce055dbc3a803ecb2576540d6abb503.tar.gz llvm-2f09b5091ce055dbc3a803ecb2576540d6abb503.tar.bz2 |
Put PDB parsing code into a pdb namespace.
llvm-svn: 268072
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/InfoStream.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/InfoStream.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/InfoStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/InfoStream.cpp new file mode 100644 index 0000000..c1b4737 --- /dev/null +++ b/llvm/lib/DebugInfo/PDB/Raw/InfoStream.cpp @@ -0,0 +1,57 @@ +//===- InfoStream.cpp - PDB Info Stream (Stream 1) Access -------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/DebugInfo/PDB/Raw/InfoStream.h" +#include "llvm/ADT/BitVector.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/DebugInfo/PDB/Raw/StreamReader.h" + +using namespace llvm; +using namespace llvm::pdb; + +InfoStream::InfoStream(PDBFile &File) : Pdb(File), Stream(1, File) {} + +std::error_code InfoStream::reload() { + StreamReader Reader(Stream); + + support::ulittle32_t Value; + + Reader.readObject(&Value); + Version = Value; + if (Version < PdbRaw_ImplVer::PdbImplVC70) + return std::make_error_code(std::errc::not_supported); + + Reader.readObject(&Value); + Signature = Value; + + Reader.readObject(&Value); + Age = Value; + + Reader.readObject(&Guid); + NamedStreams.load(Reader); + + return std::error_code(); +} + +uint32_t InfoStream::getNamedStreamIndex(llvm::StringRef Name) const { + uint32_t Result; + if (!NamedStreams.tryGetValue(Name, Result)) + return 0; + return Result; +} + +PdbRaw_ImplVer InfoStream::getVersion() const { + return static_cast<PdbRaw_ImplVer>(Version); +} + +uint32_t InfoStream::getSignature() const { return Signature; } + +uint32_t InfoStream::getAge() const { return Age; } + +PDB_UniqueId InfoStream::getGuid() const { return Guid; } |