summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/DebugInfo/CodeView/CMakeLists.txt2
-rw-r--r--llvm/lib/DebugInfo/CodeView/ModuleSubstream.cpp (renamed from llvm/lib/DebugInfo/PDB/Raw/ModuleSubstreamRecord.cpp)23
-rw-r--r--llvm/lib/DebugInfo/CodeView/ModuleSubstreamVisitor.cpp98
-rw-r--r--llvm/lib/DebugInfo/PDB/CMakeLists.txt1
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp2
5 files changed, 109 insertions, 17 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/CMakeLists.txt b/llvm/lib/DebugInfo/CodeView/CMakeLists.txt
index d57c162586d..6c4e09fe4e3 100644
--- a/llvm/lib/DebugInfo/CodeView/CMakeLists.txt
+++ b/llvm/lib/DebugInfo/CodeView/CMakeLists.txt
@@ -7,6 +7,8 @@ add_llvm_library(LLVMDebugInfoCodeView
ListRecordBuilder.cpp
MemoryTypeTableBuilder.cpp
MethodListRecordBuilder.cpp
+ ModuleSubstream.cpp
+ ModuleSubstreamVisitor.cpp
RecordSerialization.cpp
StreamReader.cpp
SymbolDumper.cpp
diff --git a/llvm/lib/DebugInfo/PDB/Raw/ModuleSubstreamRecord.cpp b/llvm/lib/DebugInfo/CodeView/ModuleSubstream.cpp
index 3e0573bf5ef..2e31ed6b5b7 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/ModuleSubstreamRecord.cpp
+++ b/llvm/lib/DebugInfo/CodeView/ModuleSubstream.cpp
@@ -1,4 +1,4 @@
-//===- ModuleSubstreamRecord.cpp --------------------------------*- C++ -*-===//
+//===- ModuleSubstream.cpp --------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,24 +7,19 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/DebugInfo/PDB/Raw/ModuleSubstreamRecord.h"
+#include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
#include "llvm/DebugInfo/CodeView/StreamReader.h"
-#include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
using namespace llvm;
using namespace llvm::codeview;
-using namespace llvm::pdb;
-ModuleSubstreamRecord::ModuleSubstreamRecord()
- : Kind(ModuleSubstreamKind::None) {}
+ModuleSubstream::ModuleSubstream() : Kind(ModuleSubstreamKind::None) {}
-ModuleSubstreamRecord::ModuleSubstreamRecord(ModuleSubstreamKind Kind,
- StreamRef Data)
+ModuleSubstream::ModuleSubstream(ModuleSubstreamKind Kind, StreamRef Data)
: Kind(Kind), Data(Data) {}
-Error ModuleSubstreamRecord::initialize(StreamRef Stream,
- ModuleSubstreamRecord &Info) {
+Error ModuleSubstream::initialize(StreamRef Stream, ModuleSubstream &Info) {
const ModuleSubsectionHeader *Header;
StreamReader Reader(Stream);
if (auto EC = Reader.readObject(Header))
@@ -38,12 +33,10 @@ Error ModuleSubstreamRecord::initialize(StreamRef Stream,
return Error::success();
}
-uint32_t ModuleSubstreamRecord::getRecordLength() const {
+uint32_t ModuleSubstream::getRecordLength() const {
return sizeof(ModuleSubsectionHeader) + Data.getLength();
}
-ModuleSubstreamKind ModuleSubstreamRecord::getSubstreamKind() const {
- return Kind;
-}
+ModuleSubstreamKind ModuleSubstream::getSubstreamKind() const { return Kind; }
-StreamRef ModuleSubstreamRecord::getRecordData() const { return Data; }
+StreamRef ModuleSubstream::getRecordData() const { return Data; }
diff --git a/llvm/lib/DebugInfo/CodeView/ModuleSubstreamVisitor.cpp b/llvm/lib/DebugInfo/CodeView/ModuleSubstreamVisitor.cpp
new file mode 100644
index 00000000000..7b5c3506aa7
--- /dev/null
+++ b/llvm/lib/DebugInfo/CodeView/ModuleSubstreamVisitor.cpp
@@ -0,0 +1,98 @@
+//===- ModuleSubstreamVisitor.cpp -------------------------------*- 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/CodeView/ModuleSubstreamVisitor.h"
+
+using namespace llvm;
+using namespace llvm::codeview;
+
+Error IModuleSubstreamVisitor::visitSymbols(StreamRef Data) {
+ return visitUnknown(ModuleSubstreamKind::Symbols, Data);
+}
+Error IModuleSubstreamVisitor::visitLines(StreamRef Data,
+ const LineSubstreamHeader *Header,
+ LineInfoArray Lines) {
+ return visitUnknown(ModuleSubstreamKind::Lines, Data);
+}
+Error IModuleSubstreamVisitor::visitStringTable(StreamRef Data) {
+ return visitUnknown(ModuleSubstreamKind::StringTable, Data);
+}
+Error IModuleSubstreamVisitor::visitFileChecksums(StreamRef Data) {
+ return visitUnknown(ModuleSubstreamKind::FileChecksums, Data);
+}
+Error IModuleSubstreamVisitor::visitFrameData(StreamRef Data) {
+ return visitUnknown(ModuleSubstreamKind::FrameData, Data);
+}
+Error IModuleSubstreamVisitor::visitInlineeLines(StreamRef Data) {
+ return visitUnknown(ModuleSubstreamKind::InlineeLines, Data);
+}
+Error IModuleSubstreamVisitor::visitCrossScopeImports(StreamRef Data) {
+ return visitUnknown(ModuleSubstreamKind::CrossScopeExports, Data);
+}
+Error IModuleSubstreamVisitor::visitCrossScopeExports(StreamRef Data) {
+ return visitUnknown(ModuleSubstreamKind::CrossScopeImports, Data);
+}
+Error IModuleSubstreamVisitor::visitILLines(StreamRef Data) {
+ return visitUnknown(ModuleSubstreamKind::ILLines, Data);
+}
+Error IModuleSubstreamVisitor::visitFuncMDTokenMap(StreamRef Data) {
+ return visitUnknown(ModuleSubstreamKind::FuncMDTokenMap, Data);
+}
+Error IModuleSubstreamVisitor::visitTypeMDTokenMap(StreamRef Data) {
+ return visitUnknown(ModuleSubstreamKind::TypeMDTokenMap, Data);
+}
+Error IModuleSubstreamVisitor::visitMergedAssemblyInput(StreamRef Data) {
+ return visitUnknown(ModuleSubstreamKind::MergedAssemblyInput, Data);
+}
+Error IModuleSubstreamVisitor::visitCoffSymbolRVA(StreamRef Data) {
+ return visitUnknown(ModuleSubstreamKind::CoffSymbolRVA, Data);
+}
+
+Error llvm::codeview::visitModuleSubstream(const ModuleSubstream &R,
+ IModuleSubstreamVisitor &V) {
+ switch (R.getSubstreamKind()) {
+ case ModuleSubstreamKind::Symbols:
+ return V.visitSymbols(R.getRecordData());
+ case ModuleSubstreamKind::Lines: {
+ StreamReader Reader(R.getRecordData());
+ const LineSubstreamHeader *Header;
+ if (auto EC = Reader.readObject(Header))
+ return EC;
+ FileLineInfoExtractor E(Header);
+ LineInfoArray LineInfos(E);
+ if (auto EC = Reader.readArray(LineInfos, Reader.bytesRemaining()))
+ return EC;
+ return V.visitLines(R.getRecordData(), Header, LineInfos);
+ }
+ case ModuleSubstreamKind::StringTable:
+ return V.visitStringTable(R.getRecordData());
+ case ModuleSubstreamKind::FileChecksums:
+ return V.visitFileChecksums(R.getRecordData());
+ case ModuleSubstreamKind::FrameData:
+ return V.visitFrameData(R.getRecordData());
+ case ModuleSubstreamKind::InlineeLines:
+ return V.visitInlineeLines(R.getRecordData());
+ case ModuleSubstreamKind::CrossScopeImports:
+ return V.visitCrossScopeImports(R.getRecordData());
+ case ModuleSubstreamKind::CrossScopeExports:
+ return V.visitCrossScopeExports(R.getRecordData());
+ case ModuleSubstreamKind::ILLines:
+ return V.visitILLines(R.getRecordData());
+ case ModuleSubstreamKind::FuncMDTokenMap:
+ return V.visitFuncMDTokenMap(R.getRecordData());
+ case ModuleSubstreamKind::TypeMDTokenMap:
+ return V.visitTypeMDTokenMap(R.getRecordData());
+ case ModuleSubstreamKind::MergedAssemblyInput:
+ return V.visitMergedAssemblyInput(R.getRecordData());
+ case ModuleSubstreamKind::CoffSymbolRVA:
+ return V.visitCoffSymbolRVA(R.getRecordData());
+ default:
+ return V.visitUnknown(R.getSubstreamKind(), R.getRecordData());
+ }
+}
diff --git a/llvm/lib/DebugInfo/PDB/CMakeLists.txt b/llvm/lib/DebugInfo/PDB/CMakeLists.txt
index 4dc0b4f8c31..46074f769cd 100644
--- a/llvm/lib/DebugInfo/PDB/CMakeLists.txt
+++ b/llvm/lib/DebugInfo/PDB/CMakeLists.txt
@@ -33,7 +33,6 @@ add_pdb_impl_folder(Raw
Raw/InfoStream.cpp
Raw/MappedBlockStream.cpp
Raw/ModInfo.cpp
- Raw/ModuleSubstreamRecord.cpp
Raw/ModStream.cpp
Raw/NameHashTable.cpp
Raw/NameMap.cpp
diff --git a/llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp
index a6d1977165f..14c55906e06 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp
@@ -69,7 +69,7 @@ ModStream::symbols(bool *HadError) const {
SymbolsSubstream.end());
}
-iterator_range<ModStream::LineInfoArray::Iterator>
+iterator_range<codeview::ModuleSubstreamArray::Iterator>
ModStream::lines(bool *HadError) const {
return llvm::make_range(LineInfo.begin(HadError), LineInfo.end());
}
OpenPOWER on IntegriCloud