LLVM: lib/DebugInfo/PDB/UDTLayout.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

27#include

28#include

29#include

30#include

31

32using namespace llvm;

34

41

48

58

62

68

74 auto Type = DataMember->getType();

76 UdtLayout = std::make_unique(std::move(UDT));

77 UsedBytes = UdtLayout->usedBytes();

78 }

79}

80

82 std::unique_ptr Sym,

86}

87

91

93

95 return *UdtLayout;

96}

97

99 std::unique_ptr VT)

103 ElementSize = VTableType->getLength();

104}

105

118

123 uint32_t ChildPadding = Back->LayoutItemBase::tailPadding();

124 if (Abs < ChildPadding)

125 Abs = 0;

126 else

127 Abs -= ChildPadding;

128 }

129 return Abs;

130}

131

134 UDT(UDT) {

135 ImmediateUsedBytes.resize(SizeOf, false);

137 uint32_t Begin = LI->getOffsetInParent();

138 uint32_t End = Begin + LI->getLayoutSize();

139 End = std::min(SizeOf, End);

140 ImmediateUsedBytes.set(Begin, End);

141 }

142}

143

146 OwnedStorage = std::move(UDT);

147}

148

150 return SizeOf - ImmediateUsedBytes.count();

151}

152

155 std::unique_ptr B)

157 Elide),

160

163 }

164 IsVirtualBase = Base->isVirtualBaseClass();

165}

166

168

169

170

171

172 UniquePtrVector Bases;

173 UniquePtrVector VTables;

174 UniquePtrVector Members;

175 UniquePtrVector VirtualBaseSyms;

176

178 while (auto Child = Children->getNext()) {

180 if (Base->isVirtualBaseClass())

181 VirtualBaseSyms.push_back(std::move(Base));

182 else

183 Bases.push_back(std::move(Base));

184 }

187 Members.push_back(std::move(Data));

188 else

189 Other.push_back(std::move(Data));

191 VTables.push_back(std::move(VT));

193 Funcs.push_back(std::move(Func));

194 else {

195 Other.push_back(std::move(Child));

196 }

197 }

198

199

200

201 AllBases.reserve(Bases.size() + VirtualBaseSyms.size());

202

203

204

205

206

207 for (auto &Base : Bases) {

209

210 auto BL = std::make_unique(*this, Offset, false,

211 std::move(Base));

212

213 AllBases.push_back(BL.get());

215 }

217

218 assert(VTables.size() <= 1);

219 if (!VTables.empty()) {

220 auto VTLayout =

221 std::make_unique(*this, std::move(VTables[0]));

222

223 VTable = VTLayout.get();

224

226 }

227

228 for (auto &Data : Members) {

229 auto DM = std::make_unique(*this, std::move(Data));

230

232 }

233

234

235

236

237 for (auto &VB : VirtualBaseSyms) {

238 int VBPO = VB->getVirtualBasePointerOffset();

240 if (auto VBP = VB->getRawSymbol().getVirtualBaseTableType()) {

241 auto VBPL = std::make_unique(*this, std::move(VBP),

242 VBPO, VBP->getLength());

243 VBPtr = VBPL.get();

245 }

246 }

247

248

249

250

251

253 bool Elide = (Parent != nullptr);

254 auto BL =

255 std::make_unique(*this, Offset, Elide, std::move(VB));

256 AllBases.push_back(BL.get());

257

258

259

260

262 }

264

265 if (Parent != nullptr)

267}

268

270 if (VBPtr && VBPtr->getOffsetInParent() == Off)

271 return true;

273 if (BL->hasVBPtrAtOffset(Off - BL->getOffsetInParent()))

274 return true;

275 }

276 return false;

277}

278

280 uint32_t Begin = Child->getOffsetInParent();

281

282 if (!Child->isElided()) {

283 BitVector ChildBytes = Child->usedBytes();

284

285

286

287

288

290 ChildBytes <<= Child->getOffsetInParent();

292

293 if (ChildBytes.count() > 0) {

297 });

298

300 }

301 }

302

304}

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)

Definition UDTLayout.cpp:42

static std::unique_ptr< PDBSymbol > getSymbolType(const PDBSymbol &Symbol)

Definition UDTLayout.cpp:35

void resize(unsigned N, bool t=false)

resize - Grow or shrink the bitvector.

size_type count() const

count - Returns the number of bits which are set.

LLVM_ABI BaseClassLayout(const UDTLayoutBase &Parent, uint32_t OffsetInParent, bool Elide, std::unique_ptr< PDBSymbolTypeBaseClass > Base)

Definition UDTLayout.cpp:153

uint32_t immediatePadding() const override

Definition UDTLayout.cpp:149

ClassLayout(const PDBSymbolTypeUDT &UDT)

Definition UDTLayout.cpp:132

LLVM_ABI const PDBSymbolData & getDataMember()

Definition UDTLayout.cpp:88

LLVM_ABI DataMemberLayoutItem(const UDTLayoutBase &Parent, std::unique_ptr< PDBSymbolData > DataMember)

Definition UDTLayout.cpp:69

LLVM_ABI bool hasUDTLayout() const

Definition UDTLayout.cpp:92

LLVM_ABI const ClassLayout & getUDTLayout() const

Definition UDTLayout.cpp:94

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

Definition UDTLayout.cpp:63

uint32_t deepPaddingSize() const

Definition UDTLayout.cpp:59

uint32_t getOffsetInParent() const

LayoutItemBase(const UDTLayoutBase *Parent, const PDBSymbol *Symbol, const std::string &Name, uint32_t OffsetInParent, uint32_t Size, bool IsElided)

Definition UDTLayout.cpp:49

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

Definition UDTLayout.cpp:269

std::vector< LayoutItemBase * > LayoutItems

UniquePtrVector< PDBSymbol > Other

uint32_t tailPadding() const override

Definition UDTLayout.cpp:119

void addChildToLayout(std::unique_ptr< LayoutItemBase > Child)

Definition UDTLayout.cpp:279

std::vector< BaseClassLayout * > AllBases

UniquePtrVector< PDBSymbolFunc > Funcs

VTableLayoutItem * VTable

void initializeChildren(const PDBSymbol &Sym)

Definition UDTLayout.cpp:167

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)

Definition UDTLayout.cpp:106

LLVM_ABI VBPtrLayoutItem(const UDTLayoutBase &Parent, std::unique_ptr< PDBSymbolTypeBuiltin > Sym, uint32_t Offset, uint32_t Size)

Definition UDTLayout.cpp:81

LLVM_ABI VTableLayoutItem(const UDTLayoutBase &Parent, std::unique_ptr< PDBSymbolTypeVTable > VTable)

Definition UDTLayout.cpp:98

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 - Given a unique_ptr, try to return a unique_ptr, 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 - Return the argument parameter cast to the specified type.

Implement std::hash so that hash_code can be used in STL containers.