mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
Add concrete type overloads to PDBSymbol::findChildren().
Frequently you only want to iterate over children of a specific type (e.g. functions). Previously you would get back a generic interface that allowed iteration over the base symbol type, which you would have to dyn_cast<> each one of. With this patch, we allow the user to specify the concrete type as a template parameter, and it will return an iterator which returns instances of the concrete type directly. llvm-svn: 228960
This commit is contained in:
parent
aff15b863c
commit
6cde1e9388
58
include/llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h
Normal file
58
include/llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h
Normal file
@ -0,0 +1,58 @@
|
||||
//===- ConcreteSymbolEnumerator.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_PDB_CONCRETESYMBOLENUMERATOR_H
|
||||
#define LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
|
||||
|
||||
#include <memory>
|
||||
#include "IPDBEnumChildren.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
template <typename ChildType>
|
||||
class ConcreteSymbolEnumerator : public IPDBEnumChildren<ChildType> {
|
||||
public:
|
||||
ConcreteSymbolEnumerator(std::unique_ptr<IPDBEnumSymbols> SymbolEnumerator)
|
||||
: Enumerator(std::move(SymbolEnumerator)) {}
|
||||
|
||||
virtual ~ConcreteSymbolEnumerator() {}
|
||||
|
||||
uint32_t getChildCount() const override {
|
||||
return Enumerator->getChildCount();
|
||||
}
|
||||
|
||||
std::unique_ptr<ChildType> getChildAtIndex(uint32_t Index) const {
|
||||
std::unique_ptr<PDBSymbol> Child = Enumerator->getChildAtIndex(Index);
|
||||
return make_concrete_child(std::move(Child));
|
||||
}
|
||||
|
||||
std::unique_ptr<ChildType> getNext() {
|
||||
std::unique_ptr<PDBSymbol> Child = Enumerator->getNext();
|
||||
return make_concrete_child(std::move(Child));
|
||||
}
|
||||
|
||||
void reset() { Enumerator->reset(); }
|
||||
|
||||
MyType *clone() const {
|
||||
std::unique_ptr<IPDBEnumSymbols> WrappedClone(Enumerator->clone());
|
||||
return new ConcreteSymbolEnumerator<ChildType>(std::move(WrappedClone));
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<ChildType>
|
||||
make_concrete_child(std::unique_ptr<PDBSymbol> Child) const {
|
||||
ChildType *ConcreteChild = dyn_cast_or_null<ChildType>(Child.release());
|
||||
return std::unique_ptr<ChildType>(ConcreteChild);
|
||||
}
|
||||
|
||||
std::unique_ptr<IPDBEnumSymbols> Enumerator;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -16,6 +16,7 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
|
||||
#include "ConcreteSymbolEnumerator.h"
|
||||
#include "IPDBRawSymbol.h"
|
||||
#include "PDBExtras.h"
|
||||
#include "PDBTypes.h"
|
||||
@ -30,6 +31,10 @@ namespace llvm {
|
||||
class IPDBRawSymbol;
|
||||
class raw_ostream;
|
||||
|
||||
#define DECLARE_PDB_SYMBOL_CONCRETE_TYPE(TagValue) \
|
||||
static const PDB_SymType Tag = TagValue; \
|
||||
static bool classof(const PDBSymbol *S) { return S->getSymTag() == Tag; }
|
||||
|
||||
/// PDBSymbol defines the base of the inheritance hierarchy for concrete symbol
|
||||
/// types (e.g. functions, executables, vtables, etc). All concrete symbol
|
||||
/// types inherit from PDBSymbol and expose the exact set of methods that are
|
||||
@ -55,7 +60,18 @@ public:
|
||||
|
||||
PDB_SymType getSymTag() const;
|
||||
|
||||
std::unique_ptr<IPDBEnumSymbols> findChildren(PDB_SymType Type) const;
|
||||
template <typename T> std::unique_ptr<T> findOneChild() const {
|
||||
auto Enumerator(findAllChildren<T>());
|
||||
return Enumerator->getNext();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::unique_ptr<ConcreteSymbolEnumerator<T>> findAllChildren() const {
|
||||
auto BaseIter = RawSymbol->findChildren(T::Tag);
|
||||
return std::make_unique<ConcreteSymbolEnumerator<T>>(std::move(BaseIter));
|
||||
}
|
||||
|
||||
std::unique_ptr<IPDBEnumSymbols> findAllChildren() const;
|
||||
std::unique_ptr<IPDBEnumSymbols>
|
||||
findChildren(PDB_SymType Type, StringRef Name,
|
||||
PDB_NameSearchFlags Flags) const;
|
||||
|
@ -23,6 +23,8 @@ public:
|
||||
PDBSymbolAnnotation(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> Symbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Annotation)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getAddressOffset)
|
||||
@ -32,10 +34,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
// FORWARD_SYMBOL_METHOD(getValue)
|
||||
FORWARD_SYMBOL_METHOD(getVirtualAddress)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::Annotation;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,8 @@ public:
|
||||
PDBSymbolBlock(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> Symbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Block)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getAddressOffset)
|
||||
@ -34,10 +36,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getRelativeVirtualAddress)
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
FORWARD_SYMBOL_METHOD(getVirtualAddress)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::Block;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,8 @@ public:
|
||||
PDBSymbolCompiland(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> CompilandSymbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Compiland)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(isEditAndContinueEnabled)
|
||||
@ -31,10 +33,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getName)
|
||||
FORWARD_SYMBOL_METHOD(getSourceFileName)
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::Compiland;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolCompilandDetails(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> Symbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::CompilandDetails)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
void getFrontEndVersion(VersionInfo &Version) const {
|
||||
@ -46,10 +48,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getLexicalParentId)
|
||||
FORWARD_SYMBOL_METHOD(getPlatform)
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::CompilandDetails;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,16 +22,14 @@ public:
|
||||
PDBSymbolCompilandEnv(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> Symbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::CompilandEnv)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getLexicalParentId)
|
||||
FORWARD_SYMBOL_METHOD(getName)
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
std::string getValue() const;
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::CompilandEnv;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -27,14 +27,12 @@ public:
|
||||
PDBSymbolCustom(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> CustomSymbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Custom)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
void getDataBytes(llvm::SmallVector<uint8_t, 32> &bytes);
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::Custom;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolData(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> DataSymbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Data)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getAccess)
|
||||
@ -50,10 +52,6 @@ public:
|
||||
// FORWARD_SYMBOL_METHOD(getValue)
|
||||
FORWARD_SYMBOL_METHOD(getVirtualAddress)
|
||||
FORWARD_SYMBOL_METHOD(isVolatileType)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::Data;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -24,6 +24,8 @@ public:
|
||||
PDBSymbolExe(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> ExeSymbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Exe)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getAge)
|
||||
@ -35,10 +37,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getSignature)
|
||||
FORWARD_SYMBOL_METHOD(getSymbolsFileName)
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::Exe;
|
||||
}
|
||||
};
|
||||
} // namespace llvm
|
||||
|
||||
|
@ -24,6 +24,8 @@ public:
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Function)
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getAccess)
|
||||
FORWARD_SYMBOL_METHOD(getAddressOffset)
|
||||
FORWARD_SYMBOL_METHOD(getAddressSection)
|
||||
@ -66,10 +68,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getVirtualAddress)
|
||||
FORWARD_SYMBOL_METHOD(getVirtualBaseOffset)
|
||||
FORWARD_SYMBOL_METHOD(isVolatileType)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::Function;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolFuncDebugEnd(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> FuncDebugEndSymbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::FuncDebugEnd)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getAddressOffset)
|
||||
@ -40,10 +42,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getRelativeVirtualAddress)
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
FORWARD_SYMBOL_METHOD(getVirtualAddress)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::FuncDebugEnd;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolFuncDebugStart(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> FuncDebugStartSymbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::FuncDebugStart)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getAddressOffset)
|
||||
@ -40,10 +42,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getRelativeVirtualAddress)
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
FORWARD_SYMBOL_METHOD(getVirtualAddress)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::FuncDebugStart;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolLabel(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> LabelSymbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Label)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getAddressOffset)
|
||||
@ -40,10 +42,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getRelativeVirtualAddress)
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
FORWARD_SYMBOL_METHOD(getVirtualAddress)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::Label;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolPublicSymbol(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> PublicSymbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::PublicSymbol)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getAddressOffset)
|
||||
@ -38,10 +40,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getRelativeVirtualAddress)
|
||||
FORWARD_SYMBOL_METHOD(getVirtualAddress)
|
||||
FORWARD_SYMBOL_METHOD(getUndecoratedName)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::PublicSymbol;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -24,6 +24,8 @@ public:
|
||||
PDBSymbolThunk(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> ThunkSymbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Thunk)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getAccess)
|
||||
@ -50,10 +52,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getVirtualAddress)
|
||||
FORWARD_SYMBOL_METHOD(getVirtualBaseOffset)
|
||||
FORWARD_SYMBOL_METHOD(isVolatileType)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::Thunk;
|
||||
}
|
||||
};
|
||||
} // namespace llvm
|
||||
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolTypeArray(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> ArrayTypeSymbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::ArrayType)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getArrayIndexTypeId)
|
||||
@ -34,10 +36,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getTypeId)
|
||||
FORWARD_SYMBOL_METHOD(isUnalignedType)
|
||||
FORWARD_SYMBOL_METHOD(isVolatileType)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::ArrayType;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolTypeBaseClass(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> Symbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::BaseClass)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getAccess)
|
||||
@ -51,10 +53,6 @@ public:
|
||||
// FORWARD_SYMBOL_METHOD(getVirtualBaseTableType)
|
||||
FORWARD_SYMBOL_METHOD(getVirtualTableShapeId)
|
||||
FORWARD_SYMBOL_METHOD(isVolatileType)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::BaseClass;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolTypeBuiltin(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> Symbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::BuiltinType)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getBuiltinType)
|
||||
@ -31,10 +33,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
FORWARD_SYMBOL_METHOD(isUnalignedType)
|
||||
FORWARD_SYMBOL_METHOD(isVolatileType)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::BuiltinType;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,15 +22,13 @@ public:
|
||||
PDBSymbolTypeCustom(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> Symbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::CustomType)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getOemId)
|
||||
FORWARD_SYMBOL_METHOD(getOemSymbolId)
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::CustomType;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,15 +22,13 @@ public:
|
||||
PDBSymbolTypeDimension(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> Symbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Dimension)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getLowerBoundId)
|
||||
FORWARD_SYMBOL_METHOD(getUpperBoundId)
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::Dimension;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolTypeEnum(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> EnumTypeSymbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Enum)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getBuiltinType)
|
||||
@ -42,10 +44,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getTypeId)
|
||||
FORWARD_SYMBOL_METHOD(isUnalignedType)
|
||||
FORWARD_SYMBOL_METHOD(isVolatileType)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::Enum;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,16 +22,14 @@ public:
|
||||
PDBSymbolTypeFriend(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> Symbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Friend)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getClassParentId)
|
||||
FORWARD_SYMBOL_METHOD(getName)
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
FORWARD_SYMBOL_METHOD(getTypeId)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::Friend;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,16 +22,14 @@ public:
|
||||
PDBSymbolTypeFunctionArg(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> Symbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::FunctionArg)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getClassParentId)
|
||||
FORWARD_SYMBOL_METHOD(getLexicalParentId)
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
FORWARD_SYMBOL_METHOD(getTypeId)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::FunctionArg;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolTypeFunctionSig(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> Symbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::FunctionSig)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getCallingConvention)
|
||||
@ -35,10 +37,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getTypeId)
|
||||
FORWARD_SYMBOL_METHOD(isUnalignedType)
|
||||
FORWARD_SYMBOL_METHOD(isVolatileType)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::FunctionSig;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,14 +22,12 @@ public:
|
||||
PDBSymbolTypeManaged(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> Symbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::ManagedType)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getName)
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::ManagedType;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolTypePointer(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> Symbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::PointerType)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(isConstType)
|
||||
@ -32,10 +34,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getTypeId)
|
||||
FORWARD_SYMBOL_METHOD(isUnalignedType)
|
||||
FORWARD_SYMBOL_METHOD(isVolatileType)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::PointerType;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolTypeTypedef(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> Symbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::Typedef)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getBuiltinType)
|
||||
@ -45,10 +47,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(isUnalignedType)
|
||||
FORWARD_SYMBOL_METHOD(getVirtualTableShapeId)
|
||||
FORWARD_SYMBOL_METHOD(isVolatileType)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::Typedef;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolTypeUDT(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> UDTSymbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::UDT)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getClassParentId)
|
||||
@ -42,10 +44,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(isUnalignedType)
|
||||
FORWARD_SYMBOL_METHOD(getVirtualTableShapeId)
|
||||
FORWARD_SYMBOL_METHOD(isVolatileType)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::UDT;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolTypeVTable(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> VtblSymbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::VTable)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getClassParentId)
|
||||
@ -31,10 +33,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getTypeId)
|
||||
FORWARD_SYMBOL_METHOD(isUnalignedType)
|
||||
FORWARD_SYMBOL_METHOD(isVolatileType)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::VTable;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
PDBSymbolTypeVTableShape(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> VtblShapeSymbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::VTableShape)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(isConstType)
|
||||
@ -30,10 +32,6 @@ public:
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
FORWARD_SYMBOL_METHOD(isUnalignedType)
|
||||
FORWARD_SYMBOL_METHOD(isVolatileType)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::VTableShape;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -22,15 +22,13 @@ public:
|
||||
PDBSymbolUsingNamespace(const IPDBSession &PDBSession,
|
||||
std::unique_ptr<IPDBRawSymbol> Symbol);
|
||||
|
||||
DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::UsingNamespace)
|
||||
|
||||
void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
|
||||
|
||||
FORWARD_SYMBOL_METHOD(getLexicalParentId)
|
||||
FORWARD_SYMBOL_METHOD(getName)
|
||||
FORWARD_SYMBOL_METHOD(getSymIndexId)
|
||||
|
||||
static bool classof(const PDBSymbol *S) {
|
||||
return S->getSymTag() == PDB_SymType::UsingNamespace;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
@ -75,7 +75,7 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_RegisterId &Reg) {
|
||||
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R14, OS)
|
||||
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R15, OS)
|
||||
default:
|
||||
OS << "Unknown";
|
||||
OS << static_cast<int>(Reg);
|
||||
}
|
||||
return OS;
|
||||
}
|
||||
|
@ -105,8 +105,8 @@ void PDBSymbol::defaultDump(raw_ostream &OS, int Indent,
|
||||
|
||||
PDB_SymType PDBSymbol::getSymTag() const { return RawSymbol->getSymTag(); }
|
||||
|
||||
std::unique_ptr<IPDBEnumSymbols> PDBSymbol::findChildren(PDB_SymType Type) const {
|
||||
return RawSymbol->findChildren(Type);
|
||||
std::unique_ptr<IPDBEnumSymbols> PDBSymbol::findAllChildren() const {
|
||||
return RawSymbol->findChildren(PDB_SymType::None);
|
||||
}
|
||||
|
||||
std::unique_ptr<IPDBEnumSymbols>
|
||||
@ -128,7 +128,7 @@ PDBSymbol::findInlineFramesByRVA(uint32_t RVA) const {
|
||||
|
||||
std::unique_ptr<IPDBEnumSymbols>
|
||||
PDBSymbol::getChildStats(TagStats &Stats) const {
|
||||
std::unique_ptr<IPDBEnumSymbols> Result(findChildren(PDB_SymType::None));
|
||||
std::unique_ptr<IPDBEnumSymbols> Result(findAllChildren());
|
||||
Stats.clear();
|
||||
while (auto Child = Result->getNext()) {
|
||||
++Stats[Child->getSymTag()];
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
@ -28,9 +29,11 @@ PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession,
|
||||
|
||||
void PDBSymbolCompiland::dump(raw_ostream &OS, int Indent,
|
||||
PDB_DumpLevel Level) const {
|
||||
std::string Name = getName();
|
||||
OS << "---- [IDX: " << getSymIndexId() << "] Compiland: " << Name
|
||||
<< " ----\n";
|
||||
std::string FullName = getName();
|
||||
StringRef Name = llvm::sys::path::filename(StringRef(FullName.c_str()));
|
||||
|
||||
OS.indent(Indent);
|
||||
OS << "Compiland: " << Name << "\n";
|
||||
|
||||
std::string Source = getSourceFileName();
|
||||
std::string Library = getLibraryName();
|
||||
@ -54,11 +57,8 @@ void PDBSymbolCompiland::dump(raw_ostream &OS, int Indent,
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<IPDBEnumSymbols> DetailsEnum(
|
||||
findChildren(PDB_SymType::CompilandDetails));
|
||||
if (auto DetailsPtr = DetailsEnum->getNext()) {
|
||||
const auto *CD = dyn_cast<PDBSymbolCompilandDetails>(DetailsPtr.get());
|
||||
assert(CD && "We only asked for compilands, but got something else!");
|
||||
auto DetailsEnum(findAllChildren<PDBSymbolCompilandDetails>());
|
||||
if (auto CD = DetailsEnum->getNext()) {
|
||||
VersionInfo FE;
|
||||
VersionInfo BE;
|
||||
CD->getFrontEndVersion(FE);
|
||||
|
@ -25,9 +25,11 @@ void PDBSymbolData::dump(raw_ostream &OS, int Indent,
|
||||
if (Level == PDB_DumpLevel::Compact) {
|
||||
PDB_LocType Loc = getLocationType();
|
||||
OS << Loc << " data [";
|
||||
int Length;
|
||||
switch (Loc) {
|
||||
case PDB_LocType::Static:
|
||||
OS << format_hex(getRelativeVirtualAddress(), 10);
|
||||
Length = getLength();
|
||||
break;
|
||||
case PDB_LocType::TLS:
|
||||
OS << getAddressSection() << ":" << format_hex(getAddressOffset(), 10);
|
||||
|
@ -27,35 +27,21 @@ void PDBSymbolFunc::dump(raw_ostream &OS, int Indent,
|
||||
if (Level == PDB_DumpLevel::Compact) {
|
||||
uint32_t FuncStart = getRelativeVirtualAddress();
|
||||
uint32_t FuncEnd = FuncStart + getLength();
|
||||
auto DebugEndSymbol = findChildren(PDB_SymType::FuncDebugEnd);
|
||||
OS << stream_indent(Indent);
|
||||
OS << "[" << format_hex(FuncStart, 8);
|
||||
if (auto DebugStartEnum = findChildren(PDB_SymType::FuncDebugStart)) {
|
||||
if (auto StartSym = DebugStartEnum->getNext()) {
|
||||
auto DebugStart = dyn_cast<PDBSymbolFuncDebugStart>(StartSym.get());
|
||||
OS << "+" << DebugStart->getRelativeVirtualAddress() - FuncStart;
|
||||
}
|
||||
}
|
||||
if (auto DebugStart = findOneChild<PDBSymbolFuncDebugStart>())
|
||||
OS << "+" << DebugStart->getRelativeVirtualAddress() - FuncStart;
|
||||
OS << " - " << format_hex(FuncEnd, 8);
|
||||
if (auto DebugEndEnum = findChildren(PDB_SymType::FuncDebugEnd)) {
|
||||
if (auto DebugEndSym = DebugEndEnum->getNext()) {
|
||||
auto DebugEnd = dyn_cast<PDBSymbolFuncDebugEnd>(DebugEndSym.get());
|
||||
if (auto DebugEnd = findOneChild<PDBSymbolFuncDebugEnd>())
|
||||
OS << "-" << FuncEnd - DebugEnd->getRelativeVirtualAddress();
|
||||
}
|
||||
}
|
||||
OS << "] ";
|
||||
PDB_RegisterId Reg = getLocalBasePointerRegisterId();
|
||||
if (Reg == PDB_RegisterId::VFrame)
|
||||
OS << "(VFrame)";
|
||||
else if (hasFramePointer()) {
|
||||
if (Reg == PDB_RegisterId::EBP)
|
||||
OS << "(EBP)";
|
||||
else
|
||||
OS << "(" << (int)Reg << ")";
|
||||
} else {
|
||||
else if (hasFramePointer())
|
||||
OS << "(" << Reg << ")";
|
||||
else
|
||||
OS << "(FPO)";
|
||||
}
|
||||
OS << " " << getName() << "\n";
|
||||
}
|
||||
OS.flush();
|
||||
}
|
||||
|
@ -25,11 +25,17 @@ void PDBSymbolThunk::dump(raw_ostream &OS, int Indent,
|
||||
if (Level == PDB_DumpLevel::Compact) {
|
||||
OS.indent(Indent);
|
||||
PDB_ThunkOrdinal Ordinal = getThunkOrdinal();
|
||||
OS << "THUNK[" << Ordinal << "] ";
|
||||
OS << "[" << format_hex(getRelativeVirtualAddress(), 10);
|
||||
uint32_t RVA = getRelativeVirtualAddress();
|
||||
if (Ordinal == PDB_ThunkOrdinal::TrampIncremental) {
|
||||
OS << format_hex(RVA, 10);
|
||||
} else {
|
||||
OS << "[" << format_hex(RVA, 10);
|
||||
OS << " - " << format_hex(RVA + getLength(), 10) << "]";
|
||||
}
|
||||
OS << " thunk(" << Ordinal << ")";
|
||||
if (Ordinal == PDB_ThunkOrdinal::TrampIncremental)
|
||||
OS << " -> " << format_hex(getTargetRelativeVirtualAddress(), 10);
|
||||
OS << "] ";
|
||||
OS << " ";
|
||||
std::string Name = getName();
|
||||
if (!Name.empty())
|
||||
OS << Name;
|
||||
|
@ -63,11 +63,9 @@ static void dumpInput(StringRef Path) {
|
||||
outs().flush();
|
||||
|
||||
if (opts::Compilands) {
|
||||
auto Compilands = GlobalScope->findChildren(PDB_SymType::Compiland);
|
||||
if (Compilands) {
|
||||
while (auto Compiland = Compilands->getNext()) {
|
||||
Compiland->dump(outs(), 0, PDB_DumpLevel::Normal);
|
||||
}
|
||||
auto Compilands = GlobalScope->findAllChildren<PDBSymbolCompiland>();
|
||||
while (auto Compiland = Compilands->getNext()) {
|
||||
Compiland->dump(outs(), 0, PDB_DumpLevel::Normal);
|
||||
}
|
||||
}
|
||||
outs().flush();
|
||||
|
Loading…
Reference in New Issue
Block a user