51 : Symbol(Symbol), Parent(Parent), Name(Name),
52 OffsetInParent(OffsetInParent), SizeOf(Size), LayoutSize(Size),
71 DataMember(
std::move(Member)) {
72 auto Type = DataMember->getType();
73 if (
auto UDT = unique_dyn_cast<PDBSymbolTypeUDT>(
Type)) {
74 UdtLayout = std::make_unique<ClassLayout>(std::move(
UDT));
80 std::unique_ptr<PDBSymbolTypeBuiltin> Sym,
87 return *cast<PDBSymbolData>(
Symbol);
97 std::unique_ptr<PDBSymbolTypeVTable> VT)
100 auto VTableType = cast<PDBSymbolTypePointer>(VTable->getType());
101 ElementSize = VTableType->getLength();
107 :
LayoutItemBase(Parent, &Sym, Name, OffsetInParent, Size, IsElided) {
121 uint32_t ChildPadding = Back->LayoutItemBase::tailPadding();
122 if (Abs < ChildPadding)
135 uint32_t Begin = LI->getOffsetInParent();
136 uint32_t End = Begin + LI->getLayoutSize();
137 End = std::min(
SizeOf, End);
138 ImmediateUsedBytes.
set(Begin, End);
144 OwnedStorage = std::move(UDT);
153 std::unique_ptr<PDBSymbolTypeBaseClass>
B)
162 IsVirtualBase =
Base->isVirtualBaseClass();
170 UniquePtrVector<PDBSymbolTypeBaseClass> Bases;
171 UniquePtrVector<PDBSymbolTypeVTable> VTables;
172 UniquePtrVector<PDBSymbolData> Members;
173 UniquePtrVector<PDBSymbolTypeBaseClass> VirtualBaseSyms;
176 while (
auto Child = Children->getNext()) {
177 if (
auto Base = unique_dyn_cast<PDBSymbolTypeBaseClass>(Child)) {
178 if (
Base->isVirtualBaseClass())
179 VirtualBaseSyms.push_back(std::move(
Base));
181 Bases.push_back(std::move(
Base));
183 else if (
auto Data = unique_dyn_cast<PDBSymbolData>(Child)) {
185 Members.push_back(std::move(
Data));
188 }
else if (
auto VT = unique_dyn_cast<PDBSymbolTypeVTable>(Child))
189 VTables.push_back(std::move(VT));
190 else if (
auto Func = unique_dyn_cast<PDBSymbolFunc>(Child))
191 Funcs.push_back(std::move(Func));
193 Other.push_back(std::move(Child));
199 AllBases.reserve(Bases.size() + VirtualBaseSyms.size());
205 for (
auto &
Base : Bases) {
208 auto BL = std::make_unique<BaseClassLayout>(*
this,
Offset,
false,
216 assert(VTables.size() <= 1);
217 if (!VTables.empty()) {
219 std::make_unique<VTableLayoutItem>(*
this, std::move(VTables[0]));
226 for (
auto &
Data : Members) {
227 auto DM = std::make_unique<DataMemberLayoutItem>(*
this, std::move(
Data));
235 for (
auto &
VB : VirtualBaseSyms) {
236 int VBPO =
VB->getVirtualBasePointerOffset();
238 if (
auto VBP =
VB->getRawSymbol().getVirtualBaseTableType()) {
239 auto VBPL = std::make_unique<VBPtrLayoutItem>(*
this, std::move(VBP),
240 VBPO, VBP->getLength());
251 bool Elide = (
Parent !=
nullptr);
253 std::make_unique<BaseClassLayout>(*
this,
Offset, Elide, std::move(
VB));
271 if (
BL->hasVBPtrAtOffset(Off -
BL->getOffsetInParent()))
278 uint32_t Begin = Child->getOffsetInParent();
280 if (!Child->isElided()) {
281 BitVector ChildBytes = Child->usedBytes();
288 ChildBytes <<= Child->getOffsetInParent();
291 if (ChildBytes.
count() > 0) {
uint32_t immediatePadding() const override
void resize(unsigned N, bool t=false)
resize - Grow or shrink the bitvector.
IPDBSession defines an interface used to provide a context for querying debug information from a debu...
virtual SymIndexId getTypeId() const =0
UniquePtrVector< PDBSymbolFunc > Funcs
This class represents lattice values for constants.
const UDTLayoutBase * Parent
const IPDBSession & getSession() const
DataMemberLayoutItem(const UDTLayoutBase &Parent, std::unique_ptr< PDBSymbolData > DataMember)
UniquePtrVector< PDBSymbol > Other
int find_last() const
find_last - Returns the index of the last set bit, -1 if none of the bits are set.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
UniquePtrVector< LayoutItemBase > ChildStorage
bool hasUDTLayout() const
VTableLayoutItem(const UDTLayoutBase &Parent, std::unique_ptr< PDBSymbolTypeVTable > VTable)
static RegisterPass< DebugifyModulePass > DM("debugify", "Attach debug info to everything")
ArrayRef< BaseClassLayout * > VirtualBases
std::unique_ptr< ConcreteSymbolEnumerator< T > > findAllChildren() const
UDTLayoutBase(const UDTLayoutBase *Parent, const PDBSymbol &Sym, const std::string &Name, uint32_t OffsetInParent, uint32_t Size, bool IsElided)
uint32_t getOffsetInParent() const
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
virtual std::unique_ptr< PDBSymbol > getSymbolById(SymIndexId SymbolId) const =0
std::vector< LayoutItemBase * > LayoutItems
uint32_t deepPaddingSize() const
const PDBSymbolData & getDataMember()
static Error getOffset(const SymbolRef &Sym, SectionRef Sec, uint64_t &Result)
StringRef getName() const
uint32_t tailPadding() const override
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
The instances of the Type class are immutable: once they are created, they are never changed...
std::vector< BaseClassLayout * > AllBases
IPDBRawSymbol defines an interface used to represent an arbitrary symbol.
ArrayRef< BaseClassLayout * > NonVirtualBases
static uint32_t getTypeLength(const PDBSymbol &Symbol)
bool hasVBPtrAtOffset(uint32_t Off) const
void addChildToLayout(std::unique_ptr< LayoutItemBase > Child)
VTableLayoutItem * VTable
size_type count() const
count - Returns the number of bits which are set.
virtual uint32_t tailPadding() const
PDBSymbol defines the base of the inheritance hierarchy for concrete symbol types (e...
const IPDBRawSymbol & getRawSymbol() const
static std::unique_ptr< PDBSymbol > getSymbolType(const PDBSymbol &Symbol)
ClassLayout(const PDBSymbolTypeUDT &UDT)
size_type size() const
size - Returns the number of bits in this bitvector.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void initializeChildren(const PDBSymbol &Sym)
const ClassLayout & getUDTLayout() const
VBPtrLayoutItem(const UDTLayoutBase &Parent, std::unique_ptr< PDBSymbolTypeBuiltin > Sym, uint32_t Offset, uint32_t Size)
LayoutItemBase(const UDTLayoutBase *Parent, const PDBSymbol *Symbol, const std::string &Name, uint32_t OffsetInParent, uint32_t Size, bool IsElided)
BaseClassLayout(const UDTLayoutBase &Parent, uint32_t OffsetInParent, bool Elide, std::unique_ptr< PDBSymbolTypeBaseClass > Base)
auto upper_bound(R &&Range, T &&Value) -> decltype(adl_begin(Range))
Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly...
virtual uint64_t getLength() const =0