3#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
4#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
5#include "llvm/DebugInfo/CodeView/RecordName.h"
6#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
7#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
8#include "llvm/DebugInfo/CodeView/SymbolRecordHelpers.h"
9#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
10#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
11#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
12#include "llvm/DebugInfo/PDB/Native/PublicsStream.h"
13#include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
14#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
15#include "llvm/Demangle/MicrosoftDemangle.h"
38 TypeIndex func_type_index,
39 clang::FunctionDecl *&function_decl,
42 : m_index(m_index), m_clang(m_clang), func_type_index(func_type_index),
43 function_decl(function_decl), parent_ty(parent_ty),
44 proc_name(proc_name), func_ct(func_ct) {}
47 TypeIndex func_type_index;
48 clang::FunctionDecl *&function_decl;
50 llvm::StringRef proc_name;
53 llvm::Error visitKnownMember(CVMemberRecord &cvr,
54 OverloadedMethodRecord &overloaded)
override {
55 TypeIndex method_list_idx = overloaded.MethodList;
57 CVType method_list_type = m_index.
tpi().getType(method_list_idx);
58 assert(method_list_type.kind() == LF_METHODLIST);
60 MethodOverloadListRecord method_list;
61 llvm::cantFail(TypeDeserializer::deserializeAs<MethodOverloadListRecord>(
62 method_list_type, method_list));
64 for (
const OneMethodRecord &method : method_list.Methods) {
65 if (method.getType().getIndex() == func_type_index.getIndex())
66 AddMethod(overloaded.Name, method.getAccess(), method.getOptions(),
70 return llvm::Error::success();
73 llvm::Error visitKnownMember(CVMemberRecord &cvr,
74 OneMethodRecord &record)
override {
75 AddMethod(record.getName(), record.getAccess(), record.getOptions(),
77 return llvm::Error::success();
80 void AddMethod(llvm::StringRef name, MemberAccess access,
81 MethodOptions options, MemberAttributes attrs) {
82 if (name != proc_name || function_decl)
85 bool is_virtual = attrs.isVirtual();
86 bool is_static = attrs.isStatic();
87 bool is_artificial = (options & MethodOptions::CompilerGenerated) ==
88 MethodOptions::CompilerGenerated;
91 nullptr, func_ct, access_type,
92 is_virtual, is_static,
94 false, is_artificial);
101 case TypeRecordKind::Class:
102 return clang::TTK_Class;
103 case TypeRecordKind::Struct:
104 return clang::TTK_Struct;
105 case TypeRecordKind::Union:
106 return clang::TTK_Union;
107 case TypeRecordKind::Interface:
108 return clang::TTK_Interface;
109 case TypeRecordKind::Enum:
110 return clang::TTK_Enum;
112 lldbassert(
false &&
"Invalid tag record kind!");
113 return clang::TTK_Struct;
120 return args.back() == TypeIndex::None();
125 for (llvm::ms_demangle::Node *n : scopes) {
126 auto *idn =
static_cast<llvm::ms_demangle::IdentifierNode *
>(n);
127 if (idn->TemplateParams)
133static std::optional<clang::CallingConv>
135 using CC = llvm::codeview::CallingConvention;
140 return clang::CallingConv::CC_C;
143 return clang::CallingConv::CC_X86Pascal;
146 return clang::CallingConv::CC_X86FastCall;
147 case CC::NearStdCall:
149 return clang::CallingConv::CC_X86StdCall;
151 return clang::CallingConv::CC_X86ThisCall;
153 return clang::CallingConv::CC_X86VectorCall;
160 return name ==
"`anonymous namespace'" || name ==
"`anonymous-namespace'";
169std::pair<clang::DeclContext *, std::string>
174 if (!record.hasUniqueName())
177 llvm::ms_demangle::Demangler demangler;
178 std::string_view sv(record.UniqueName.begin(), record.UniqueName.size());
179 llvm::ms_demangle::TagTypeNode *ttn = demangler.parseTagUniqueName(sv);
183 llvm::ms_demangle::IdentifierNode *idn =
184 ttn->QualifiedName->getUnqualifiedIdentifier();
185 std::string uname = idn->toString(llvm::ms_demangle::OF_NoTagSpecifier);
187 llvm::ms_demangle::NodeArrayNode *name_components =
188 ttn->QualifiedName->Components;
189 llvm::ArrayRef<llvm::ms_demangle::Node *> scopes(name_components->Nodes,
190 name_components->Count - 1);
197 std::optional<TypeIndex> parent_index = pdb->
GetParentType(ti);
200 return {context, uname};
208 return {context, std::string(record.Name)};
210 for (llvm::ms_demangle::Node *scope : scopes) {
211 auto *nii =
static_cast<llvm::ms_demangle::NamedIdentifierNode *
>(scope);
212 std::string str = nii->toString();
215 return {context, uname};
223 if (parent_qt.isNull())
224 return {
nullptr,
""};
226 context = clang::TagDecl::castToDeclContext(parent_qt->getAsTagDecl());
227 return {context, uname};
252 clang::Decl *scope_decl = clang::Decl::castFromDeclContext(scope);
258 switch (cvs.kind()) {
277std::optional<CompilerDecl>
282 clang::Decl *result =
nullptr;
283 switch (uid.
kind()) {
291 if (
auto *tag = qt->getAsTagDecl()) {
319 return clang::Decl::castToDeclContext(decl);
322std::pair<clang::DeclContext *, std::string>
328 llvm::ArrayRef<MSVCUndecoratedNameSpecifier> specs = parser.
GetSpecifiers();
332 llvm::StringRef uname = specs.back().GetBaseName();
333 specs = specs.drop_back();
335 return {context, std::string(name)};
337 llvm::StringRef scope_name = specs.back().GetFullName();
340 std::vector<TypeIndex> types = index.
tpi().findRecordsByName(scope_name);
341 while (!types.empty()) {
345 clang::TagDecl *tag = qt->getAsTagDecl();
347 return {clang::TagDecl::castToDeclContext(tag), std::string(uname)};
353 std::string ns_name = spec.GetBaseName().str();
356 return {context, std::string(uname)};
365 switch (uid.
kind()) {
367 std::optional<PdbCompilandSymId> scope =
396 switch (global.kind()) {
397 case SymbolKind::S_GDATA32:
398 case SymbolKind::S_LDATA32:
400 case SymbolKind::S_PROCREF:
401 case SymbolKind::S_LPROCREF: {
402 ProcRefSym ref{global.kind()};
404 SymbolDeserializer::deserializeAs<ProcRefSym>(global, ref));
408 case SymbolKind::S_CONSTANT:
409 case SymbolKind::S_UDT:
425 clang::TagDecl *tag = qt->getAsTagDecl();
426 if (qt->isArrayType()) {
427 const clang::Type *element_type = qt->getArrayElementTypeNoTypeQual();
428 tag = element_type->getAsTagDecl();
456 CVType cvt = index.
tpi().getType(tag_ti);
457 if (cvt.kind() == LF_MODIFIER)
461 cvt = index.
tpi().getType(best_ti.
index);
471 CVType field_list_cvt = index.
tpi().getType(field_list_ti);
472 if (field_list_cvt.kind() != LF_FIELDLIST)
474 FieldListRecord field_list;
475 if (llvm::Error
error = TypeDeserializer::deserializeAs<FieldListRecord>(
476 field_list_cvt, field_list))
477 llvm::consumeError(std::move(
error));
485 llvm::codeview::visitMemberRecordStream(field_list.Data, completer);
490 llvm::consumeError(std::move(
error));
497 if (ti == TypeIndex::NullptrT())
500 if (ti.getSimpleMode() != SimpleTypeMode::Direct) {
502 if (direct_type.isNull())
507 if (ti.getSimpleKind() == SimpleTypeKind::NotTranslated)
522 if (pointee_type.isNull())
525 if (pointer.isPointerToMember()) {
526 MemberPointerInfo mpi = pointer.getMemberInfo();
528 if (class_type.isNull())
530 if (clang::TagDecl *tag = class_type->getAsTagDecl()) {
531 clang::MSInheritanceAttr::Spelling spelling;
532 switch (mpi.Representation) {
533 case llvm::codeview::PointerToMemberRepresentation::SingleInheritanceData:
534 case llvm::codeview::PointerToMemberRepresentation::
535 SingleInheritanceFunction:
537 clang::MSInheritanceAttr::Spelling::Keyword_single_inheritance;
539 case llvm::codeview::PointerToMemberRepresentation::
540 MultipleInheritanceData:
541 case llvm::codeview::PointerToMemberRepresentation::
542 MultipleInheritanceFunction:
544 clang::MSInheritanceAttr::Spelling::Keyword_multiple_inheritance;
546 case llvm::codeview::PointerToMemberRepresentation::
547 VirtualInheritanceData:
548 case llvm::codeview::PointerToMemberRepresentation::
549 VirtualInheritanceFunction:
551 clang::MSInheritanceAttr::Spelling::Keyword_virtual_inheritance;
553 case llvm::codeview::PointerToMemberRepresentation::Unknown:
555 clang::MSInheritanceAttr::Spelling::Keyword_unspecified_inheritance;
558 spelling = clang::MSInheritanceAttr::Spelling::SpellingNotCalculated;
561 tag->addAttr(clang::MSInheritanceAttr::CreateImplicit(
565 pointee_type, class_type.getTypePtr());
568 clang::QualType pointer_type;
569 if (pointer.getMode() == PointerMode::LValueReference)
571 else if (pointer.getMode() == PointerMode::RValueReference)
576 if ((pointer.getOptions() & PointerOptions::Const) != PointerOptions::None)
577 pointer_type.addConst();
579 if ((pointer.getOptions() & PointerOptions::Volatile) != PointerOptions::None)
580 pointer_type.addVolatile();
582 if ((pointer.getOptions() & PointerOptions::Restrict) != PointerOptions::None)
583 pointer_type.addRestrict();
590 clang::QualType unmodified_type =
GetOrCreateType(modifier.ModifiedType);
591 if (unmodified_type.isNull())
594 if ((modifier.Modifiers & ModifierOptions::Const) != ModifierOptions::None)
595 unmodified_type.addConst();
596 if ((modifier.Modifiers & ModifierOptions::Volatile) != ModifierOptions::None)
597 unmodified_type.addVolatile();
599 return unmodified_type;
603 const TagRecord &record) {
604 clang::DeclContext *context =
nullptr;
629 clang::QualType result =
643clang::NamespaceDecl *
645 clang::DeclContext &context) {
654 return llvm::dyn_cast<clang::BlockDecl>(decl);
658 clang::BlockDecl *block_decl =
671 clang::DeclContext &scope) {
692 return llvm::dyn_cast<clang::VarDecl>(decl);
707 return llvm::dyn_cast<clang::VarDecl>(decl);
717clang::TypedefNameDecl *
720 return llvm::dyn_cast<clang::TypedefNameDecl>(decl);
727 UDTSym udt = llvm::cantFail(SymbolDeserializer::deserializeAs<UDTSym>(sym));
733 if (qt.isNull() || !scope)
754 if (type.
index.isSimple())
760 CVType cvt = index.
tpi().getType(type.
index);
762 if (cvt.kind() == LF_MODIFIER) {
763 ModifierRecord modifier;
765 TypeDeserializer::deserializeAs<ModifierRecord>(cvt, modifier));
769 if (cvt.kind() == LF_POINTER) {
770 PointerRecord pointer;
772 TypeDeserializer::deserializeAs<PointerRecord>(cvt, pointer));
785 if (cvt.kind() == LF_ARRAY) {
787 llvm::cantFail(TypeDeserializer::deserializeAs<ArrayRecord>(cvt, ar));
791 if (cvt.kind() == LF_PROCEDURE) {
793 llvm::cantFail(TypeDeserializer::deserializeAs<ProcedureRecord>(cvt, pr));
797 if (cvt.kind() == LF_MFUNCTION) {
798 MemberFunctionRecord mfr;
800 TypeDeserializer::deserializeAs<MemberFunctionRecord>(cvt, mfr));
808 if (type.
index.isNoneType())
840 clang::TagDecl *tag = qt->getAsTagDecl();
852 llvm::StringRef func_name,
TypeIndex func_ti,
854 clang::StorageClass func_storage,
855 bool is_inline, clang::DeclContext *parent) {
856 clang::FunctionDecl *function_decl =
nullptr;
857 if (parent->isRecord()) {
861 clang::QualType parent_qt = llvm::cast<clang::TypeDecl>(parent)
863 ->getCanonicalTypeInternal();
869 if (iter->getSecond().contains({func_name, func_ct})) {
874 CVType cvt = index.
tpi().getType(func_ti);
875 MemberFunctionRecord func_record(
static_cast<TypeRecordKind
>(cvt.kind()));
876 llvm::cantFail(TypeDeserializer::deserializeAs<MemberFunctionRecord>(
878 TypeIndex class_index = func_record.getClassType();
880 CVType parent_cvt = index.
tpi().getType(class_index);
883 if (tag_record.isForwardRef()) {
884 llvm::Expected<TypeIndex> eti =
885 index.
tpi().findFullDeclForForwardRef(class_index);
890 if (!tag_record.FieldList.isSimple()) {
891 CVType field_list_cvt = index.
tpi().getType(tag_record.FieldList);
892 FieldListRecord field_list;
893 if (llvm::Error
error = TypeDeserializer::deserializeAs<FieldListRecord>(
894 field_list_cvt, field_list))
895 llvm::consumeError(std::move(
error));
896 CreateMethodDecl process(index,
m_clang, func_ti, function_decl,
897 parent_opaque_ty, func_name, func_ct);
898 if (llvm::Error err = visitMemberRecordStream(field_list.Data, process))
899 llvm::consumeError(std::move(err));
902 if (!function_decl) {
904 parent_opaque_ty, func_name,
918 return function_decl;
929 InlineSiteSym inline_site(
static_cast<SymbolRecordKind
>(sym.kind()));
930 cantFail(SymbolDeserializer::deserializeAs<InlineSiteSym>(sym, inline_site));
937 return llvm::dyn_cast<clang::FunctionDecl>(decl);
938 clang::FunctionDecl *function_decl =
940 if (function_decl ==
nullptr)
945 uint64_t inlinesite_uid =
toOpaqueUid(inlinesite_id);
948 status.
uid = inlinesite_uid;
957 return function_decl;
967 CVType func_cvt = index.
ipi().getType(func_tid.
index);
968 llvm::StringRef func_name;
970 clang::DeclContext *parent =
nullptr;
971 switch (func_cvt.kind()) {
973 MemberFuncIdRecord mfr;
975 TypeDeserializer::deserializeAs<MemberFuncIdRecord>(func_cvt, mfr));
976 func_name = mfr.getName();
977 func_ti = mfr.getFunctionType();
984 cantFail(TypeDeserializer::deserializeAs<FuncIdRecord>(func_cvt, fir));
985 func_name = fir.getName();
986 func_ti = fir.getFunctionType();
988 if (!fir.ParentScope.isNoneType()) {
989 CVType parent_cvt = index.
ipi().getType(fir.ParentScope);
990 if (parent_cvt.kind() == LF_STRING_ID) {
993 TypeDeserializer::deserializeAs<StringIdRecord>(parent_cvt, sir));
1000 lldbassert(
false &&
"Invalid function id type!");
1003 if (func_qt.isNull() || !parent)
1006 uint32_t param_count =
1007 llvm::cast<clang::FunctionProtoType>(func_qt)->getNumParams();
1009 clang::SC_None,
true, parent);
1012clang::FunctionDecl *
1015 return llvm::dyn_cast<clang::FunctionDecl>(decl);
1020 std::string context_name;
1021 if (clang::NamespaceDecl *ns = llvm::dyn_cast<clang::NamespaceDecl>(parent)) {
1022 context_name = ns->getQualifiedNameAsString();
1023 }
else if (clang::TagDecl *tag = llvm::dyn_cast<clang::TagDecl>(parent)) {
1024 context_name = tag->getQualifiedNameAsString();
1031 ProcSym proc(
static_cast<SymbolRecordKind
>(cvs.kind()));
1032 llvm::cantFail(SymbolDeserializer::deserializeAs<ProcSym>(cvs, proc));
1039 clang::StorageClass storage = clang::SC_None;
1040 if (proc.Kind == SymbolRecordKind::ProcSym)
1041 storage = clang::SC_Static;
1043 const clang::FunctionProtoType *func_type =
1044 llvm::dyn_cast<clang::FunctionProtoType>(qt);
1048 llvm::StringRef proc_name = proc.Name;
1049 proc_name.consume_front(context_name);
1050 proc_name.consume_front(
"::");
1051 clang::FunctionDecl *function_decl =
1053 func_type->getNumParams(), storage,
false, parent);
1054 if (function_decl ==
nullptr)
1064 return function_decl;
1068 clang::FunctionDecl &function_decl,
1069 uint32_t param_count) {
1074 CVSymbolArray scope =
1078 auto begin = scope.begin();
1079 auto end = scope.end();
1080 std::vector<clang::ParmVarDecl *> params;
1081 for (uint32_t i = 0; i < param_count && begin != end;) {
1082 uint32_t record_offset = begin.offset();
1083 CVSymbol sym = *begin++;
1086 llvm::StringRef param_name;
1087 switch (sym.kind()) {
1089 RegRelativeSym reg(SymbolRecordKind::RegRelativeSym);
1090 cantFail(SymbolDeserializer::deserializeAs<RegRelativeSym>(sym, reg));
1091 param_type = reg.Type;
1092 param_name = reg.Name;
1096 RegisterSym reg(SymbolRecordKind::RegisterSym);
1097 cantFail(SymbolDeserializer::deserializeAs<RegisterSym>(sym, reg));
1098 param_type = reg.Index;
1099 param_name = reg.Name;
1103 LocalSym local(SymbolRecordKind::LocalSym);
1104 cantFail(SymbolDeserializer::deserializeAs<LocalSym>(sym, local));
1105 if ((local.Flags & LocalSymFlags::IsParameter) == LocalSymFlags::None)
1107 param_type = local.Type;
1108 param_name = local.Name;
1130 param_type_ct, clang::SC_None,
true);
1134 params.push_back(param);
1138 if (!params.empty() && params.size() == param_count)
1143 const EnumRecord &er) {
1144 clang::DeclContext *decl_context =
nullptr;
1151 if (underlying_type.isNull())
1172 if (element_type.isNull() || element_size == 0)
1174 uint64_t element_count = ar.Size / element_size;
1177 element_count,
false);
1183 llvm::codeview::CallingConvention calling_convention) {
1187 TpiStream &stream = index.
tpi();
1188 CVType args_cvt = stream.getType(args_type_idx);
1191 TypeDeserializer::deserializeAs<ArgListRecord>(args_cvt, args));
1193 llvm::ArrayRef<TypeIndex> arg_indices = llvm::ArrayRef(args.ArgIndices);
1196 arg_indices = arg_indices.drop_back();
1198 std::vector<CompilerType> arg_types;
1199 arg_types.reserve(arg_indices.size());
1201 for (
TypeIndex arg_index : arg_indices) {
1203 if (arg_type.isNull())
1209 if (return_type.isNull())
1212 std::optional<clang::CallingConv> cc =
1219 return_ct, arg_types.data(), arg_types.size(), is_variadic, 0, *cc);
1221 return clang::QualType::getFromOpaquePtr(
1226 return llvm::isa<clang::TagDecl>(&context);
1230 return llvm::isa<clang::FunctionDecl>(&context);
1234 return llvm::isa<clang::BlockDecl>(&context);
1238 clang::NamespaceDecl *ns = llvm::dyn_cast<clang::NamespaceDecl>(&context);
1241 std::string qname = ns->getQualifiedNameAsString();
1246 for (
const CVType &cvt : index.
tpi().typeArray()) {
1258 clang::DeclContext *context =
nullptr;
1261 if (!context || !context->isNamespace())
1264 clang::NamespaceDecl *ns = llvm::cast<clang::NamespaceDecl>(context);
1265 llvm::StringRef ns_name = ns->getName();
1266 if (ns_name.startswith(qname)) {
1267 ns_name = ns_name.drop_front(qname.size());
1268 if (ns_name.startswith(
"::"))
1282 for (
const CVType &cvt : index.
tpi().typeArray()) {
1299 uint32_t module_count = index.
dbi().modules().getModuleCount();
1300 for (uint16_t modi = 0; modi < module_count; ++modi) {
1302 const CVSymbolArray &symbols = cii.
m_debug_stream.getSymbolArray();
1303 auto iter = symbols.begin();
1304 while (iter != symbols.end()) {
1307 switch (iter->kind()) {
1311 iter = symbols.at(getScopeEndOffset(*iter));
1330 const CVSymbolArray &symbols) {
1331 clang::FunctionDecl *func_decl = llvm::dyn_cast<clang::FunctionDecl>(&decl);
1334 unsigned int params = func_decl->getNumParams();
1338 CVSymbolArray result = symbols;
1340 while (!result.empty()) {
1344 CVSymbol sym = *result.begin();
1345 result.drop_front();
1360 lldbassert(sym.kind() == S_GPROC32 || sym.kind() == S_LPROC32 ||
1361 sym.kind() == S_BLOCK32 || sym.kind() == S_INLINESITE);
1364 CVSymbolArray symbols =
1369 if (sym.kind() == S_GPROC32 || sym.kind() == S_LPROC32)
1373 symbols.drop_front();
1374 auto begin = symbols.begin();
1375 while (begin != symbols.end()) {
1378 if (begin->kind() == S_BLOCK32 || begin->kind() == S_INLINESITE) {
1380 begin = symbols.at(getScopeEndOffset(*begin));
1388 clang::Decl *decl = clang::Decl::castFromDeclContext(&context);
1394 if (
auto *tag = llvm::dyn_cast<clang::TagDecl>(&context)) {
1412 if (context.isTranslationUnit()) {
1418 if (context.isNamespace()) {
1434 return {
m_clang.weak_from_this(), qt.getAsOpaquePtr()};
static llvm::raw_ostream & error(Stream &strm)
static bool isFunctionDecl(clang::DeclContext &context)
static bool isBlockDecl(clang::DeclContext &context)
static CVSymbolArray skipFunctionParameters(clang::Decl &decl, const CVSymbolArray &symbols)
static std::optional< clang::CallingConv > TranslateCallingConvention(llvm::codeview::CallingConvention conv)
static bool isTagDecl(clang::DeclContext &context)
static bool isLocalVariableType(SymbolKind K)
static bool IsAnonymousNamespaceName(llvm::StringRef name)
static clang::TagTypeKind TranslateUdtKind(const TagRecord &cr)
static bool IsCVarArgsFunction(llvm::ArrayRef< TypeIndex > args)
static bool AnyScopesHaveTemplateParams(llvm::ArrayRef< llvm::ms_demangle::Node * > scopes)
llvm::ArrayRef< MSVCUndecoratedNameSpecifier > GetSpecifiers() const
Represents a generic declaration context in a program.
void * GetOpaqueDeclContext() const
Represents a generic declaration such as a function declaration.
Generic representation of a type in a programming language.
lldb::opaque_compiler_type_t GetOpaqueQualType() 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 class that describes the declaration location of a lldb object.
A stream class that can stream formatted output to a file.
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
virtual SymbolFile * GetBackingSymbolFile()
SymbolFileOnDemand class overrides this to return the underlying backing SymbolFile implementation th...
A TypeSystem implementation based on Clang.
clang::TranslationUnitDecl * GetTranslationUnitDecl()
static clang::TypedefNameDecl * GetAsTypedefDecl(const CompilerType &type)
CompilerType GetBasicType(lldb::BasicType type)
CompilerType GetType(clang::QualType qt)
Creates a CompilerType from the given QualType with the current TypeSystemClang instance as the Compi...
CompilerDecl GetCompilerDecl(clang::Decl *decl)
Creates a CompilerDecl from the given Decl with the current TypeSystemClang instance as its typesyste...
void Dump(llvm::raw_ostream &output) 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)
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::NamespaceDecl * GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, bool is_inline=false)
clang::ASTContext & getASTContext()
Returns the clang::ASTContext instance managed by this TypeSystemClang.
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)
CompilerType CreateArrayType(const CompilerType &element_type, size_t element_count, bool is_vector)
static bool StartTagDeclarationDefinition(const CompilerType &type)
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)
void SetFunctionParameters(clang::FunctionDecl *function_decl, llvm::ArrayRef< clang::ParmVarDecl * > params)
CompilerType CreateRecordType(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, llvm::StringRef name, int kind, lldb::LanguageType language, ClangASTMetadata *metadata=nullptr, bool exports_symbols=false)
clang::VarDecl * CreateVariableDeclaration(clang::DeclContext *decl_context, OptionalClangModuleID owning_module, const char *name, clang::QualType type)
clang::BlockDecl * CreateBlockDeclaration(clang::DeclContext *ctx, OptionalClangModuleID owning_module)
virtual SymbolFile * GetSymbolFile() const
CompilandIndexItem & GetOrCreateCompiland(uint16_t modi)
const CompilandIndexItem * GetCompiland(uint16_t modi) const
clang::QualType CreatePointerType(const llvm::codeview::PointerRecord &pointer)
bool CompleteTagDecl(clang::TagDecl &tag)
void ParseBlockChildren(PdbCompilandSymId block_id)
llvm::DenseMap< lldb::opaque_compiler_type_t, llvm::SmallSet< std::pair< llvm::StringRef, CompilerType >, 8 > > m_cxx_record_map
clang::FunctionDecl * CreateFunctionDecl(PdbCompilandSymId func_id, llvm::StringRef func_name, TypeIndex func_ti, CompilerType func_ct, uint32_t param_count, clang::StorageClass func_storage, bool is_inline, clang::DeclContext *parent)
lldb_private::CompilerDeclContext GetTranslationUnitDecl()
clang::QualType CreateModifierType(const llvm::codeview::ModifierRecord &modifier)
void ParseDeclsForSimpleContext(clang::DeclContext &context)
CompilerDecl ToCompilerDecl(clang::Decl &decl)
llvm::DenseMap< lldb::user_id_t, clang::QualType > m_uid_to_type
clang::QualType CreateFunctionType(TypeIndex args_type_idx, TypeIndex return_type_idx, llvm::codeview::CallingConvention calling_convention)
clang::DeclContext * GetParentDeclContext(PdbSymUid uid)
TypeSystemClang & m_clang
void ParseNamespace(clang::DeclContext &parent)
llvm::codeview::TypeIndex TypeIndex
CompilerDeclContext ToCompilerDeclContext(clang::DeclContext &context)
std::pair< clang::DeclContext *, std::string > CreateDeclInfoForUndecoratedName(llvm::StringRef uname)
clang::Decl * TryGetDecl(PdbSymUid uid) const
clang::DeclContext * FromCompilerDeclContext(CompilerDeclContext context)
clang::VarDecl * GetOrCreateVariableDecl(PdbCompilandSymId scope_id, PdbCompilandSymId var_id)
clang::Decl * GetOrCreateSymbolForId(PdbCompilandSymId id)
CompilerType ToCompilerType(clang::QualType qt)
clang::NamespaceDecl * GetOrCreateNamespaceDecl(const char *name, clang::DeclContext &context)
void Dump(Stream &stream)
PdbAstBuilder(TypeSystemClang &clang)
std::pair< clang::DeclContext *, std::string > CreateDeclInfoForType(const llvm::codeview::TagRecord &record, TypeIndex ti)
clang::QualType GetBasicType(lldb::BasicType type)
bool CompleteType(clang::QualType qt)
llvm::DenseSet< clang::NamespaceDecl * > m_parsed_namespaces
llvm::DenseMap< clang::Decl *, DeclStatus > m_decl_to_status
clang::DeclContext * GetOrCreateDeclContextForUid(PdbSymUid uid)
void ParseDeclsForContext(clang::DeclContext &context)
llvm::DenseMap< lldb::user_id_t, clang::Decl * > m_uid_to_decl
clang::BlockDecl * GetOrCreateBlockDecl(PdbCompilandSymId block_id)
clang::Decl * FromCompilerDecl(CompilerDecl decl)
clang::QualType CreateSimpleType(TypeIndex ti)
void CreateFunctionParameters(PdbCompilandSymId func_id, clang::FunctionDecl &function_decl, uint32_t param_count)
clang::FunctionDecl * GetOrCreateFunctionDecl(PdbCompilandSymId func_id)
llvm::once_flag m_parse_all_types
clang::QualType CreateArrayType(const llvm::codeview::ArrayRecord &array)
clang::QualType CreateRecordType(PdbTypeSymId id, const llvm::codeview::TagRecord &record)
clang::FunctionDecl * CreateFunctionDeclFromId(PdbTypeSymId func_tid, PdbCompilandSymId func_sid)
llvm::once_flag m_parse_functions_and_non_local_vars
clang::VarDecl * CreateVariableDecl(PdbSymUid uid, llvm::codeview::CVSymbol sym, clang::DeclContext &scope)
clang::QualType GetOrCreateType(PdbTypeSymId type)
clang::QualType CreateEnumType(PdbTypeSymId id, const llvm::codeview::EnumRecord &record)
clang::FunctionDecl * GetOrCreateInlinedFunctionDecl(PdbCompilandSymId inlinesite_id)
void ParseAllFunctionsAndNonLocalVars()
std::optional< lldb_private::CompilerDecl > GetOrCreateDeclForUid(PdbSymUid uid)
clang::QualType CreateType(PdbTypeSymId type)
clang::TypedefNameDecl * GetOrCreateTypedefDecl(PdbGlobalSymId id)
PdbIndex - Lazy access to the important parts of a PDB file.
llvm::pdb::TpiStream & ipi()
CompileUnitIndex & compilands()
llvm::pdb::DbiStream & dbi()
llvm::codeview::CVSymbol ReadSymbolRecord(PdbCompilandSymId cu_sym) const
llvm::pdb::TpiStream & tpi()
PdbGlobalSymId asGlobalSym() const
PdbCompilandSymId asCompilandSym() const
PdbTypeSymId asTypeSym() const
PdbSymUidKind kind() const
std::optional< llvm::codeview::TypeIndex > GetParentType(llvm::codeview::TypeIndex ti)
std::optional< PdbCompilandSymId > FindSymbolScope(PdbCompilandSymId id)
llvm::StringRef DropNameScope(llvm::StringRef name)
uint64_t toOpaqueUid(const T &cid)
lldb::BasicType GetCompilerTypeForSimpleKind(llvm::codeview::SimpleTypeKind kind)
VariableInfo GetVariableNameInfo(llvm::codeview::CVSymbol symbol)
bool IsTagRecord(llvm::codeview::CVType cvt)
llvm::codeview::TypeIndex LookThroughModifierRecord(llvm::codeview::CVType modifier)
bool IsForwardRefUdt(llvm::codeview::CVType cvt)
lldb::AccessType TranslateMemberAccess(llvm::codeview::MemberAccess access)
llvm::codeview::TypeIndex GetFieldListIndex(llvm::codeview::CVType cvt)
size_t GetSizeOfType(PdbTypeSymId id, llvm::pdb::TpiStream &tpi)
PdbTypeSymId GetBestPossibleDecl(PdbTypeSymId id, llvm::pdb::TpiStream &tpi)
A class that represents a running process on the host machine.
void * opaque_compiler_type_t
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
@ eLanguageTypeC_plus_plus
ISO C++:1998.
static clang::Decl * GetDecl(const CompilerDecl &decl)
Returns the clang::Decl of the given CompilerDecl.
const llvm::codeview::UnionRecord & asUnion() const
static CVTagRecord create(llvm::codeview::CVType type)
const llvm::codeview::ClassRecord & asClass() const
const llvm::codeview::EnumRecord & asEnum() const
const llvm::codeview::TagRecord & asTag() const
Represents a single compile unit.
llvm::pdb::ModuleDebugStreamRef m_debug_stream
llvm::codeview::TypeIndex index
llvm::codeview::TypeIndex type