Go to the documentation of this file.
51 const PDBSymbol *Symbol,
const std::string &Name,
54 : Symbol(Symbol), Parent(Parent), Name(Name),
55 OffsetInParent(OffsetInParent), SizeOf(Size), LayoutSize(Size),
71 const UDTLayoutBase &Parent, std::unique_ptr<PDBSymbolData> Member)
75 auto Type = DataMember->getType();
76 if (
auto UDT = unique_dyn_cast<PDBSymbolTypeUDT>(
Type)) {
77 UdtLayout = std::make_unique<ClassLayout>(
std::move(
UDT));
83 std::unique_ptr<PDBSymbolTypeBuiltin> Sym,
90 return *cast<PDBSymbolData>(
Symbol);
100 std::unique_ptr<PDBSymbolTypeVTable> VT)
103 auto VTableType = cast<PDBSymbolTypePointer>(VTable->getType());
104 ElementSize = VTableType->getLength();
108 const std::string &Name,
uint32_t OffsetInParent,
110 :
LayoutItemBase(Parent, &Sym, Name, OffsetInParent, Size, IsElided) {
124 uint32_t ChildPadding = Back->LayoutItemBase::tailPadding();
125 if (Abs < ChildPadding)
138 uint32_t Begin = LI->getOffsetInParent();
139 uint32_t End = Begin + LI->getLayoutSize();
141 ImmediateUsedBytes.
set(Begin, End);
155 uint32_t OffsetInParent,
bool Elide,
156 std::unique_ptr<PDBSymbolTypeBaseClass>
B)
165 IsVirtualBase = Base->isVirtualBaseClass();
173 UniquePtrVector<PDBSymbolTypeBaseClass> Bases;
174 UniquePtrVector<PDBSymbolTypeVTable> VTables;
175 UniquePtrVector<PDBSymbolData> Members;
176 UniquePtrVector<PDBSymbolTypeBaseClass> VirtualBaseSyms;
179 while (
auto Child = Children->getNext()) {
180 if (
auto Base = unique_dyn_cast<PDBSymbolTypeBaseClass>(Child)) {
181 if (
Base->isVirtualBaseClass())
186 else if (
auto Data = unique_dyn_cast<PDBSymbolData>(Child)) {
191 }
else if (
auto VT = unique_dyn_cast<PDBSymbolTypeVTable>(Child))
193 else if (
auto Func = unique_dyn_cast<PDBSymbolFunc>(Child))
202 AllBases.reserve(Bases.size() + VirtualBaseSyms.size());
208 for (
auto &
Base : Bases) {
211 auto BL = std::make_unique<BaseClassLayout>(*
this, Offset,
false,
219 assert(VTables.size() <= 1);
220 if (!VTables.empty()) {
222 std::make_unique<VTableLayoutItem>(*
this,
std::move(VTables[0]));
229 for (
auto &
Data : Members) {
230 auto DM = std::make_unique<DataMemberLayoutItem>(*
this,
std::move(
Data));
238 for (
auto &
VB : VirtualBaseSyms) {
239 int VBPO =
VB->getVirtualBasePointerOffset();
241 if (
auto VBP =
VB->getRawSymbol().getVirtualBaseTableType()) {
242 auto VBPL = std::make_unique<VBPtrLayoutItem>(*
this,
std::move(VBP),
243 VBPO, VBP->getLength());
254 bool Elide = (
Parent !=
nullptr);
256 std::make_unique<BaseClassLayout>(*
this, Offset, Elide,
std::move(
VB));
274 if (
BL->hasVBPtrAtOffset(Off -
BL->getOffsetInParent()))
281 uint32_t Begin = Child->getOffsetInParent();
283 if (!Child->isElided()) {
284 BitVector ChildBytes = Child->usedBytes();
291 ChildBytes <<= Child->getOffsetInParent();
294 if (ChildBytes.
count() > 0) {
IPDBSession defines an interface used to provide a context for querying debug information from a debu...
static StringRef getName(Value *V)
This is an optimization pass for GlobalISel generic memory operations.
auto upper_bound(R &&Range, T &&Value)
Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly...
ClassLayout(const PDBSymbolTypeUDT &UDT)
const ClassLayout & getUDTLayout() const
static RegisterPass< DebugifyModulePass > DM("debugify", "Attach debug info to everything")
virtual uint32_t tailPadding() const
The instances of the Type class are immutable: once they are created, they are never changed.
void resize(unsigned N, bool t=false)
resize - Grow or shrink the bitvector.
virtual uint64_t getLength() const =0
UDTLayoutBase(const UDTLayoutBase *Parent, const PDBSymbol &Sym, const std::string &Name, uint32_t OffsetInParent, uint32_t Size, bool IsElided)
std::vector< BaseClassLayout * > AllBases
static Error getOffset(const SymbolRef &Sym, SectionRef Sec, uint64_t &Result)
int find_last() const
find_last - Returns the index of the last set bit, -1 if none of the bits are set.
uint32_t deepPaddingSize() const
uint32_t tailPadding() const override
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
VBPtrLayoutItem(const UDTLayoutBase &Parent, std::unique_ptr< PDBSymbolTypeBuiltin > Sym, uint32_t Offset, uint32_t Size)
size_type count() const
count - Returns the number of bits which are set.
size_type size() const
size - Returns the number of bits in this bitvector.
VTableLayoutItem * VTable
const PDBSymbolData & getDataMember()
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
PDBSymbol defines the base of the inheritance hierarchy for concrete symbol types (e....
virtual SymIndexId getTypeId() const =0
ArrayRef< BaseClassLayout * > NonVirtualBases
static uint32_t getTypeLength(const PDBSymbol &Symbol)
static std::unique_ptr< PDBSymbol > getSymbolType(const PDBSymbol &Symbol)
std::vector< LayoutItemBase * > LayoutItems
DataMemberLayoutItem(const UDTLayoutBase &Parent, std::unique_ptr< PDBSymbolData > DataMember)
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
ArrayRef< BaseClassLayout * > VirtualBases
uint32_t getOffsetInParent() const
bool hasVBPtrAtOffset(uint32_t Off) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
UniquePtrVector< PDBSymbol > Other
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
UniquePtrVector< PDBSymbolFunc > Funcs
uint32_t immediatePadding() const override
virtual std::unique_ptr< PDBSymbol > getSymbolById(SymIndexId SymbolId) const =0
void addChildToLayout(std::unique_ptr< LayoutItemBase > Child)
BaseClassLayout(const UDTLayoutBase &Parent, uint32_t OffsetInParent, bool Elide, std::unique_ptr< PDBSymbolTypeBaseClass > Base)
LayoutItemBase(const UDTLayoutBase *Parent, const PDBSymbol *Symbol, const std::string &Name, uint32_t OffsetInParent, uint32_t Size, bool IsElided)
void initializeChildren(const PDBSymbol &Sym)
bool hasUDTLayout() const
std::unique_ptr< ConcreteSymbolEnumerator< T > > findAllChildren() const
ArrayRef(const T &OneElt) -> ArrayRef< T >
UniquePtrVector< LayoutItemBase > ChildStorage
IPDBRawSymbol defines an interface used to represent an arbitrary symbol.
const UDTLayoutBase * Parent
VTableLayoutItem(const UDTLayoutBase &Parent, std::unique_ptr< PDBSymbolTypeVTable > VTable)