Changeset View
Changeset View
Standalone View
Standalone View
lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
Show First 20 Lines • Show All 404 Lines • ▼ Show 20 Lines | if (!clang_type.IsValid()) { | ||||
auto tag_type_kind = TranslateUdtKind(udt->getUdtKind()); | auto tag_type_kind = TranslateUdtKind(udt->getUdtKind()); | ||||
ClangASTMetadata metadata; | ClangASTMetadata metadata; | ||||
metadata.SetUserID(type.getSymIndexId()); | metadata.SetUserID(type.getSymIndexId()); | ||||
metadata.SetIsDynamicCXXType(false); | metadata.SetIsDynamicCXXType(false); | ||||
clang_type = | clang_type = | ||||
m_ast.CreateRecordType(decl_context, access, name, tag_type_kind, | m_ast.CreateRecordType(decl_context, 0, access, name, tag_type_kind, | ||||
lldb::eLanguageTypeC_plus_plus, &metadata); | lldb::eLanguageTypeC_plus_plus, &metadata); | ||||
assert(clang_type.IsValid()); | assert(clang_type.IsValid()); | ||||
auto record_decl = | auto record_decl = | ||||
m_ast.GetAsCXXRecordDecl(clang_type.GetOpaqueQualType()); | m_ast.GetAsCXXRecordDecl(clang_type.GetOpaqueQualType()); | ||||
assert(record_decl); | assert(record_decl); | ||||
m_uid_to_decl[type.getSymIndexId()] = record_decl; | m_uid_to_decl[type.getSymIndexId()] = record_decl; | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | if (!ast_enum.IsValid()) { | ||||
m_ast, *underlying_type_up, encoding, bytes * 8); | m_ast, *underlying_type_up, encoding, bytes * 8); | ||||
else | else | ||||
builtin_type = m_ast.GetBasicType(eBasicTypeInt); | builtin_type = m_ast.GetBasicType(eBasicTypeInt); | ||||
// FIXME: PDB does not have information about scoped enumeration (Enum | // FIXME: PDB does not have information about scoped enumeration (Enum | ||||
// Class). Set it false for now. | // Class). Set it false for now. | ||||
bool isScoped = false; | bool isScoped = false; | ||||
ast_enum = m_ast.CreateEnumerationType(name.c_str(), decl_context, decl, | ast_enum = m_ast.CreateEnumerationType(name.c_str(), decl_context, 0, | ||||
builtin_type, isScoped); | decl, builtin_type, isScoped); | ||||
auto enum_decl = TypeSystemClang::GetAsEnumDecl(ast_enum); | auto enum_decl = TypeSystemClang::GetAsEnumDecl(ast_enum); | ||||
assert(enum_decl); | assert(enum_decl); | ||||
m_uid_to_decl[type.getSymIndexId()] = enum_decl; | m_uid_to_decl[type.getSymIndexId()] = enum_decl; | ||||
auto enum_values = enum_type->findAllChildren<PDBSymbolData>(); | auto enum_values = enum_type->findAllChildren<PDBSymbolData>(); | ||||
if (enum_values) { | if (enum_values) { | ||||
while (auto enum_value = enum_values->getNext()) { | while (auto enum_value = enum_values->getNext()) { | ||||
Show All 35 Lines | case PDB_SymType::Typedef: { | ||||
// Check if such a typedef already exists in the current context | // Check if such a typedef already exists in the current context | ||||
CompilerType ast_typedef = | CompilerType ast_typedef = | ||||
m_ast.GetTypeForIdentifier<clang::TypedefNameDecl>(ConstString(name), | m_ast.GetTypeForIdentifier<clang::TypedefNameDecl>(ConstString(name), | ||||
decl_ctx); | decl_ctx); | ||||
if (!ast_typedef.IsValid()) { | if (!ast_typedef.IsValid()) { | ||||
CompilerType target_ast_type = target_type->GetFullCompilerType(); | CompilerType target_ast_type = target_type->GetFullCompilerType(); | ||||
ast_typedef = m_ast.CreateTypedefType( | ast_typedef = m_ast.CreateTypedefType( | ||||
target_ast_type, name.c_str(), m_ast.CreateDeclContext(decl_ctx)); | target_ast_type, name.c_str(), m_ast.CreateDeclContext(decl_ctx), 0); | ||||
if (!ast_typedef) | if (!ast_typedef) | ||||
return nullptr; | return nullptr; | ||||
auto typedef_decl = TypeSystemClang::GetAsTypedefDecl(ast_typedef); | auto typedef_decl = TypeSystemClang::GetAsTypedefDecl(ast_typedef); | ||||
assert(typedef_decl); | assert(typedef_decl); | ||||
m_uid_to_decl[type.getSymIndexId()] = typedef_decl; | m_uid_to_decl[type.getSymIndexId()] = typedef_decl; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 334 Lines • ▼ Show 20 Lines | case PDB_SymType::Data: { | ||||
clang::Decl *decl = | clang::Decl *decl = | ||||
GetDeclFromContextByName(m_ast.getASTContext(), *decl_context, name); | GetDeclFromContextByName(m_ast.getASTContext(), *decl_context, name); | ||||
if (!decl) { | if (!decl) { | ||||
auto type = symbol_file->ResolveTypeUID(data->getTypeId()); | auto type = symbol_file->ResolveTypeUID(data->getTypeId()); | ||||
if (!type) | if (!type) | ||||
return nullptr; | return nullptr; | ||||
decl = m_ast.CreateVariableDeclaration( | decl = m_ast.CreateVariableDeclaration( | ||||
decl_context, name.c_str(), | decl_context, 0, name.c_str(), | ||||
ClangUtil::GetQualType(type->GetLayoutCompilerType())); | ClangUtil::GetQualType(type->GetLayoutCompilerType())); | ||||
} | } | ||||
m_uid_to_decl[sym_id] = decl; | m_uid_to_decl[sym_id] = decl; | ||||
return decl; | return decl; | ||||
} | } | ||||
case PDB_SymType::Function: { | case PDB_SymType::Function: { | ||||
Show All 9 Lines | case PDB_SymType::Function: { | ||||
Type *type = symbol_file->ResolveTypeUID(sym_id); | Type *type = symbol_file->ResolveTypeUID(sym_id); | ||||
if (!type) | if (!type) | ||||
return nullptr; | return nullptr; | ||||
auto storage = func->isStatic() ? clang::StorageClass::SC_Static | auto storage = func->isStatic() ? clang::StorageClass::SC_Static | ||||
: clang::StorageClass::SC_None; | : clang::StorageClass::SC_None; | ||||
auto decl = m_ast.CreateFunctionDeclaration( | auto decl = m_ast.CreateFunctionDeclaration( | ||||
decl_context, name.c_str(), type->GetForwardCompilerType(), storage, | decl_context, 0, name.c_str(), type->GetForwardCompilerType(), storage, | ||||
func->hasInlineAttribute()); | func->hasInlineAttribute()); | ||||
std::vector<clang::ParmVarDecl *> params; | std::vector<clang::ParmVarDecl *> params; | ||||
if (std::unique_ptr<PDBSymbolTypeFunctionSig> sig = func->getSignature()) { | if (std::unique_ptr<PDBSymbolTypeFunctionSig> sig = func->getSignature()) { | ||||
if (std::unique_ptr<ConcreteSymbolEnumerator<PDBSymbolTypeFunctionArg>> | if (std::unique_ptr<ConcreteSymbolEnumerator<PDBSymbolTypeFunctionArg>> | ||||
arg_enum = sig->findAllChildren<PDBSymbolTypeFunctionArg>()) { | arg_enum = sig->findAllChildren<PDBSymbolTypeFunctionArg>()) { | ||||
while (std::unique_ptr<PDBSymbolTypeFunctionArg> arg = | while (std::unique_ptr<PDBSymbolTypeFunctionArg> arg = | ||||
arg_enum->getNext()) { | arg_enum->getNext()) { | ||||
Type *arg_type = symbol_file->ResolveTypeUID(arg->getTypeId()); | Type *arg_type = symbol_file->ResolveTypeUID(arg->getTypeId()); | ||||
if (!arg_type) | if (!arg_type) | ||||
continue; | continue; | ||||
clang::ParmVarDecl *param = m_ast.CreateParameterDeclaration( | clang::ParmVarDecl *param = m_ast.CreateParameterDeclaration( | ||||
decl, nullptr, arg_type->GetForwardCompilerType(), | decl, 0, nullptr, arg_type->GetForwardCompilerType(), | ||||
clang::SC_None, true); | clang::SC_None, true); | ||||
if (param) | if (param) | ||||
params.push_back(param); | params.push_back(param); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if (params.size()) | if (params.size()) | ||||
m_ast.SetFunctionParameters(decl, params.data(), params.size()); | m_ast.SetFunctionParameters(decl, params.data(), params.size()); | ||||
▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | for (std::size_t i = 0; i < specs.size() - 1; i++) { | ||||
// `N0::N1::CClass::PrivateFunc::__l2::InnerFuncStruct' | // `N0::N1::CClass::PrivateFunc::__l2::InnerFuncStruct' | ||||
if (!has_type_or_function_parent) { | if (!has_type_or_function_parent) { | ||||
std::string namespace_name = std::string(specs[i].GetBaseName()); | std::string namespace_name = std::string(specs[i].GetBaseName()); | ||||
const char *namespace_name_c_str = | const char *namespace_name_c_str = | ||||
IsAnonymousNamespaceName(namespace_name) ? nullptr | IsAnonymousNamespaceName(namespace_name) ? nullptr | ||||
: namespace_name.data(); | : namespace_name.data(); | ||||
clang::NamespaceDecl *namespace_decl = | clang::NamespaceDecl *namespace_decl = | ||||
m_ast.GetUniqueNamespaceDeclaration(namespace_name_c_str, | m_ast.GetUniqueNamespaceDeclaration(namespace_name_c_str, | ||||
curr_context); | curr_context, 0); | ||||
m_parent_to_namespaces[curr_context].insert(namespace_decl); | m_parent_to_namespaces[curr_context].insert(namespace_decl); | ||||
m_namespaces.insert(namespace_decl); | m_namespaces.insert(namespace_decl); | ||||
curr_context = namespace_decl; | curr_context = namespace_decl; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 302 Lines • Show Last 20 Lines |