summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp
new file mode 100644
index 00000000000..47d9b294ec0
--- /dev/null
+++ b/llvm/lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp
@@ -0,0 +1,54 @@
+//===- PDBInfoStream.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/PDBInfoStream.h"
+#include "llvm/ADT/BitVector.h"
+#include "llvm/ADT/SmallVector.h"
+
+using namespace llvm;
+
+PDBInfoStream::PDBInfoStream(const PDBFile &File)
+ : Pdb(File), Stream1(1, File) {}
+
+std::error_code PDBInfoStream::reload() {
+ Stream1.setOffset(0);
+ support::ulittle32_t Value;
+
+ Stream1.readObject(&Version);
+ if (Version < PdbRaw_ImplVer::VC70)
+ return std::make_error_code(std::errc::not_supported);
+
+ Stream1.readObject(&Value);
+ Signature = Value;
+
+ Stream1.readObject(&Value);
+ Age = Value;
+
+ Stream1.readObject(&Guid);
+ NamedStreams.load(Stream1);
+
+ return std::error_code();
+}
+
+uint32_t PDBInfoStream::getNamedStreamIndex(llvm::StringRef Name) const {
+ uint32_t Result;
+ if (!NamedStreams.tryGetValue(Name, Result))
+ return 0;
+ return Result;
+}
+
+PdbRaw_ImplVer PDBInfoStream::getVersion() const {
+ return static_cast<PdbRaw_ImplVer>(Version);
+}
+
+uint32_t PDBInfoStream::getSignature() const { return Signature; }
+
+uint32_t PDBInfoStream::getAge() const { return Age; }
+
+PDB_UniqueId PDBInfoStream::getGuid() const { return Guid; }
OpenPOWER on IntegriCloud