32 using namespace llvm::pdb;
52 : Symbol(Symbol), Parent(Parent), Name(Name),
53 OffsetInParent(OffsetInParent), SizeOf(Size), LayoutSize(Size),
69 const UDTLayoutBase &Parent, std::unique_ptr<PDBSymbolData> Member)
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,
84 Type(std::move(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();
139 ImmediateUsedBytes.
set(Begin, End);
145 OwnedStorage = std::move(UDT);
153 uint32_t OffsetInParent,
bool Elide,
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.
const IPDBSession & getSession() const
size_type size() const
size - Returns the number of bits in this bitvector.
IPDBSession defines an interface used to provide a context for querying debug information from a debu...
UniquePtrVector< PDBSymbolFunc > Funcs
const UDTLayoutBase * Parent
DataMemberLayoutItem(const UDTLayoutBase &Parent, std::unique_ptr< PDBSymbolData > DataMember)
UniquePtrVector< PDBSymbol > Other
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with tries to cleanse the provided crash input to make it contain fewer original bytes Use with exact_artifact_path to specify the output Experimental Use value profile to guide fuzzing Number of jobs to run If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
std::unique_ptr< ConcreteSymbolEnumerator< T > > findAllChildren() const
UniquePtrVector< LayoutItemBase > ChildStorage
VTableLayoutItem(const UDTLayoutBase &Parent, std::unique_ptr< PDBSymbolTypeVTable > VTable)
uint32_t getOffsetInParent() const
virtual uint32_t tailPadding() const
int find_last() const
find_last - Returns the index of the last set bit, -1 if none of the bits are set.
ArrayRef< BaseClassLayout * > VirtualBases
UDTLayoutBase(const UDTLayoutBase *Parent, const PDBSymbol &Sym, const std::string &Name, uint32_t OffsetInParent, uint32_t Size, bool IsElided)
uint32_t deepPaddingSize() const
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
static StringRef getName(Value *V)
std::vector< LayoutItemBase * > LayoutItems
bool hasUDTLayout() const
const PDBSymbolData & getDataMember()
const ClassLayout & getUDTLayout() const
static Error getOffset(const SymbolRef &Sym, SectionRef Sec, uint64_t &Result)
Function Alias Analysis false
uint32_t tailPadding() const override
size_type count() const
count - Returns the number of bits which are set.
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)
static const unsigned End
bool hasVBPtrAtOffset(uint32_t Off) const
void addChildToLayout(std::unique_ptr< LayoutItemBase > Child)
VTableLayoutItem * VTable
virtual std::unique_ptr< PDBSymbol > getSymbolById(uint32_t SymbolId) const =0
PDBSymbol defines the base of the inheritance hierarchy for concrete symbol types (e...
virtual uint32_t getTypeId() const =0
static std::unique_ptr< PDBSymbol > getSymbolType(const PDBSymbol &Symbol)
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
const IPDBRawSymbol & getRawSymbol() const
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)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void initializeChildren(const PDBSymbol &Sym)
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