Files
archived-llvm/include/llvm/DebugInfo/CodeView/SymbolVisitorCallbackPipeline.h
Zachary Turner d36e155be1 [llvm-pdbutil] Output the symbol offset when dumping.
Type records have a unique type index, but symbol records do
not.  Instead, symbol records refer to other symbol records
by referencing their offset in the symbol stream.  In a sense
this is the analogue of the TypeIndex, but we are not printing
it in the dumper.  Printing it not only gives us more useful
information when manually investigating the contents of a PDB,
but also allows us to write better tests by enabling us to
verify that fields that reference other symbol records do
so correctly.

Differential Revision: https://reviews.llvm.org/D34906

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306890 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30 21:35:00 +00:00

80 lines
2.6 KiB
C++

//===- SymbolVisitorCallbackPipeline.h --------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H
#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
#include "llvm/Support/Error.h"
#include <vector>
namespace llvm {
namespace codeview {
class SymbolVisitorCallbackPipeline : public SymbolVisitorCallbacks {
public:
SymbolVisitorCallbackPipeline() = default;
Error visitUnknownSymbol(CVSymbol &Record) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitUnknownSymbol(Record))
return EC;
}
return Error::success();
}
Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitSymbolBegin(Record, Offset))
return EC;
}
return Error::success();
}
Error visitSymbolBegin(CVSymbol &Record) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitSymbolBegin(Record))
return EC;
}
return Error::success();
}
Error visitSymbolEnd(CVSymbol &Record) override {
for (auto Visitor : Pipeline) {
if (auto EC = Visitor->visitSymbolEnd(Record))
return EC;
}
return Error::success();
}
void addCallbackToPipeline(SymbolVisitorCallbacks &Callbacks) {
Pipeline.push_back(&Callbacks);
}
#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \
for (auto Visitor : Pipeline) { \
if (auto EC = Visitor->visitKnownRecord(CVR, Record)) \
return EC; \
} \
return Error::success(); \
}
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
private:
std::vector<SymbolVisitorCallbacks *> Pipeline;
};
} // end namespace codeview
} // end namespace llvm
#endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLVISITORCALLBACKPIPELINE_H