73 auto Type = DataMember->getType();
75 UdtLayout = std::make_unique<ClassLayout>(std::move(
UDT));
81 std::unique_ptr<PDBSymbolTypeBuiltin> Sym,
98 std::unique_ptr<PDBSymbolTypeVTable> VT)
102 ElementSize = VTableType->getLength();
122 uint32_t ChildPadding = Back->LayoutItemBase::tailPadding();
123 if (Abs < ChildPadding)
134 ImmediateUsedBytes.resize(
SizeOf,
false);
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);
149 return SizeOf - ImmediateUsedBytes.count();
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()) {
179 if (
Base->isVirtualBaseClass())
180 VirtualBaseSyms.push_back(std::move(
Base));
182 Bases.push_back(std::move(
Base));
186 Members.push_back(std::move(
Data));
190 VTables.push_back(std::move(VT));
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 = std::make_unique<BaseClassLayout>(*
this,
Offset,
false,
217 assert(VTables.size() <= 1);
218 if (!VTables.empty()) {
220 std::make_unique<VTableLayoutItem>(*
this, std::move(VTables[0]));
227 for (
auto &
Data : Members) {
228 auto DM = std::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 = std::make_unique<VBPtrLayoutItem>(*
this, std::move(VBP),
241 VBPO, VBP->getLength());
252 bool Elide = (
Parent !=
nullptr);
254 std::make_unique<BaseClassLayout>(*
this,
Offset, Elide, std::move(VB));
269 if (
VBPtr &&
VBPtr->getOffsetInParent() == Off)
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) {
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 uint32_t getTypeLength(const PDBSymbol &Symbol)
static std::unique_ptr< PDBSymbol > getSymbolType(const PDBSymbol &Symbol)
void resize(unsigned N, bool t=false)
Grow or shrink the bitvector.
size_type count() const
Returns the number of bits which are set.
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
StringRef getName() const
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....
std::unique_ptr< ConcreteSymbolEnumerator< T > > findAllChildren() const
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.
CastInfo< X, std::unique_ptr< Y > >::CastResultType unique_dyn_cast(std::unique_ptr< Y > &Val)
unique_dyn_cast<X> - Given a unique_ptr<Y>, try to return a unique_ptr<X>, taking ownership of the in...
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)
ArrayRef(const T &OneElt) -> ArrayRef< T >
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Implement std::hash so that hash_code can be used in STL containers.