52 : Symbol(Symbol), Parent(Parent), Name(Name),
53 OffsetInParent(OffsetInParent), SizeOf(Size), LayoutSize(Size),
72 DataMember(
std::move(Member)) {
73 auto Type = DataMember->getType();
74 if (
auto UDT = unique_dyn_cast<PDBSymbolTypeUDT>(
Type)) {
75 UdtLayout = llvm::make_unique<ClassLayout>(std::move(
UDT));
81 std::unique_ptr<PDBSymbolTypeBuiltin> Sym,
98 std::unique_ptr<PDBSymbolTypeVTable> VT)
101 auto VTableType = cast<PDBSymbolTypePointer>(VTable->getType());
102 ElementSize = VTableType->getLength();
108 :
LayoutItemBase(Parent, &Sym, Name, OffsetInParent, Size, IsElided) {
122 uint32_t ChildPadding = Back->LayoutItemBase::tailPadding();
123 if (Abs < ChildPadding)
136 uint32_t Begin = LI->getOffsetInParent();
137 uint32_t End = Begin + LI->getLayoutSize();
138 End = std::min(
SizeOf, End);
139 ImmediateUsedBytes.
set(Begin, End);
145 OwnedStorage = std::move(UDT);
154 std::unique_ptr<PDBSymbolTypeBaseClass>
B)
163 IsVirtualBase =
Base->isVirtualBaseClass();
171 UniquePtrVector<PDBSymbolTypeBaseClass> Bases;
172 UniquePtrVector<PDBSymbolTypeVTable> VTables;
173 UniquePtrVector<PDBSymbolData> Members;
174 UniquePtrVector<PDBSymbolTypeBaseClass> VirtualBaseSyms;
177 while (
auto Child = Children->getNext()) {
178 if (
auto Base = unique_dyn_cast<PDBSymbolTypeBaseClass>(Child)) {
179 if (
Base->isVirtualBaseClass())
180 VirtualBaseSyms.push_back(std::move(
Base));
182 Bases.push_back(std::move(
Base));
184 else if (
auto Data = unique_dyn_cast<PDBSymbolData>(Child)) {
186 Members.push_back(std::move(
Data));
189 }
else if (
auto VT = unique_dyn_cast<PDBSymbolTypeVTable>(Child))
190 VTables.push_back(std::move(VT));
191 else if (
auto Func = unique_dyn_cast<PDBSymbolFunc>(Child))
192 Funcs.push_back(std::move(Func));
194 Other.push_back(std::move(Child));
200 AllBases.reserve(Bases.size() + VirtualBaseSyms.size());
206 for (
auto &
Base : Bases) {
209 auto BL = llvm::make_unique<BaseClassLayout>(*
this,
Offset,
false,
217 assert(VTables.size() <= 1);
218 if (!VTables.empty()) {
220 llvm::make_unique<VTableLayoutItem>(*
this, std::move(VTables[0]));
227 for (
auto &
Data : Members) {
228 auto DM = llvm::make_unique<DataMemberLayoutItem>(*
this, std::move(
Data));
236 for (
auto &
VB : VirtualBaseSyms) {
237 int VBPO =
VB->getVirtualBasePointerOffset();
239 if (
auto VBP =
VB->getRawSymbol().getVirtualBaseTableType()) {
240 auto VBPL = llvm::make_unique<VBPtrLayoutItem>(*
this, std::move(VBP),
241 VBPO, VBP->getLength());
252 bool Elide = (
Parent !=
nullptr);
254 llvm::make_unique<BaseClassLayout>(*
this,
Offset, Elide, std::move(
VB));
272 if (
BL->hasVBPtrAtOffset(Off -
BL->getOffsetInParent()))
279 uint32_t Begin = Child->getOffsetInParent();
281 if (!Child->isElided()) {
282 BitVector ChildBytes = Child->usedBytes();
289 ChildBytes <<= Child->getOffsetInParent();
292 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.
UniquePtrVector< LayoutItemBase > ChildStorage
bool hasUDTLayout() const
VTableLayoutItem(const UDTLayoutBase &Parent, std::unique_ptr< PDBSymbolTypeVTable > VTable)
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
amdgpu Simplify well known AMD library false Value Value const Twine & Name
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)
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
ClassLayout(const PDBSymbolTypeUDT &UDT)
size_type size() const
size - Returns the number of bits in this bitvector.
auto upper_bound(R &&Range, ForwardIt I) -> decltype(adl_begin(Range))
Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly...
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)
virtual uint64_t getLength() const =0