#include "llvm/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.h"
#include "llvm/BinaryFormat/Magic.h"
#include "llvm/DebugInfo/CodeView/EnumTables.h"
#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
#include "llvm/DebugInfo/CodeView/SymbolRecordHelpers.h"
#include "llvm/DebugInfo/CodeView/TypeRecordHelpers.h"
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h"
#include "llvm/DebugInfo/LogicalView/Core/LVScope.h"
#include "llvm/DebugInfo/LogicalView/Core/LVSymbol.h"
#include "llvm/DebugInfo/LogicalView/Core/LVType.h"
#include "llvm/DebugInfo/LogicalView/Readers/LVCodeViewReader.h"
#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
#include "llvm/DebugInfo/PDB/Native/InputFile.h"
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/DebugInfo/PDB/Native/PDBStringTable.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
#include "llvm/DebugInfo/PDB/PDB.h"
#include "llvm/Demangle/Demangle.h"
#include "llvm/Object/COFF.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormatAdapters.h"
#include "llvm/Support/FormatVariadic.h"
usingnamespacellvm;
usingnamespacellvm::codeview;
usingnamespacellvm::object;
usingnamespacellvm::pdb;
usingnamespacellvm::logicalview;
#define DEBUG_TYPE …
namespace llvm {
namespace logicalview {
static TypeIndex getTrueType(TypeIndex &TI) { … }
static const EnumEntry<TypeLeafKind> LeafTypeNames[] = …;
static StringRef getRecordName(LazyRandomTypeCollection &Types, TypeIndex TI) { … }
}
}
#undef DEBUG_TYPE
#define DEBUG_TYPE …
namespace llvm {
namespace logicalview {
LVLineRecords;
namespace {
class LVTypeRecords { … };
class LVForwardReferences { … };
class LVNamespaceDeduction { … };
class LVStringRecords { … };
}
LVTypeKinds;
LVSymbolKinds;
struct LVShared { … };
}
}
void LVTypeRecords::add(uint32_t StreamIdx, TypeIndex TI, TypeLeafKind Kind,
LVElement *Element) { … }
void LVTypeRecords::add(uint32_t StreamIdx, TypeIndex TI, StringRef Name) { … }
LVElement *LVTypeRecords::find(uint32_t StreamIdx, TypeIndex TI, bool Create) { … }
TypeIndex LVTypeRecords::find(uint32_t StreamIdx, StringRef Name) { … }
void LVStringRecords::addFilenames() { … }
void LVStringRecords::addFilenames(LVScopeCompileUnit *Scope) { … }
void LVNamespaceDeduction::add(StringRef String) { … }
void LVNamespaceDeduction::init() { … }
LVScope *LVNamespaceDeduction::get(LVStringRefs Components) { … }
LVScope *LVNamespaceDeduction::get(StringRef ScopedName, bool CheckScope) { … }
#undef DEBUG_TYPE
#define DEBUG_TYPE …
void LVTypeVisitor::printTypeIndex(StringRef FieldName, TypeIndex TI,
uint32_t StreamIdx) const { … }
Error LVTypeVisitor::visitTypeBegin(CVType &Record) { … }
Error LVTypeVisitor::visitTypeBegin(CVType &Record, TypeIndex TI) { … }
Error LVTypeVisitor::visitUnknownType(CVType &Record) { … }
Error LVTypeVisitor::visitMemberBegin(CVMemberRecord &Record) { … }
Error LVTypeVisitor::visitMemberEnd(CVMemberRecord &Record) { … }
Error LVTypeVisitor::visitUnknownMember(CVMemberRecord &Record) { … }
Error LVTypeVisitor::visitKnownRecord(CVType &Record, BuildInfoRecord &Args) { … }
Error LVTypeVisitor::visitKnownRecord(CVType &Record, ClassRecord &Class) { … }
Error LVTypeVisitor::visitKnownRecord(CVType &Record, EnumRecord &Enum) { … }
Error LVTypeVisitor::visitKnownRecord(CVType &Record, FuncIdRecord &Func) { … }
Error LVTypeVisitor::visitKnownRecord(CVType &Record, ProcedureRecord &Proc) { … }
Error LVTypeVisitor::visitKnownRecord(CVType &Record, StringIdRecord &String) { … }
Error LVTypeVisitor::visitKnownRecord(CVType &Record,
UdtSourceLineRecord &Line) { … }
Error LVTypeVisitor::visitKnownRecord(CVType &Record, UnionRecord &Union) { … }
#undef DEBUG_TYPE
#define DEBUG_TYPE …
void LVSymbolVisitorDelegate::printRelocatedField(StringRef Label,
uint32_t RelocOffset,
uint32_t Offset,
StringRef *RelocSym) { … }
void LVSymbolVisitorDelegate::getLinkageName(uint32_t RelocOffset,
uint32_t Offset,
StringRef *RelocSym) { … }
StringRef
LVSymbolVisitorDelegate::getFileNameForFileOffset(uint32_t FileOffset) { … }
DebugStringTableSubsectionRef LVSymbolVisitorDelegate::getStringTable() { … }
void LVSymbolVisitor::printLocalVariableAddrRange(
const LocalVariableAddrRange &Range, uint32_t RelocationOffset) { … }
void LVSymbolVisitor::printLocalVariableAddrGap(
ArrayRef<LocalVariableAddrGap> Gaps) { … }
void LVSymbolVisitor::printTypeIndex(StringRef FieldName, TypeIndex TI) const { … }
Error LVSymbolVisitor::visitSymbolBegin(CVSymbol &Record) { … }
Error LVSymbolVisitor::visitSymbolBegin(CVSymbol &Record, uint32_t Offset) { … }
Error LVSymbolVisitor::visitSymbolEnd(CVSymbol &Record) { … }
Error LVSymbolVisitor::visitUnknownSymbol(CVSymbol &Record) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record, BlockSym &Block) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record,
BPRelativeSym &Local) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record,
RegRelativeSym &Local) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &CVR,
BuildInfoSym &BuildInfo) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record,
Compile2Sym &Compile2) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record,
Compile3Sym &Compile3) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record,
ConstantSym &Constant) { … }
Error LVSymbolVisitor::visitKnownRecord(
CVSymbol &Record,
DefRangeFramePointerRelFullScopeSym &DefRangeFramePointerRelFullScope) { … }
Error LVSymbolVisitor::visitKnownRecord(
CVSymbol &Record, DefRangeFramePointerRelSym &DefRangeFramePointerRel) { … }
Error LVSymbolVisitor::visitKnownRecord(
CVSymbol &Record, DefRangeRegisterRelSym &DefRangeRegisterRel) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record,
DefRangeRegisterSym &DefRangeRegister) { … }
Error LVSymbolVisitor::visitKnownRecord(
CVSymbol &Record, DefRangeSubfieldRegisterSym &DefRangeSubfieldRegister) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record,
DefRangeSubfieldSym &DefRangeSubfield) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record,
DefRangeSym &DefRange) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record,
FrameProcSym &FrameProc) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record, DataSym &Data) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record,
InlineSiteSym &InlineSite) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record, LocalSym &Local) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record, ObjNameSym &ObjName) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record, ProcSym &Proc) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record,
ScopeEndSym &ScopeEnd) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record, Thunk32Sym &Thunk) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record, UDTSym &UDT) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record,
UsingNamespaceSym &UN) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &CVR,
JumpTableSym &JumpTable) { … }
Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record, CallerSym &Caller) { … }
#undef DEBUG_TYPE
#define DEBUG_TYPE …
LVLogicalVisitor::LVLogicalVisitor(LVCodeViewReader *Reader, ScopedPrinter &W,
InputFile &Input)
: … { … }
void LVLogicalVisitor::printTypeIndex(StringRef FieldName, TypeIndex TI,
uint32_t StreamIdx) { … }
void LVLogicalVisitor::printTypeBegin(CVType &Record, TypeIndex TI,
LVElement *Element, uint32_t StreamIdx) { … }
void LVLogicalVisitor::printTypeEnd(CVType &Record) { … }
void LVLogicalVisitor::printMemberBegin(CVMemberRecord &Record, TypeIndex TI,
LVElement *Element,
uint32_t StreamIdx) { … }
void LVLogicalVisitor::printMemberEnd(CVMemberRecord &Record) { … }
Error LVLogicalVisitor::visitUnknownType(CVType &Record, TypeIndex TI) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, ArgListRecord &Args,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, ArrayRecord &AT,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, BitFieldRecord &BF,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, BuildInfoRecord &BI,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, ClassRecord &Class,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, EnumRecord &Enum,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record,
FieldListRecord &FieldList,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, FuncIdRecord &Func,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, LabelRecord &LR,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, MemberFuncIdRecord &Id,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record,
MemberFunctionRecord &MF, TypeIndex TI,
LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record,
MethodOverloadListRecord &Overloads,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, ModifierRecord &Mod,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, PointerRecord &Ptr,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, ProcedureRecord &Proc,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, UnionRecord &Union,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, TypeServer2Record &TS,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, VFTableRecord &VFT,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record,
VFTableShapeRecord &Shape,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record,
StringListRecord &Strings,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, StringIdRecord &String,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record,
UdtSourceLineRecord &SourceLine,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record,
UdtModSourceLineRecord &ModSourceLine,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record, PrecompRecord &Precomp,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownRecord(CVType &Record,
EndPrecompRecord &EndPrecomp,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitUnknownMember(CVMemberRecord &Record,
TypeIndex TI) { … }
Error LVLogicalVisitor::visitKnownMember(CVMemberRecord &Record,
BaseClassRecord &Base, TypeIndex TI,
LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownMember(CVMemberRecord &Record,
DataMemberRecord &Field, TypeIndex TI,
LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownMember(CVMemberRecord &Record,
EnumeratorRecord &Enum, TypeIndex TI,
LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownMember(CVMemberRecord &Record,
ListContinuationRecord &Cont,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownMember(CVMemberRecord &Record,
NestedTypeRecord &Nested, TypeIndex TI,
LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownMember(CVMemberRecord &Record,
OneMethodRecord &Method, TypeIndex TI,
LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownMember(CVMemberRecord &Record,
OverloadedMethodRecord &Method,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownMember(CVMemberRecord &Record,
StaticDataMemberRecord &Field,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownMember(CVMemberRecord &Record,
VFPtrRecord &VFTable, TypeIndex TI,
LVElement *Element) { … }
Error LVLogicalVisitor::visitKnownMember(CVMemberRecord &Record,
VirtualBaseClassRecord &Base,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::visitMemberRecord(CVMemberRecord &Record,
TypeVisitorCallbacks &Callbacks,
TypeIndex TI, LVElement *Element) { … }
Error LVLogicalVisitor::finishVisitation(CVType &Record, TypeIndex TI,
LVElement *Element) { … }
Error LVLogicalVisitor::visitFieldListMemberStream(
TypeIndex TI, LVElement *Element, ArrayRef<uint8_t> FieldList) { … }
void LVLogicalVisitor::addElement(LVScope *Scope, bool IsCompileUnit) { … }
void LVLogicalVisitor::addElement(LVSymbol *Symbol) { … }
void LVLogicalVisitor::addElement(LVType *Type) { … }
LVElement *LVLogicalVisitor::createElement(TypeLeafKind Kind) { … }
LVElement *LVLogicalVisitor::createElement(SymbolKind Kind) { … }
LVElement *LVLogicalVisitor::createElement(TypeIndex TI, TypeLeafKind Kind) { … }
void LVLogicalVisitor::createDataMember(CVMemberRecord &Record, LVScope *Parent,
StringRef Name, TypeIndex TI,
MemberAccess Access) { … }
LVSymbol *LVLogicalVisitor::createParameter(LVElement *Element, StringRef Name,
LVScope *Parent) { … }
LVSymbol *LVLogicalVisitor::createParameter(TypeIndex TI, StringRef Name,
LVScope *Parent) { … }
LVType *LVLogicalVisitor::createBaseType(TypeIndex TI, StringRef TypeName) { … }
LVType *LVLogicalVisitor::createPointerType(TypeIndex TI, StringRef TypeName) { … }
void LVLogicalVisitor::createParents(StringRef ScopedName, LVElement *Element) { … }
LVElement *LVLogicalVisitor::getElement(uint32_t StreamIdx, TypeIndex TI,
LVScope *Parent) { … }
void LVLogicalVisitor::processLines() { … }
void LVLogicalVisitor::processNamespaces() { … }
void LVLogicalVisitor::processFiles() { … }
void LVLogicalVisitor::printRecords(raw_ostream &OS) const { … }
Error LVLogicalVisitor::inlineSiteAnnotation(LVScope *AbstractFunction,
LVScope *InlinedFunction,
InlineSiteSym &InlineSite) { … }