13#include "clang/AST/CharUnits.h"
14#include "clang/AST/Decl.h"
15#include "clang/AST/DeclCXX.h"
26#include "llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h"
27#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
28#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
29#include "llvm/DebugInfo/PDB/PDBSymbol.h"
30#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
31#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
32#include "llvm/DebugInfo/PDB/PDBSymbolTypeArray.h"
33#include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h"
34#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
35#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
36#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h"
37#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
38#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
39#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
40#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
51 case PDB_UdtType::Class:
52 return llvm::to_underlying(clang::TagTypeKind::Class);
53 case PDB_UdtType::Struct:
54 return llvm::to_underlying(clang::TagTypeKind::Struct);
55 case PDB_UdtType::Union:
56 return llvm::to_underlying(clang::TagTypeKind::Union);
57 case PDB_UdtType::Interface:
58 return llvm::to_underlying(clang::TagTypeKind::Interface);
60 llvm_unreachable(
"unsuported PDB UDT type");
65 case PDB_BuiltinType::Float:
67 case PDB_BuiltinType::Int:
68 case PDB_BuiltinType::Long:
69 case PDB_BuiltinType::Char:
71 case PDB_BuiltinType::Bool:
72 case PDB_BuiltinType::Char16:
73 case PDB_BuiltinType::Char32:
74 case PDB_BuiltinType::UInt:
75 case PDB_BuiltinType::ULong:
76 case PDB_BuiltinType::HResult:
77 case PDB_BuiltinType::WCharT:
86 case PDB_VariantType::Int8:
87 case PDB_VariantType::Int16:
88 case PDB_VariantType::Int32:
89 case PDB_VariantType::Int64:
92 case PDB_VariantType::UInt8:
93 case PDB_VariantType::UInt16:
94 case PDB_VariantType::UInt32:
95 case PDB_VariantType::UInt64:
107 const PDBSymbolTypeBuiltin &pdb_type,
108 Encoding encoding, uint32_t width) {
111 switch (pdb_type.getBuiltinType()) {
114 case PDB_BuiltinType::None:
116 case PDB_BuiltinType::Void:
118 case PDB_BuiltinType::Char:
120 case PDB_BuiltinType::Bool:
122 case PDB_BuiltinType::Long:
123 if (width == ast.getTypeSize(ast.LongTy))
125 ast.LongTy.getAsOpaquePtr());
126 if (width == ast.getTypeSize(ast.LongLongTy))
128 ast.LongLongTy.getAsOpaquePtr());
130 case PDB_BuiltinType::ULong:
131 if (width == ast.getTypeSize(ast.UnsignedLongTy))
133 ast.UnsignedLongTy.getAsOpaquePtr());
134 if (width == ast.getTypeSize(ast.UnsignedLongLongTy))
136 ast.UnsignedLongLongTy.getAsOpaquePtr());
138 case PDB_BuiltinType::WCharT:
139 if (width == ast.getTypeSize(ast.WCharTy))
141 ast.WCharTy.getAsOpaquePtr());
143 case PDB_BuiltinType::Char16:
145 ast.Char16Ty.getAsOpaquePtr());
146 case PDB_BuiltinType::Char32:
148 ast.Char32Ty.getAsOpaquePtr());
149 case PDB_BuiltinType::Float:
163 PDB_BuiltinType kind = pdb_type.getBuiltinType();
167 case PDB_BuiltinType::Currency:
169 case PDB_BuiltinType::Date:
171 case PDB_BuiltinType::Variant:
173 case PDB_BuiltinType::Complex:
175 case PDB_BuiltinType::Bitfield:
177 case PDB_BuiltinType::BSTR:
179 case PDB_BuiltinType::HResult:
181 case PDB_BuiltinType::BCD:
183 case PDB_BuiltinType::Char16:
185 case PDB_BuiltinType::Char32:
187 case PDB_BuiltinType::None:
194 auto &raw_sym = symbol.getRawSymbol();
195 auto first_line_up = raw_sym.getSrcLineOnTypeDefn();
197 if (!first_line_up) {
198 auto lines_up = symbol.getSession().findLineNumbersByAddress(
199 raw_sym.getVirtualAddress(), raw_sym.getLength());
202 first_line_up = lines_up->getNext();
206 uint32_t src_file_id = first_line_up->getSourceFileId();
207 auto src_file_up = symbol.getSession().getSourceFileById(src_file_id);
211 FileSpec spec(src_file_up->getFileName());
213 decl.
SetColumn(first_line_up->getColumnNumber());
214 decl.
SetLine(first_line_up->getLineNumber());
220 case PDB_MemberAccess::Private:
222 case PDB_MemberAccess::Protected:
224 case PDB_MemberAccess::Public:
232 case PDB_UdtType::Struct:
233 case PDB_UdtType::Union:
235 case PDB_UdtType::Class:
236 case PDB_UdtType::Interface:
239 llvm_unreachable(
"unsupported PDB UDT type");
247 auto parent = udt.getClassParent();
251 auto parent_udt = llvm::dyn_cast<PDBSymbolTypeUDT>(parent.get());
258static clang::MSInheritanceAttr::Spelling
261 bool has_virtual =
false;
263 auto bases_enum = udt.findAllChildren<PDBSymbolTypeBaseClass>();
265 while (
auto base = bases_enum->getNext()) {
267 has_virtual |= base->isVirtualBaseClass();
272 return clang::MSInheritanceAttr::Keyword_virtual_inheritance;
274 return clang::MSInheritanceAttr::Keyword_multiple_inheritance;
275 return clang::MSInheritanceAttr::Keyword_single_inheritance;
278static std::unique_ptr<llvm::pdb::PDBSymbol>
280 const IPDBSession &session = symbol.getSession();
281 const IPDBRawSymbol &raw = symbol.getRawSymbol();
282 auto tag = symbol.getSymTag();
288 case PDB_SymType::Function:
289 case PDB_SymType::Data:
290 case PDB_SymType::UDT:
291 case PDB_SymType::Enum:
292 case PDB_SymType::FunctionSig:
293 case PDB_SymType::Typedef:
294 case PDB_SymType::BaseClass:
295 case PDB_SymType::VTable: {
296 auto class_parent_id = raw.getClassParentId();
297 if (
auto class_parent = session.getSymbolById(class_parent_id))
308 case PDB_SymType::Block:
309 case PDB_SymType::Data: {
310 auto lexical_parent_id = raw.getLexicalParentId();
311 auto lexical_parent = session.getSymbolById(lexical_parent_id);
315 auto lexical_parent_tag = lexical_parent->getSymTag();
316 if (lexical_parent_tag == PDB_SymType::Function)
317 return lexical_parent;
318 if (lexical_parent_tag == PDB_SymType::Exe)
328static clang::NamedDecl *
330 const clang::DeclContext &decl_context,
331 llvm::StringRef name) {
332 clang::IdentifierInfo &ident = ast.Idents.get(name);
333 clang::DeclarationName decl_name = ast.DeclarationNames.getIdentifier(&ident);
334 clang::DeclContext::lookup_result result = decl_context.lookup(decl_name);
338 return *result.begin();
342 return name ==
"`anonymous namespace'" || name ==
"`anonymous-namespace'";
347 case llvm::codeview::CallingConvention::NearC:
349 case llvm::codeview::CallingConvention::NearStdCall:
350 return clang::CC_X86StdCall;
351 case llvm::codeview::CallingConvention::NearFast:
352 return clang::CC_X86FastCall;
353 case llvm::codeview::CallingConvention::ThisCall:
354 return clang::CC_X86ThisCall;
355 case llvm::codeview::CallingConvention::NearVector:
356 return clang::CC_X86VectorCall;
357 case llvm::codeview::CallingConvention::NearPascal:
358 return clang::CC_X86Pascal;
360 assert(
false &&
"Unknown calling convention");
373 switch (type.getSymTag()) {
374 case PDB_SymType::BaseClass: {
379 auto ty = symbol_file->
ResolveTypeUID(type.getRawSymbol().getTypeId());
380 return ty ? ty->shared_from_this() :
nullptr;
382 case PDB_SymType::UDT: {
383 auto udt = llvm::dyn_cast<PDBSymbolTypeUDT>(&type);
394 if (udt->getLength() == 0)
418 metadata.
SetUserID(type.getSymIndexId());
431 auto inheritance_attr = clang::MSInheritanceAttr::CreateImplicit(
433 record_decl->addAttr(inheritance_attr);
437 auto children = udt->findAllChildren();
438 if (!children || children->getChildCount() == 0) {
446 type_resolve_state = Type::ResolveState::Full;
455 type_resolve_state = Type::ResolveState::Forward;
458 type_resolve_state = Type::ResolveState::Forward;
460 if (udt->isConstType())
463 if (udt->isVolatileType())
468 type.getSymIndexId(),
ConstString(name), udt->getLength(),
nullptr,
472 case PDB_SymType::Enum: {
473 auto enum_type = llvm::dyn_cast<PDBSymbolTypeEnum>(&type);
479 uint64_t bytes = enum_type->getLength();
485 auto underlying_type_up = enum_type->getUnderlyingType();
486 if (!underlying_type_up)
493 auto first_child = enum_type->findOneChild<PDBSymbolData>();
500 m_ast, *underlying_type_up, encoding, bytes * 8);
506 bool isScoped =
false;
510 builtin_type, isScoped);
516 auto enum_values = enum_type->findAllChildren<PDBSymbolData>();
518 while (
auto enum_value = enum_values->getNext()) {
519 if (enum_value->getDataKind() != PDB_DataKind::Constant)
529 if (enum_type->isConstType())
532 if (enum_type->isVolatileType())
537 type.getSymIndexId(),
ConstString(name), bytes,
nullptr,
541 case PDB_SymType::Typedef: {
542 auto type_def = llvm::dyn_cast<PDBSymbolTypeTypedef>(&type);
570 assert(typedef_decl);
574 if (type_def->isConstType())
577 if (type_def->isVolatileType())
581 std::optional<uint64_t> size;
582 if (type_def->getLength())
583 size = type_def->getLength();
585 type_def->getSymIndexId(),
ConstString(name), size,
nullptr,
589 case PDB_SymType::Function:
590 case PDB_SymType::FunctionSig: {
592 PDBSymbolTypeFunctionSig *func_sig =
nullptr;
593 if (
auto pdb_func = llvm::dyn_cast<PDBSymbolFunc>(&type)) {
594 if (pdb_func->isCompilerGenerated())
597 auto sig = pdb_func->getSignature();
600 func_sig = sig.release();
604 }
else if (
auto pdb_func_sig =
605 llvm::dyn_cast<PDBSymbolTypeFunctionSig>(&type)) {
606 func_sig =
const_cast<PDBSymbolTypeFunctionSig *
>(pdb_func_sig);
608 llvm_unreachable(
"Unexpected PDB symbol!");
610 auto arg_enum = func_sig->getArguments();
611 uint32_t num_args = arg_enum->getChildCount();
612 std::vector<CompilerType> arg_list;
614 bool is_variadic = func_sig->isCVarArgs();
618 for (uint32_t arg_idx = 0; arg_idx < num_args; arg_idx++) {
619 auto arg = arg_enum->getChildAtIndex(arg_idx);
634 arg_list.push_back(arg_ast_type);
638 auto pdb_return_type = func_sig->getReturnType();
650 uint32_t type_quals = 0;
651 if (func_sig->isConstType())
652 type_quals |= clang::Qualifiers::Const;
653 if (func_sig->isVolatileType())
654 type_quals |= clang::Qualifiers::Volatile;
658 arg_list.size(), is_variadic, type_quals, cc);
662 type.getSymIndexId(),
ConstString(name), std::nullopt,
nullptr,
666 case PDB_SymType::ArrayType: {
667 auto array_type = llvm::dyn_cast<PDBSymbolTypeArray>(&type);
669 uint32_t num_elements = array_type->getCount();
670 uint32_t element_uid = array_type->getElementTypeId();
671 std::optional<uint64_t> bytes;
672 if (uint64_t size = array_type->getLength())
697 element_ast_type, num_elements,
false);
699 array_type->getSymIndexId(),
ConstString(), bytes,
nullptr,
702 type_sp->SetEncodingType(element_type);
705 case PDB_SymType::BuiltinType: {
706 auto *builtin_type = llvm::dyn_cast<PDBSymbolTypeBuiltin>(&type);
707 assert(builtin_type);
708 PDB_BuiltinType builtin_kind = builtin_type->getBuiltinType();
709 if (builtin_kind == PDB_BuiltinType::None)
712 std::optional<uint64_t> bytes;
713 if (uint64_t size = builtin_type->getLength())
717 m_ast, *builtin_type, encoding, bytes.value_or(0) * 8);
719 if (builtin_type->isConstType())
722 if (builtin_type->isVolatileType())
728 builtin_type->getSymIndexId(), type_name, bytes,
nullptr,
732 case PDB_SymType::PointerType: {
733 auto *pointer_type = llvm::dyn_cast<PDBSymbolTypePointer>(&type);
734 assert(pointer_type);
741 pointer_type->getPointeeType()->getSymIndexId());
745 if (pointer_type->isPointerToDataMember() ||
746 pointer_type->isPointerToMemberFunction()) {
747 auto class_parent_uid = pointer_type->getRawSymbol().getClassParentId();
748 auto class_parent_type = symbol_file->
ResolveTypeUID(class_parent_uid);
749 assert(class_parent_type);
753 class_parent_type->GetLayoutCompilerType(),
755 assert(pointer_ast_type);
766 if (pointer_type->isReference())
768 else if (pointer_type->isRValueReference())
773 if (pointer_type->isConstType())
776 if (pointer_type->isVolatileType())
779 if (pointer_type->isRestrictedType())
783 pointer_type->getSymIndexId(),
ConstString(), pointer_type->getLength(),
800 clang::CXXRecordDecl *record_decl =
811 std::unique_ptr<PDBSymbol> symbol =
812 symbol_file->
GetPDBSession().getSymbolById(uid_it->getSecond());
821 switch (symbol->getSymTag()) {
822 case PDB_SymType::UDT: {
823 auto udt = llvm::dyn_cast<PDBSymbolTypeUDT>(symbol.get());
830 llvm_unreachable(
"not a forward clang type decl!");
836 uint32_t sym_id = symbol.getSymIndexId();
848 auto tag = symbol.getSymTag();
849 if (tag == PDB_SymType::Data || tag == PDB_SymType::Function) {
850 const IPDBSession &session = symbol.getSession();
851 const IPDBRawSymbol &raw = symbol.getRawSymbol();
853 auto class_parent_id = raw.getClassParentId();
854 if (std::unique_ptr<PDBSymbol> class_parent =
855 session.getSymbolById(class_parent_id)) {
856 auto class_parent_type = symbol_file->
ResolveTypeUID(class_parent_id);
857 if (!class_parent_type)
860 CompilerType class_parent_ct = class_parent_type->GetFullCompilerType();
870 if (
auto func = llvm::dyn_cast_or_null<PDBSymbolFunc>(&symbol)) {
873 if (uint32_t rva = func->getRelativeVirtualAddress()) {
876 class_parent->findAllChildren<PDBSymbolFunc>()) {
877 while (std::unique_ptr<PDBSymbolFunc> method =
878 methods_enum->getNext()) {
879 if (method->getRelativeVirtualAddress() == rva) {
903 switch (symbol.getSymTag()) {
904 case PDB_SymType::Data: {
905 auto data = llvm::dyn_cast<PDBSymbolData>(&symbol);
909 assert(decl_context);
916 if (
auto parent_decl = llvm::dyn_cast_or_null<clang::TagDecl>(decl_context))
926 auto type = symbol_file->ResolveTypeUID(data->getTypeId());
939 case PDB_SymType::Function: {
940 auto func = llvm::dyn_cast<PDBSymbolFunc>(&symbol);
944 assert(decl_context);
949 Type *type = symbol_file->ResolveTypeUID(sym_id);
953 auto storage = func->isStatic() ? clang::StorageClass::SC_Static
954 : clang::StorageClass::SC_None;
960 std::vector<clang::ParmVarDecl *> params;
961 if (std::unique_ptr<PDBSymbolTypeFunctionSig> sig = func->getSignature()) {
963 arg_enum = sig->findAllChildren<PDBSymbolTypeFunctionArg>()) {
964 while (std::unique_ptr<PDBSymbolTypeFunctionArg> arg =
965 arg_enum->getNext()) {
966 Type *arg_type = symbol_file->ResolveTypeUID(arg->getTypeId());
974 params.push_back(param);
987 Type *type = symbol_file->ResolveTypeUID(sym_id);
998 if (symbol.getSymTag() == PDB_SymType::Function) {
999 clang::DeclContext *result =
1017 clang::DeclContext *result =
1027 const llvm::pdb::PDBSymbol &symbol) {
1031 return parent_context;
1043 std::string name(symbol.getRawSymbol().getName());
1045 llvm::ArrayRef<MSVCUndecoratedNameSpecifier> specs = parser.
GetSpecifiers();
1054 auto global = symbol_file->GetPDBSession().getGlobalScope();
1058 bool has_type_or_function_parent =
false;
1060 for (std::size_t i = 0; i < specs.size() - 1; i++) {
1062 if (std::unique_ptr<IPDBEnumSymbols> children_enum = global->findChildren(
1063 PDB_SymType::None, specs[i].GetFullName(), NS_CaseSensitive)) {
1064 while (IPDBEnumChildren<PDBSymbol>::ChildTypePtr child =
1065 children_enum->getNext()) {
1066 if (clang::DeclContext *child_context =
1072 has_type_or_function_parent =
true;
1073 curr_context = child_context;
1082 if (!has_type_or_function_parent) {
1083 std::string namespace_name = std::string(specs[i].GetBaseName());
1084 const char *namespace_name_c_str =
1086 : namespace_name.data();
1087 clang::NamespaceDecl *namespace_decl =
1094 curr_context = namespace_decl;
1098 return curr_context;
1102 const clang::DeclContext *decl_context) {
1111 auto global_up = session.getGlobalScope();
1115 symbol = symbol_up.get();
1117 symbol = global_up.get();
1121 if (
auto children = symbol->findAllChildren())
1122 while (
auto child = children->getNext())
1126clang::NamespaceDecl *
1128 llvm::StringRef name) {
1141 for (clang::NamespaceDecl *namespace_decl : *set)
1142 if (namespace_decl->getName() == name)
1143 return namespace_decl;
1145 for (clang::NamespaceDecl *namespace_decl : *set)
1146 if (namespace_decl->isAnonymousNamespace())
1153 const PDBSymbolData &enum_value) {
1155 Variant v = enum_value.getValue();
1160 case PDB_VariantType::Int8:
1161 raw_value = v.Value.Int8;
1163 case PDB_VariantType::Int16:
1164 raw_value = v.Value.Int16;
1166 case PDB_VariantType::Int32:
1167 raw_value = v.Value.Int32;
1169 case PDB_VariantType::Int64:
1170 raw_value = v.Value.Int64;
1172 case PDB_VariantType::UInt8:
1173 raw_value = v.Value.UInt8;
1175 case PDB_VariantType::UInt16:
1176 raw_value = v.Value.UInt16;
1178 case PDB_VariantType::UInt32:
1179 raw_value = v.Value.UInt32;
1181 case PDB_VariantType::UInt64:
1182 raw_value = v.Value.UInt64;
1191 enum_type, decl, name.c_str(), raw_value, byte_size * 8);
1192 if (!enum_constant_decl)
1195 m_uid_to_decl[enum_value.getSymIndexId()] = enum_constant_decl;
1203 llvm::pdb::PDBSymbolTypeUDT &udt) {
1205 layout_info.
bit_size = udt.getLength() * 8;
1207 auto nested_enums = udt.findAllChildren<PDBSymbolTypeUDT>();
1209 while (
auto nested = nested_enums->getNext())
1212 auto bases_enum = udt.findAllChildren<PDBSymbolTypeBaseClass>();
1218 auto members_enum = udt.findAllChildren<PDBSymbolData>();
1222 auto methods_enum = udt.findAllChildren<PDBSymbolFunc>();
1230 clang::CXXRecordDecl *record_decl =
1233 return static_cast<bool>(compiler_type);
1237 return static_cast<bool>(compiler_type);
1245 while (
auto member = members_enum.getNext()) {
1246 if (member->isCompilerGenerated())
1249 auto member_name = member->getName();
1251 auto member_type = symbol_file.
ResolveTypeUID(member->getTypeId());
1256 if (!member_comp_type.GetCompleteType()) {
1258 ":: Class '{0}' has a member '{1}' of type '{2}' "
1259 "which does not have a complete definition.",
1261 member_comp_type.GetTypeName().GetCString());
1268 switch (member->getDataKind()) {
1269 case PDB_DataKind::Member: {
1270 auto location_type = member->getLocationType();
1272 auto bit_size = member->getLength();
1273 if (location_type == PDB_LocType::ThisRel)
1277 record_type, member_name.c_str(), member_comp_type, access, bit_size);
1283 auto offset = member->getOffset() * 8;
1284 if (location_type == PDB_LocType::BitField)
1285 offset += member->getBitPosition();
1287 layout_info.
field_offsets.insert(std::make_pair(decl, offset));
1291 case PDB_DataKind::StaticMember: {
1293 record_type, member_name.c_str(), member_comp_type, access);
1299 if (member_comp_type.IsConst()) {
1300 auto value = member->getValue();
1301 if (value.Type == llvm::pdb::Empty) {
1303 "Class '{0}' has member '{1}' of type '{2}' with an unknown "
1306 member_comp_type.GetTypeName());
1310 clang::QualType qual_type = decl->getType();
1312 unsigned constant_width = value.getBitWidth();
1314 if (qual_type->isIntegralOrEnumerationType()) {
1315 if (type_width >= constant_width) {
1317 decl, value.toAPSInt().extOrTrunc(type_width));
1320 "Class '{0}' has a member '{1}' of type '{2}' ({3} bits) "
1321 "which resolves to a wider constant value ({4} bits). "
1322 "Ignoring constant.",
1324 member_comp_type.GetTypeName(), type_width,
1328 switch (member_comp_type.GetBasicTypeEnumeration()) {
1332 if (type_width == constant_width) {
1334 decl, value.toAPFloat());
1335 decl->setConstexpr(
true);
1338 "Class '{0}' has a member '{1}' of type '{2}' ({3} "
1339 "bits) which resolves to a constant value of mismatched "
1340 "width ({4} bits). Ignoring constant.",
1342 member_comp_type.GetTypeName(), type_width,
1357 llvm_unreachable(
"unsupported PDB data kind");
1367 std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> base_classes;
1369 while (
auto base = bases_enum.getNext()) {
1375 if (!base_comp_type.GetCompleteType()) {
1377 ":: Class '{0}' has a base class '{1}' "
1378 "which does not have a complete definition.",
1380 base_comp_type.GetTypeName().GetCString());
1387 auto is_virtual = base->isVirtualBaseClass();
1389 std::unique_ptr<clang::CXXBaseSpecifier> base_spec =
1391 base_comp_type.GetOpaqueQualType(), access, is_virtual,
1392 record_kind == llvm::to_underlying(clang::TagTypeKind::Class));
1395 base_classes.push_back(std::move(base_spec));
1404 auto offset = clang::CharUnits::fromQuantity(base->getOffset());
1405 layout_info.
base_offsets.insert(std::make_pair(decl, offset));
1409 std::move(base_classes));
1415 while (std::unique_ptr<PDBSymbolFunc> method = methods_enum.getNext())
1416 if (clang::CXXMethodDecl *decl =
1421clang::CXXMethodDecl *
1424 const llvm::pdb::PDBSymbolFunc &method)
const {
1436 ":: Class '{0}' has a method '{1}' whose type cannot be completed.",
1450 nullptr, method_comp_type, access, method.isVirtual(),
1451 method.isStatic(), method.hasInlineAttribute(),
1454 method.isCompilerGenerated());
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
static clang::CallingConv TranslateCallingConvention(PDB_CallingConv pdb_cc)
static int TranslateUdtKind(PDB_UdtType pdb_kind)
static clang::NamedDecl * GetDeclFromContextByName(const clang::ASTContext &ast, const clang::DeclContext &decl_context, llvm::StringRef name)
static ConstString GetPDBBuiltinTypeName(const PDBSymbolTypeBuiltin &pdb_type, CompilerType &compiler_type)
static std::unique_ptr< llvm::pdb::PDBSymbol > GetClassOrFunctionParent(const llvm::pdb::PDBSymbol &symbol)
static lldb::Encoding TranslateEnumEncoding(PDB_VariantType type)
static AccessType TranslateMemberAccess(PDB_MemberAccess access)
static CompilerType GetBuiltinTypeForPDBEncodingAndBitSize(TypeSystemClang &clang_ast, const PDBSymbolTypeBuiltin &pdb_type, Encoding encoding, uint32_t width)
static lldb::Encoding TranslateBuiltinEncoding(PDB_BuiltinType type)
static AccessType GetAccessibilityForUdt(const PDBSymbolTypeUDT &udt)
static AccessType GetDefaultAccessibilityForUdtKind(PDB_UdtType udt_kind)
static bool AddSourceInfoToDecl(const PDBSymbol &symbol, Declaration &decl)
static clang::MSInheritanceAttr::Spelling GetMSInheritance(const PDBSymbolTypeUDT &udt)
static bool IsAnonymousNamespaceName(llvm::StringRef name)
static std::optional< clang::CallingConv > TranslateCallingConvention(llvm::codeview::CallingConvention conv)
static bool IsAnonymousNamespaceName(llvm::StringRef name)
static clang::TagTypeKind TranslateUdtKind(const TagRecord &cr)
llvm::ArrayRef< MSVCUndecoratedNameSpecifier > GetSpecifiers() const
static llvm::StringRef DropScope(llvm::StringRef name)
lldb_private::TypeSystemClang & m_ast
clang::NamespaceDecl * FindNamespaceDecl(const clang::DeclContext *parent, llvm::StringRef name)
bool CompleteTypeFromUDT(lldb_private::SymbolFile &symbol_file, lldb_private::CompilerType &compiler_type, llvm::pdb::PDBSymbolTypeUDT &udt)
void AddRecordMethods(lldb_private::SymbolFile &symbol_file, lldb_private::CompilerType &record_type, PDBFuncSymbolEnumerator &methods_enum)
NamespacesSet m_namespaces
lldb::TypeSP CreateLLDBTypeFromPDBType(const llvm::pdb::PDBSymbol &type)
DeclContextToUidMap m_decl_context_to_uid
clang::DeclContext * GetDeclContextForSymbol(const llvm::pdb::PDBSymbol &symbol)
lldb_private::ClangASTImporter & GetClangASTImporter()
void ParseDeclsForDeclContext(const clang::DeclContext *decl_context)
void AddRecordBases(lldb_private::SymbolFile &symbol_file, lldb_private::CompilerType &record_type, int record_kind, PDBBaseClassSymbolEnumerator &bases_enum, lldb_private::ClangASTImporter::LayoutInfo &layout_info) const
void AddRecordMembers(lldb_private::SymbolFile &symbol_file, lldb_private::CompilerType &record_type, PDBDataSymbolEnumerator &members_enum, lldb_private::ClangASTImporter::LayoutInfo &layout_info)
std::set< clang::NamespaceDecl * > NamespacesSet
UidToDeclMap m_uid_to_decl
bool CompleteTypeFromPDB(lldb_private::CompilerType &compiler_type)
bool AddEnumValue(lldb_private::CompilerType enum_type, const llvm::pdb::PDBSymbolData &data)
PDBASTParser(lldb_private::TypeSystemClang &ast)
ParentToNamespacesMap m_parent_to_namespaces
clang::Decl * GetDeclForSymbol(const llvm::pdb::PDBSymbol &symbol)
clang::DeclContext * GetDeclContextContainingSymbol(const llvm::pdb::PDBSymbol &symbol)
clang::CXXMethodDecl * AddRecordMethod(lldb_private::SymbolFile &symbol_file, lldb_private::CompilerType &record_type, const llvm::pdb::PDBSymbolFunc &method) const
CXXRecordDeclToUidMap m_forward_decl_to_uid
llvm::pdb::IPDBSession & GetPDBSession()
lldb_private::Type * ResolveTypeUID(lldb::user_id_t type_uid) override
bool CompleteType(const CompilerType &compiler_type)
void SetRecordLayout(clang::RecordDecl *decl, const LayoutInfo &layout)
Sets the layout for the given RecordDecl.
Generic representation of a type in a programming language.
CompilerType AddConstModifier() const
Return a new CompilerType adds a const modifier to this type if this type is valid and the type syste...
CompilerType GetRValueReferenceType() const
Return a new CompilerType that is a R value reference to this type if this type is valid and the type...
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
lldb::opaque_compiler_type_t GetOpaqueQualType() const
CompilerType AddVolatileModifier() const
Return a new CompilerType adds a volatile modifier to this type if this type is valid and the type sy...
CompilerType AddRestrictModifier() const
Return a new CompilerType adds a restrict modifier to this type if this type is valid and the type sy...
CompilerType GetLValueReferenceType() const
Return a new CompilerType that is a L value reference to this type if this type is valid and the type...
ConstString GetTypeName(bool BaseOnly=false) const
bool GetCompleteType() const
Type Completion.
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 uniqued constant string class.
const char * GetCString() const
Get the string value as a C string.
A class that describes the declaration location of a lldb object.
void SetLine(uint32_t line)
Set accessor for the declaration line number.
void SetColumn(uint16_t column)
Set accessor for the declaration column number.
void SetFile(const FileSpec &file_spec)
Set accessor for the declaration file specification.
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
Provides public interface for all SymbolFiles.
virtual Type * ResolveTypeUID(lldb::user_id_t type_uid)=0
virtual SymbolFile * GetBackingSymbolFile()
SymbolFileOnDemand class overrides this to return the underlying backing SymbolFile implementation th...
virtual lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional< uint64_t > byte_size, SymbolContextScope *context, lldb::user_id_t encoding_uid, Type::EncodingDataType encoding_uid_type, const Declaration &decl, const CompilerType &compiler_qual_type, Type::ResolveState compiler_type_resolve_state, uint32_t opaque_payload=0)=0
virtual ObjectFile * GetObjectFile()=0
A TypeSystem implementation based on Clang.
clang::TranslationUnitDecl * GetTranslationUnitDecl()
static clang::TypedefNameDecl * GetAsTypedefDecl(const CompilerType &type)
CompilerType GetBasicType(lldb::BasicType type)
static clang::FieldDecl * AddFieldToRecordType(const CompilerType &type, llvm::StringRef name, const CompilerType &field_type, lldb::AccessType access, uint32_t bitfield_bit_size)
CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size) override
CompilerType CreateArrayType(const CompilerType &element_type, std::optional< size_t > element_count, bool is_vector)
CompilerType GetTypeForIdentifier(llvm::StringRef type_name, clang::DeclContext *decl_context=nullptr)
static clang::DeclContext * GetDeclContextForType(clang::QualType type)
static bool IsCXXClassType(const CompilerType &type)
static void SetFloatingInitializerForVariable(clang::VarDecl *var, const llvm::APFloat &init_value)
Initializes a variable with a floating point value.
bool TransferBaseClasses(lldb::opaque_compiler_type_t type, std::vector< std::unique_ptr< clang::CXXBaseSpecifier > > bases)
static void SetIntegerInitializerForVariable(clang::VarDecl *var, const llvm::APInt &init_value)
Initializes a variable with an integer value.
std::unique_ptr< clang::CXXBaseSpecifier > CreateBaseClassSpecifier(lldb::opaque_compiler_type_t type, lldb::AccessType access, bool is_virtual, bool base_of_class)
CompilerType GetEnumerationIntegerType(lldb::opaque_compiler_type_t type) override
CompilerDeclContext CreateDeclContext(clang::DeclContext *ctx)
Creates a CompilerDeclContext from the given DeclContext with the current TypeSystemClang instance as...
clang::FunctionDecl * CreateFunctionDeclaration(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, llvm::StringRef name, const CompilerType &function_Type, clang::StorageClass storage, bool is_inline)
static void BuildIndirectFields(const CompilerType &type)
void AddMethodOverridesForCXXRecordType(lldb::opaque_compiler_type_t type)
clang::CXXMethodDecl * AddMethodToCXXRecordType(lldb::opaque_compiler_type_t type, llvm::StringRef name, const char *mangled_name, const CompilerType &method_type, lldb::AccessType access, bool is_virtual, bool is_static, bool is_inline, bool is_explicit, bool is_attr_used, bool is_artificial)
clang::EnumConstantDecl * AddEnumerationValueToEnumerationType(const CompilerType &enum_type, const Declaration &decl, const char *name, int64_t enum_value, uint32_t enum_value_bit_size)
clang::NamespaceDecl * GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, bool is_inline=false)
static clang::CXXRecordDecl * GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type)
static bool CompleteTagDeclarationDefinition(const CompilerType &type)
CompilerType CreateRecordType(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, llvm::StringRef name, int kind, lldb::LanguageType language, std::optional< ClangASTMetadata > metadata=std::nullopt, bool exports_symbols=false)
static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type, bool has_extern)
CompilerType CreateEnumerationType(llvm::StringRef name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, const Declaration &decl, const CompilerType &integer_qual_type, bool is_scoped)
clang::ParmVarDecl * CreateParameterDeclaration(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, const char *name, const CompilerType ¶m_type, int storage, bool add_decl=false)
bool GetCompleteDecl(clang::Decl *decl)
static bool StartTagDeclarationDefinition(const CompilerType &type)
static clang::VarDecl * AddVariableToRecordType(const CompilerType &type, llvm::StringRef name, const CompilerType &var_type, lldb::AccessType access)
CompilerType CreateFunctionType(const CompilerType &result_type, const CompilerType *args, unsigned num_args, bool is_variadic, unsigned type_quals, clang::CallingConv cc=clang::CC_C, clang::RefQualifierKind ref_qual=clang::RQ_None)
static clang::EnumDecl * GetAsEnumDecl(const CompilerType &type)
void SetFunctionParameters(clang::FunctionDecl *function_decl, llvm::ArrayRef< clang::ParmVarDecl * > params)
clang::ASTContext & getASTContext() const
Returns the clang::ASTContext instance managed by this TypeSystemClang.
static CompilerType CreateMemberPointerType(const CompilerType &type, const CompilerType &pointee_type)
clang::VarDecl * CreateVariableDeclaration(clang::DeclContext *decl_context, OptionalClangModuleID owning_module, const char *name, clang::QualType type)
virtual SymbolFile * GetSymbolFile() const
CompilerType GetForwardCompilerType()
@ eEncodingIsTypedefUID
This type is alias to a type whose UID is m_encoding_uid.
@ eEncodingIsUID
This type is the type whose UID is m_encoding_uid.
CompilerType GetLayoutCompilerType()
CompilerType GetFullCompilerType()
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.
@ eLanguageTypeC_plus_plus
ISO C++:1998.
std::shared_ptr< lldb_private::Type > TypeSP
Encoding
Register encoding definitions.
@ eEncodingUint
unsigned integer
@ eEncodingSint
signed integer
llvm::DenseMap< const clang::FieldDecl *, uint64_t > field_offsets
static clang::QualType GetQualType(const CompilerType &ct)
lldb::user_id_t GetID() const
Get accessor for the user ID.