aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp')
-rw-r--r--lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp44
1 files changed, 32 insertions, 12 deletions
diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
index f9c12e634140..78a0d09a681a 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -17,8 +17,8 @@
#include "Plugins/ExpressionParser/Clang/ClangASTMetadata.h"
#include "Plugins/ExpressionParser/Clang/ClangUtil.h"
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
+#include "lldb/Core/Declaration.h"
#include "lldb/Core/Module.h"
-#include "lldb/Symbol/Declaration.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/TypeMap.h"
#include "lldb/Symbol/TypeSystem.h"
@@ -326,7 +326,7 @@ GetDeclFromContextByName(const clang::ASTContext &ast,
if (result.empty())
return nullptr;
- return result[0];
+ return *result.begin();
}
static bool IsAnonymousNamespaceName(llvm::StringRef name) {
@@ -355,7 +355,7 @@ static clang::CallingConv TranslateCallingConvention(PDB_CallingConv pdb_cc) {
PDBASTParser::PDBASTParser(lldb_private::TypeSystemClang &ast) : m_ast(ast) {}
-PDBASTParser::~PDBASTParser() {}
+PDBASTParser::~PDBASTParser() = default;
// DebugInfoASTParser interface
@@ -534,8 +534,12 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
auto type_def = llvm::dyn_cast<PDBSymbolTypeTypedef>(&type);
assert(type_def);
+ SymbolFile *symbol_file = m_ast.GetSymbolFile();
+ if (!symbol_file)
+ return nullptr;
+
lldb_private::Type *target_type =
- m_ast.GetSymbolFile()->ResolveTypeUID(type_def->getTypeId());
+ symbol_file->ResolveTypeUID(type_def->getTypeId());
if (!target_type)
return nullptr;
@@ -609,8 +613,13 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
auto arg = arg_enum->getChildAtIndex(arg_idx);
if (!arg)
break;
+
+ SymbolFile *symbol_file = m_ast.GetSymbolFile();
+ if (!symbol_file)
+ return nullptr;
+
lldb_private::Type *arg_type =
- m_ast.GetSymbolFile()->ResolveTypeUID(arg->getSymIndexId());
+ symbol_file->ResolveTypeUID(arg->getSymIndexId());
// If there's some error looking up one of the dependent types of this
// function signature, bail.
if (!arg_type)
@@ -621,8 +630,12 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
lldbassert(arg_list.size() <= num_args);
auto pdb_return_type = func_sig->getReturnType();
+ SymbolFile *symbol_file = m_ast.GetSymbolFile();
+ if (!symbol_file)
+ return nullptr;
+
lldb_private::Type *return_type =
- m_ast.GetSymbolFile()->ResolveTypeUID(pdb_return_type->getSymIndexId());
+ symbol_file->ResolveTypeUID(pdb_return_type->getSymIndexId());
// If there's some error looking up one of the dependent types of this
// function signature, bail.
if (!return_type)
@@ -654,10 +667,13 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
if (uint64_t size = array_type->getLength())
bytes = size;
+ SymbolFile *symbol_file = m_ast.GetSymbolFile();
+ if (!symbol_file)
+ return nullptr;
+
// If array rank > 0, PDB gives the element type at N=0. So element type
// will parsed in the order N=0, N=1,..., N=rank sequentially.
- lldb_private::Type *element_type =
- m_ast.GetSymbolFile()->ResolveTypeUID(element_uid);
+ lldb_private::Type *element_type = symbol_file->ResolveTypeUID(element_uid);
if (!element_type)
return nullptr;
@@ -711,7 +727,12 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
case PDB_SymType::PointerType: {
auto *pointer_type = llvm::dyn_cast<PDBSymbolTypePointer>(&type);
assert(pointer_type);
- Type *pointee_type = m_ast.GetSymbolFile()->ResolveTypeUID(
+
+ SymbolFile *symbol_file = m_ast.GetSymbolFile();
+ if (!symbol_file)
+ return nullptr;
+
+ Type *pointee_type = symbol_file->ResolveTypeUID(
pointer_type->getPointeeType()->getSymIndexId());
if (!pointee_type)
return nullptr;
@@ -719,8 +740,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
if (pointer_type->isPointerToDataMember() ||
pointer_type->isPointerToMemberFunction()) {
auto class_parent_uid = pointer_type->getRawSymbol().getClassParentId();
- auto class_parent_type =
- m_ast.GetSymbolFile()->ResolveTypeUID(class_parent_uid);
+ auto class_parent_type = symbol_file->ResolveTypeUID(class_parent_uid);
assert(class_parent_type);
CompilerType pointer_ast_type;
@@ -950,7 +970,7 @@ PDBASTParser::GetDeclForSymbol(const llvm::pdb::PDBSymbol &symbol) {
}
}
if (params.size())
- m_ast.SetFunctionParameters(decl, params.data(), params.size());
+ m_ast.SetFunctionParameters(decl, params);
m_uid_to_decl[sym_id] = decl;