LLDB mainline
UdtRecordCompleter.cpp
Go to the documentation of this file.
2
4#include "PdbIndex.h"
5#include "PdbSymUid.h"
6#include "PdbUtil.h"
7
12#include "SymbolFileNativePDB.h"
13#include "lldb/Core/Address.h"
14#include "lldb/Symbol/Type.h"
17#include "lldb/lldb-forward.h"
18
19#include "llvm/ADT/STLExtras.h"
20#include "llvm/DebugInfo/CodeView/Formatters.h"
21#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
22#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
23#include "llvm/DebugInfo/CodeView/TypeIndex.h"
24#include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
25#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
26#include "llvm/DebugInfo/PDB/PDBTypes.h"
27#include <optional>
28
29using namespace llvm::codeview;
30using namespace llvm::pdb;
31using namespace lldb;
32using namespace lldb_private;
33using namespace lldb_private::npdb;
34
35using Error = llvm::Error;
36
38 PdbTypeSymId id, CompilerType &derived_ct, clang::TagDecl &tag_decl,
39 PdbAstBuilderClang &ast_builder, PdbIndex &index,
40 llvm::DenseMap<clang::Decl *, DeclStatus> &decl_to_status)
41 : m_cv_tag_record(CVTagRecord::create(index.tpi().getType(id.index))),
42 m_id(id), m_derived_ct(derived_ct), m_tag_decl(tag_decl),
43 m_ast_builder(ast_builder), m_index(index),
44 m_decl_to_status(decl_to_status) {
45 switch (m_cv_tag_record.kind()) {
46 case CVTagRecord::Enum:
47 break;
48 case CVTagRecord::Union:
49 m_layout.bit_size = m_cv_tag_record.asUnion().getSize() * 8;
50 m_record.record.kind = Member::Union;
51 break;
52 case CVTagRecord::Class:
53 case CVTagRecord::Struct:
54 m_layout.bit_size = m_cv_tag_record.asClass().getSize() * 8;
55 m_record.record.kind = Member::Struct;
56 break;
57 }
58}
59
60llvm::Error
61UdtRecordCompleter::visitMemberEnd(llvm::codeview::CVMemberRecord &Record) {
63 return Error::success();
64}
65
67 llvm::codeview::TypeIndex ti, llvm::codeview::MemberAccess access,
68 std::optional<uint64_t> vtable_idx) {
69 PdbTypeSymId type_id(ti);
70 clang::QualType qt = m_ast_builder.GetOrCreateClangType(type_id);
71
72 CVType udt_cvt = m_index.tpi().getType(ti);
73
74 std::unique_ptr<clang::CXXBaseSpecifier> base_spec =
75 m_ast_builder.clang().CreateBaseClassSpecifier(
76 qt.getAsOpaquePtr(), TranslateMemberAccess(access),
77 vtable_idx.has_value(), udt_cvt.kind() == LF_CLASS);
78 if (!base_spec)
79 return {};
80
81 m_bases.push_back(
82 std::make_pair(vtable_idx.value_or(0), std::move(base_spec)));
83
84 return qt;
85}
86
87void UdtRecordCompleter::AddMethod(llvm::StringRef name, TypeIndex type_idx,
88 MethodOptions options,
89 MemberAttributes attrs) {
90 clang::QualType method_qt =
91 m_ast_builder.GetOrCreateClangType(PdbTypeSymId(type_idx));
92 if (method_qt.isNull())
93 return;
94 CompilerType method_ct = m_ast_builder.ToCompilerType(method_qt);
96 bool is_artificial = (options & MethodOptions::CompilerGenerated) ==
97 MethodOptions::CompilerGenerated;
98 auto *pdb = static_cast<SymbolFileNativePDB *>(
99 m_ast_builder.clang().GetSymbolFile()->GetBackingSymbolFile());
100 std::string asm_label = pdb->GetMethodCallLabel(
101 type_idx, (m_cv_tag_record.name() + "::" + name).str());
102 m_ast_builder.GetOrCreateMethodDecl(m_derived_ct.GetOpaqueQualType(), name,
103 asm_label, method_ct, attrs.isVirtual(),
104 attrs.isStatic(), is_artificial);
105}
106
107Error UdtRecordCompleter::visitKnownMember(CVMemberRecord &cvr,
108 BaseClassRecord &base) {
109 clang::QualType base_qt =
110 AddBaseClassForTypeIndex(base.Type, base.getAccess());
111
112 if (base_qt.isNull())
113 return llvm::Error::success();
114 auto *decl =
115 m_ast_builder.clang().GetAsCXXRecordDecl(base_qt.getAsOpaquePtr());
116 if (!decl) {
117 LLDB_LOG(GetLog(LLDBLog::Symbols), "base ({0}) of {1} is not a record",
118 base.Type, m_id.index);
119 return Error::success();
120 }
121
122 auto offset = clang::CharUnits::fromQuantity(base.getBaseOffset());
123 m_layout.base_offsets.insert(std::make_pair(decl, offset));
124
125 return llvm::Error::success();
126}
127
128Error UdtRecordCompleter::visitKnownMember(CVMemberRecord &cvr,
129 VirtualBaseClassRecord &base) {
130 // Don't create indirect virtual bases. These records indicate that at least
131 // one base class C of this class virtually inherits the specified class.
132 // We already added that virtual base when creating C. There, it's present as
133 // LF_VBCLASS.
134 if (cvr.Kind == LF_VBCLASS)
135 AddBaseClassForTypeIndex(base.BaseType, base.getAccess(), base.VTableIndex);
136
137 return Error::success();
138}
139
140Error UdtRecordCompleter::visitKnownMember(CVMemberRecord &cvr,
141 ListContinuationRecord &cont) {
142 return Error::success();
143}
144
145Error UdtRecordCompleter::visitKnownMember(CVMemberRecord &cvr,
146 VFPtrRecord &vfptr) {
147 return Error::success();
148}
149
150Error UdtRecordCompleter::visitKnownMember(
151 CVMemberRecord &cvr, StaticDataMemberRecord &static_data_member) {
152 clang::QualType member_type =
153 m_ast_builder.GetOrCreateClangType(PdbTypeSymId(static_data_member.Type));
154 if (member_type.isNull())
155 return llvm::Error::success();
156
157 CompilerType member_ct = m_ast_builder.ToCompilerType(member_type);
158
160 m_derived_ct, static_data_member.Name, member_ct);
161
162 // Static constant members may be a const[expr] declaration.
163 // Query the symbol's value as the variable initializer if valid.
164 if (member_ct.IsConst() && member_ct.IsCompleteType()) {
165 // Reconstruct the full name for the static member. Use the names as given
166 // in the PDB. This ensures we match the compiler's style of names (e.g.
167 // "A<B<int> >::Foo" vs "A<B<int>>::Foo").
168 std::string qual_name =
169 (m_cv_tag_record.name() + "::" + static_data_member.Name).str();
170
171 auto results =
172 m_index.globals().findRecordsByName(qual_name, m_index.symrecords());
173
174 for (const auto &result : results) {
175 if (result.second.kind() == SymbolKind::S_CONSTANT) {
176 ConstantSym constant(SymbolRecordKind::ConstantSym);
177 cantFail(SymbolDeserializer::deserializeAs<ConstantSym>(result.second,
178 constant));
179
180 clang::QualType qual_type = decl->getType();
181 unsigned type_width = decl->getASTContext().getIntWidth(qual_type);
182
183 // Get the minimum bit width to encode this constant value.
184 // The bit width of the APSInt might be larger than the bits required to
185 // encode the value.
186 unsigned min_constant_width = 0;
187 if (qual_type->isUnsignedIntegerOrEnumerationType())
188 min_constant_width = constant.Value.getActiveBits();
189 else
190 min_constant_width = constant.Value.getSignificantBits();
191
192 if (qual_type->isIntegralOrEnumerationType()) {
193 if (type_width >= min_constant_width) {
195 decl, constant.Value.extOrTrunc(type_width));
196 } else {
198 "Class '{0}' has a member '{1}' of type '{2}' ({3} bits) "
199 "which resolves to a wider constant value ({4} bits). "
200 "Ignoring constant.",
201 m_derived_ct.GetTypeName(), static_data_member.Name,
202 member_ct.GetTypeName(), type_width, min_constant_width);
203 }
204 } else {
205 lldb::BasicType basic_type_enum = member_ct.GetBasicTypeEnumeration();
206 switch (basic_type_enum) {
210 if (type_width == min_constant_width) {
212 decl, basic_type_enum == lldb::eBasicTypeFloat
213 ? llvm::APFloat(constant.Value.bitsToFloat())
214 : llvm::APFloat(constant.Value.bitsToDouble()));
215 decl->setConstexpr(true);
216 } else {
217 LLDB_LOG(
219 "Class '{0}' has a member '{1}' of type '{2}' ({3} bits) "
220 "which resolves to a constant value of mismatched width "
221 "({4} bits). Ignoring constant.",
222 m_derived_ct.GetTypeName(), static_data_member.Name,
223 member_ct.GetTypeName(), type_width, min_constant_width);
224 }
225 break;
226 default:
227 break;
228 }
229 }
230 break;
231 }
232 }
233 }
234
235 // FIXME: Add a PdbSymUid namespace for field list members and update
236 // the m_uid_to_decl map with this decl.
237 return Error::success();
238}
239
240Error UdtRecordCompleter::visitKnownMember(CVMemberRecord &cvr,
241 NestedTypeRecord &nested) {
242 // Typedefs can only be added on structs.
243 if (m_record.record.kind != Member::Struct)
244 return Error::success();
245
246 clang::QualType qt =
247 m_ast_builder.GetOrCreateClangType(PdbTypeSymId(nested.Type, false));
248 if (qt.isNull())
249 return Error::success();
250 CompilerType ct = m_ast_builder.ToCompilerType(qt);
251
252 // There's no distinction between nested types and typedefs, so check if we
253 // encountered a nested type.
254 auto *pdb = static_cast<SymbolFileNativePDB *>(
255 m_ast_builder.clang().GetSymbolFile()->GetBackingSymbolFile());
256 std::optional<TypeIndex> parent = pdb->GetParentType(nested.Type);
257 if (parent && *parent == m_id.index && ct.GetTypeName(true) == nested.Name)
258 return Error::success();
259
260 clang::DeclContext *decl_ctx =
261 m_ast_builder.GetOrCreateClangDeclContextForUid(m_id);
262 if (!decl_ctx)
263 return Error::success();
264
265 std::string name = nested.Name.str();
266 ct.CreateTypedef(name.c_str(), m_ast_builder.ToCompilerDeclContext(decl_ctx),
267 0);
268 return Error::success();
269}
270
271Error UdtRecordCompleter::visitKnownMember(CVMemberRecord &cvr,
272 DataMemberRecord &data_member) {
273
274 uint64_t offset = data_member.FieldOffset * 8;
275 uint32_t bitfield_width = 0;
276
277 TypeIndex ti(data_member.Type);
278 if (!ti.isSimple()) {
279 CVType cvt = m_index.tpi().getType(ti);
280 if (cvt.kind() == LF_BITFIELD) {
281 BitFieldRecord bfr;
282 llvm::cantFail(TypeDeserializer::deserializeAs<BitFieldRecord>(cvt, bfr));
283 offset += bfr.BitOffset;
284 bitfield_width = bfr.BitSize;
285 ti = bfr.Type;
286 }
287 }
288
289 clang::QualType member_qt =
290 m_ast_builder.GetOrCreateClangType(PdbTypeSymId(ti));
291 if (member_qt.isNull())
292 return Error::success();
293 TypeSystemClang::RequireCompleteType(m_ast_builder.ToCompilerType(member_qt));
294 lldb::AccessType access = TranslateMemberAccess(data_member.getAccess());
295 size_t field_size =
296 bitfield_width ? bitfield_width : GetSizeOfType(ti, m_index.tpi()) * 8;
297 if (field_size == 0)
298 return Error::success();
299 m_record.CollectMember(data_member.Name, offset, field_size, member_qt,
300 access, bitfield_width, m_member_index);
301 return Error::success();
302}
303
304Error UdtRecordCompleter::visitKnownMember(CVMemberRecord &cvr,
305 OneMethodRecord &one_method) {
306 AddMethod(one_method.Name, one_method.Type, one_method.getOptions(),
307 one_method.Attrs);
308
309 return Error::success();
310}
311
312Error UdtRecordCompleter::visitKnownMember(CVMemberRecord &cvr,
313 OverloadedMethodRecord &overloaded) {
314 TypeIndex method_list_idx = overloaded.MethodList;
315
316 CVType method_list_type = m_index.tpi().getType(method_list_idx);
317 assert(method_list_type.kind() == LF_METHODLIST);
318
319 MethodOverloadListRecord method_list;
320 llvm::cantFail(TypeDeserializer::deserializeAs<MethodOverloadListRecord>(
321 method_list_type, method_list));
322
323 for (const OneMethodRecord &method : method_list.Methods)
324 AddMethod(overloaded.Name, method.Type, method.getOptions(), method.Attrs);
325
326 return Error::success();
327}
328
329Error UdtRecordCompleter::visitKnownMember(CVMemberRecord &cvr,
330 EnumeratorRecord &enumerator) {
331 Declaration decl;
332 llvm::StringRef name = DropNameScope(enumerator.getName());
333
334 clang::EnumDecl *enum_decl = TypeSystemClang::GetAsEnumDecl(m_derived_ct);
335 if (!enum_decl)
336 return Error::success();
337
338 llvm::APSInt val = enumerator.Value;
339 clang::QualType int_ty = enum_decl->getIntegerType();
340 uint64_t n_bits = m_ast_builder.clang().getASTContext().getTypeSize(int_ty);
341 if (n_bits == 0)
342 return Error::success();
343
344 // MSVC encodes 64 Bit unsigned enum values as signed integers. For example,
345 // ULONGLONG_MAX will be encoded as -1. LLVM encodes all values as unsigned.
346 // Fix this by explicitly setting the bit width and signedness.
347 val = val.extOrTrunc(n_bits);
348 val.setIsSigned(int_ty->isSignedIntegerType());
349
350 m_ast_builder.clang().AddEnumerationValueToEnumerationType(
351 m_derived_ct, decl, name.str().c_str(), val);
352 return Error::success();
353}
354
356 // Ensure the correct order for virtual bases.
357 llvm::stable_sort(m_bases, llvm::less_first());
358
359 std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> bases;
360 bases.reserve(m_bases.size());
361 for (auto &ib : m_bases)
362 bases.push_back(std::move(ib.second));
363
365 // Make sure all base classes refer to complete types and not forward
366 // declarations. If we don't do this, clang will crash with an
367 // assertion in the call to clang_type.TransferBaseClasses()
368 for (const auto &base_class : bases) {
369 clang::TypeSourceInfo *type_source_info =
370 base_class->getTypeSourceInfo();
371 if (type_source_info) {
373 clang.GetType(type_source_info->getType()));
374 }
375 }
376
377 clang.TransferBaseClasses(m_derived_ct.GetOpaqueQualType(), std::move(bases));
378
379 clang.AddMethodOverridesForCXXRecordType(m_derived_ct.GetOpaqueQualType());
380 FinishRecord();
383
384 if (auto *record_decl = llvm::dyn_cast<clang::CXXRecordDecl>(&m_tag_decl)) {
385 m_ast_builder.GetClangASTImporter().SetRecordLayout(record_decl, m_layout);
386 }
387}
388
389uint64_t
391 uint64_t bit_offset, CompilerType parent_ct,
392 ClangASTImporter::LayoutInfo &parent_layout,
393 clang::DeclContext *parent_decl_ctx) {
395 clang.GetSymbolFile()->GetBackingSymbolFile());
396 clang::FieldDecl *field_decl = nullptr;
397 uint64_t bit_size = 0;
398 switch (field->kind) {
399 case Member::Field: {
401 parent_ct, field->name, m_ast_builder.ToCompilerType(field->qt),
402 field->bitfield_width);
403 bit_size = field->bit_size;
404 break;
405 };
406 case Member::Struct:
407 case Member::Union: {
408 clang::TagTypeKind kind = field->kind == Member::Struct
409 ? clang::TagTypeKind::Struct
410 : clang::TagTypeKind::Union;
411 ClangASTMetadata metadata;
412 metadata.SetUserID(pdb->anonymous_id);
413 metadata.SetIsDynamicCXXType(false);
414 CompilerType record_ct = clang.CreateRecordType(
415 parent_decl_ctx, OptionalClangModuleID(), "", llvm::to_underlying(kind),
419 clang::DeclContext *decl_ctx = clang.GetDeclContextForType(record_ct);
420 for (const auto &member : field->fields) {
421 uint64_t member_offset = field->kind == Member::Struct
422 ? member->bit_offset - field->base_offset
423 : 0;
424 uint64_t member_bit_size = AddMember(clang, member.get(), member_offset,
425 record_ct, layout, decl_ctx);
426 if (field->kind == Member::Struct)
427 bit_size = std::max(bit_size, member_offset + member_bit_size);
428 else
429 bit_size = std::max(bit_size, member_bit_size);
430 }
431 layout.bit_size = bit_size;
433 clang::RecordDecl *record_decl = clang.GetAsRecordDecl(record_ct);
434 m_ast_builder.GetClangASTImporter().SetRecordLayout(record_decl, layout);
435 field_decl =
436 TypeSystemClang::AddFieldToRecordType(parent_ct, "", record_ct, 0);
437 // Mark this record decl as completed.
438 DeclStatus status;
439 status.resolved = true;
440 status.uid = pdb->anonymous_id--;
441 m_decl_to_status.insert({record_decl, status});
442 break;
443 };
444 }
445 // FIXME: Add a PdbSymUid namespace for field list members and update
446 // the m_uid_to_decl map with this decl.
447 parent_layout.field_offsets.insert({field_decl, bit_offset});
448 return bit_size;
449}
450
453 clang::DeclContext *decl_ctx =
454 m_ast_builder.GetOrCreateClangDeclContextForUid(m_id);
455 m_record.ConstructRecord();
456 // Maybe we should check the construsted record size with the size in pdb. If
457 // they mismatch, it might be pdb has fields info missing.
458 for (const auto &field : m_record.record.fields) {
459 AddMember(clang, field.get(), field->bit_offset, m_derived_ct, m_layout,
460 decl_ctx);
461 }
462}
463
465 llvm::stable_sort(fields, [](const MemberUP &lhs, const MemberUP &rhs) {
466 return std::tie(lhs->original_index, lhs->bit_offset) <
467 std::tie(rhs->original_index, rhs->bit_offset);
468 });
469
470 for (MemberUP &field : fields)
471 field->RestoreOriginalOrder();
472}
473
475 llvm::StringRef name, uint64_t offset, uint64_t field_size,
476 clang::QualType qt, lldb::AccessType access, uint64_t bitfield_width,
477 uint32_t member_index) {
478 fields_map[offset].push_back(std::make_unique<Member>(
479 name, offset, field_size, qt, access, bitfield_width, member_index));
480 if (start_offset > offset)
481 start_offset = offset;
482}
483
485 // For anonymous unions in a struct, msvc generated pdb doesn't have the
486 // entity for that union. So, we need to construct anonymous union and struct
487 // based on field offsets. The final AST is likely not matching the exact
488 // original AST, but the memory layout is preseved.
489 // After we collecting all fields in visitKnownMember, we have all fields in
490 // increasing offset order in m_fields. Since we are iterating in increase
491 // offset order, if the current offset is equal to m_start_offset, we insert
492 // it as direct field of top level record. If the current offset is greater
493 // than m_start_offset, we should be able to find a field in end_offset_map
494 // whose end offset is less than or equal to current offset. (if not, it might
495 // be missing field info. We will ignore the field in this case. e.g. Field A
496 // starts at 0 with size 4 bytes, and Field B starts at 2 with size 4 bytes.
497 // Normally, there must be something which ends at/before 2.) Then we will
498 // append current field to the end of parent record. If parent is struct, we
499 // can just grow it. If parent is a field, it's a field inside an union. We
500 // convert it into an anonymous struct containing old field and new field.
501
502 // The end offset to a vector of field/struct that ends at the offset.
503 std::map<uint64_t, std::vector<Member *>> end_offset_map;
504 auto is_last_end_offset = [&](auto it) {
505 return it != end_offset_map.end() && ++it == end_offset_map.end();
506 };
507
508 for (auto &pair : fields_map) {
509 uint64_t offset = pair.first;
510 auto &fields = pair.second;
511 assert(offset >= start_offset);
512 Member *parent = &record;
513 if (offset > start_offset) {
514 // Find the field with largest end offset that is <= offset. If it's less
515 // than offset, it indicates there are padding bytes between end offset
516 // and offset.
517 assert(!end_offset_map.empty());
518 auto iter = end_offset_map.lower_bound(offset);
519 if (iter == end_offset_map.end())
520 --iter;
521 else if (iter->first > offset) {
522 if (iter == end_offset_map.begin())
523 continue;
524 --iter;
525 }
526 if (iter->second.empty())
527 continue;
528
529 // If the new fields come after the already added ones
530 // without overlap, go back to the root.
531 if (iter->first <= offset && is_last_end_offset(iter)) {
532 if (record.kind == Member::Struct) {
533 parent = &record;
534 } else {
535 assert(record.kind == Member::Union &&
536 "Current record must be a union");
537 assert(!record.fields.empty());
538 // For unions, append the field to the last struct
539 parent = record.fields.back().get();
540 }
541 } else {
542 parent = iter->second.back();
543 iter->second.pop_back();
544 }
545 }
546 // If it's a field, then the field is inside a union, so we can safely
547 // increase its size by converting it to a struct to hold multiple fields.
548 if (parent->kind == Member::Field)
549 parent->ConvertToStruct();
550
551 if (fields.size() == 1) {
552 uint64_t end_offset = offset + fields.back()->bit_size;
553 parent->fields.push_back(std::move(fields.back()));
554 if (parent->kind == Member::Struct) {
555 end_offset_map[end_offset].push_back(parent);
556 } else {
557 assert(parent == &record &&
558 "If parent is union, it must be the top level record.");
559 end_offset_map[end_offset].push_back(parent->fields.back().get());
560 }
561 } else {
562 if (parent->kind == Member::Struct) {
563 parent->fields.push_back(std::make_unique<Member>(Member::Union));
564 parent = parent->fields.back().get();
565 parent->original_index = std::numeric_limits<uint32_t>::max();
566 parent->bit_offset = offset;
567 } else {
568 assert(parent == &record &&
569 "If parent is union, it must be the top level record.");
570 }
571 for (auto &field : fields) {
572 int64_t bit_size = field->bit_size;
573 // Use the lowest index of the union members.
574 parent->original_index =
575 std::min(parent->original_index, field->original_index);
576 parent->fields.push_back(std::move(field));
577 end_offset_map[offset + bit_size].push_back(
578 parent->fields.back().get());
579 }
580 }
581 }
582
583 record.RestoreOriginalOrder();
584}
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition Log.h:375
llvm::Error Error
void SetUserID(lldb::user_id_t user_id)
void SetIsDynamicCXXType(std::optional< bool > b)
Generic representation of a type in a programming language.
lldb::BasicType GetBasicTypeEnumeration() const
ConstString GetTypeName(bool BaseOnly=false) const
CompilerType CreateTypedef(const char *name, const CompilerDeclContext &decl_ctx, uint32_t payload) const
Create a typedef to this type using "name" as the name of the typedef this type is valid and the type...
A TypeSystem implementation based on Clang.
static void SetFloatingInitializerForVariable(clang::VarDecl *var, const llvm::APFloat &init_value)
Initializes a variable with a floating point value.
static void SetIntegerInitializerForVariable(clang::VarDecl *var, const llvm::APInt &init_value)
Initializes a variable with an integer value.
static clang::VarDecl * AddVariableToRecordType(const CompilerType &type, llvm::StringRef name, const CompilerType &var_type)
static void BuildIndirectFields(const CompilerType &type)
static clang::CXXRecordDecl * GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type)
static bool CompleteTagDeclarationDefinition(const CompilerType &type)
static bool StartTagDeclarationDefinition(const CompilerType &type)
static clang::FieldDecl * AddFieldToRecordType(const CompilerType &type, llvm::StringRef name, const CompilerType &field_type, uint32_t bitfield_bit_size)
static clang::EnumDecl * GetAsEnumDecl(const CompilerType &type)
static void RequireCompleteType(CompilerType type)
Complete a type from debug info, or mark it as forcefully completed if there is no definition of the ...
PdbIndex - Lazy access to the important parts of a PDB file.
Definition PdbIndex.h:47
llvm::Error visitMemberEnd(llvm::codeview::CVMemberRecord &Record) override
ClangASTImporter::LayoutInfo m_layout
UdtRecordCompleter(PdbTypeSymId id, CompilerType &derived_ct, clang::TagDecl &tag_decl, PdbAstBuilderClang &ast_builder, PdbIndex &index, llvm::DenseMap< clang::Decl *, DeclStatus > &decl_to_status)
llvm::DenseMap< clang::Decl *, DeclStatus > & m_decl_to_status
uint64_t AddMember(TypeSystemClang &clang, Member *field, uint64_t bit_offset, CompilerType parent_ct, ClangASTImporter::LayoutInfo &parent_layout, clang::DeclContext *decl_ctx)
clang::QualType AddBaseClassForTypeIndex(llvm::codeview::TypeIndex ti, llvm::codeview::MemberAccess access, std::optional< uint64_t > vtable_idx=std::optional< uint64_t >())
uint32_t m_member_index
Index of the current member.
void AddMethod(llvm::StringRef name, llvm::codeview::TypeIndex type_idx, llvm::codeview::MethodOptions options, llvm::codeview::MemberAttributes attrs)
llvm::StringRef DropNameScope(llvm::StringRef name)
Definition PdbUtil.cpp:602
lldb::AccessType TranslateMemberAccess(llvm::codeview::MemberAccess access)
size_t GetSizeOfType(PdbTypeSymId id, llvm::pdb::TpiStream &tpi)
Definition PdbUtil.cpp:1150
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition Log.h:338
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
@ eBasicTypeLongDouble
@ eLanguageTypeC_plus_plus
ISO C++:1998.
llvm::DenseMap< const clang::FieldDecl *, uint64_t > field_offsets
llvm::codeview::TypeIndex index
Definition PdbSymUid.h:73
enum lldb_private::npdb::UdtRecordCompleter::Member::Kind kind
uint32_t original_index
Index of the member inside the LF_FIELDLIST.
std::map< uint64_t, llvm::SmallVector< MemberUP, 1 > > fields_map
void CollectMember(llvm::StringRef name, uint64_t offset, uint64_t field_size, clang::QualType qt, lldb::AccessType access, uint64_t bitfield_width, uint32_t member_index)