53 : Symbol(Symbol), Parent(Parent),
Name(
Name),
54 OffsetInParent(OffsetInParent), SizeOf(
Size), LayoutSize(
Size),
74 auto Type = DataMember->getType();
75 if (
auto UDT = unique_dyn_cast<PDBSymbolTypeUDT>(
Type)) {
76 UdtLayout = std::make_unique<ClassLayout>(std::move(
UDT));
82 std::unique_ptr<PDBSymbolTypeBuiltin>
Sym,
89 return *cast<PDBSymbolData>(
Symbol);
99 std::unique_ptr<PDBSymbolTypeVTable> VT)
102 auto VTableType = cast<PDBSymbolTypePointer>(VTable->getType());
103 ElementSize = VTableType->getLength();
123 uint32_t ChildPadding = Back->LayoutItemBase::tailPadding();
124 if (Abs < ChildPadding)
137 uint32_t Begin = LI->getOffsetInParent();
140 ImmediateUsedBytes.
set(Begin,
End);
146 OwnedStorage = std::move(
UDT);
154 uint32_t OffsetInParent,
bool Elide,
155 std::unique_ptr<PDBSymbolTypeBaseClass>
B)
164 IsVirtualBase = Base->isVirtualBaseClass();
172 UniquePtrVector<PDBSymbolTypeBaseClass> Bases;
173 UniquePtrVector<PDBSymbolTypeVTable> VTables;
174 UniquePtrVector<PDBSymbolData> Members;
175 UniquePtrVector<PDBSymbolTypeBaseClass> VirtualBaseSyms;
177 auto Children =
Sym.findAllChildren();
178 while (
auto Child = Children->getNext()) {
179 if (
auto Base = unique_dyn_cast<PDBSymbolTypeBaseClass>(Child)) {
180 if (
Base->isVirtualBaseClass())
181 VirtualBaseSyms.push_back(std::move(
Base));
183 Bases.push_back(std::move(
Base));
185 else if (
auto Data = unique_dyn_cast<PDBSymbolData>(Child)) {
187 Members.push_back(std::move(
Data));
190 }
else if (
auto VT = unique_dyn_cast<PDBSymbolTypeVTable>(Child))
191 VTables.push_back(std::move(VT));
192 else if (
auto Func = unique_dyn_cast<PDBSymbolFunc>(Child))
193 Funcs.push_back(std::move(Func));
195 Other.push_back(std::move(Child));
201 AllBases.reserve(Bases.size() + VirtualBaseSyms.size());
207 for (
auto &
Base : Bases) {
210 auto BL = std::make_unique<BaseClassLayout>(*
this,
Offset,
false,
218 assert(VTables.size() <= 1);
219 if (!VTables.empty()) {
221 std::make_unique<VTableLayoutItem>(*
this, std::move(VTables[0]));
228 for (
auto &
Data : Members) {
229 auto DM = std::make_unique<DataMemberLayoutItem>(*
this, std::move(
Data));
237 for (
auto &VB : VirtualBaseSyms) {
238 int VBPO = VB->getVirtualBasePointerOffset();
240 if (
auto VBP = VB->getRawSymbol().getVirtualBaseTableType()) {
241 auto VBPL = std::make_unique<VBPtrLayoutItem>(*
this, std::move(VBP),
242 VBPO, VBP->getLength());
253 bool Elide = (
Parent !=
nullptr);
255 std::make_unique<BaseClassLayout>(*
this,
Offset, Elide, std::move(VB));
273 if (BL->hasVBPtrAtOffset(Off - BL->getOffsetInParent()))
280 uint32_t Begin = Child->getOffsetInParent();
282 if (!Child->isElided()) {
283 BitVector ChildBytes = Child->usedBytes();
290 ChildBytes <<= Child->getOffsetInParent();
293 if (ChildBytes.
count() > 0) {
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements the BitVector class.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static RegisterPass< DebugifyModulePass > DM("debugify", "Attach debug info to everything")
static StringRef getName(Value *V)
static uint32_t getTypeLength(const PDBSymbol &Symbol)
static std::unique_ptr< PDBSymbol > getSymbolType(const PDBSymbol &Symbol)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
void resize(unsigned N, bool t=false)
resize - Grow or shrink the bitvector.
int find_last() const
find_last - Returns the index of the last set bit, -1 if none of the bits are set.
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.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM_ABI BaseClassLayout(const UDTLayoutBase &Parent, uint32_t OffsetInParent, bool Elide, std::unique_ptr< PDBSymbolTypeBaseClass > Base)
uint32_t immediatePadding() const override
ClassLayout(const PDBSymbolTypeUDT &UDT)
LLVM_ABI const PDBSymbolData & getDataMember()
LLVM_ABI DataMemberLayoutItem(const UDTLayoutBase &Parent, std::unique_ptr< PDBSymbolData > DataMember)
LLVM_ABI bool hasUDTLayout() const
LLVM_ABI const ClassLayout & getUDTLayout() const
IPDBRawSymbol defines an interface used to represent an arbitrary symbol.
virtual uint64_t getLength() const =0
virtual SymIndexId getTypeId() const =0
IPDBSession defines an interface used to provide a context for querying debug information from a debu...
virtual std::unique_ptr< PDBSymbol > getSymbolById(SymIndexId SymbolId) const =0
virtual uint32_t tailPadding() const
uint32_t deepPaddingSize() const
uint32_t getOffsetInParent() const
LayoutItemBase(const UDTLayoutBase *Parent, const PDBSymbol *Symbol, const std::string &Name, uint32_t OffsetInParent, uint32_t Size, bool IsElided)
const UDTLayoutBase * Parent
PDBSymbol defines the base of the inheritance hierarchy for concrete symbol types (e....
ArrayRef< BaseClassLayout * > VirtualBases
bool hasVBPtrAtOffset(uint32_t Off) const
std::vector< LayoutItemBase * > LayoutItems
UniquePtrVector< PDBSymbol > Other
uint32_t tailPadding() const override
void addChildToLayout(std::unique_ptr< LayoutItemBase > Child)
std::vector< BaseClassLayout * > AllBases
UniquePtrVector< PDBSymbolFunc > Funcs
VTableLayoutItem * VTable
void initializeChildren(const PDBSymbol &Sym)
UniquePtrVector< LayoutItemBase > ChildStorage
ArrayRef< BaseClassLayout * > NonVirtualBases
UDTLayoutBase(const UDTLayoutBase *Parent, const PDBSymbol &Sym, const std::string &Name, uint32_t OffsetInParent, uint32_t Size, bool IsElided)
LLVM_ABI VBPtrLayoutItem(const UDTLayoutBase &Parent, std::unique_ptr< PDBSymbolTypeBuiltin > Sym, uint32_t Offset, uint32_t Size)
LLVM_ABI VTableLayoutItem(const UDTLayoutBase &Parent, std::unique_ptr< PDBSymbolTypeVTable > VTable)
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...
static Error getOffset(const SymbolRef &Sym, SectionRef Sec, uint64_t &Result)
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.