Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3707,12 +3707,10 @@ bool DWARFASTParserClang::CopyUniqueClassMethodTypes(
}
}

DWARFASTParserClang *src_dwarf_ast_parser =
static_cast<DWARFASTParserClang *>(
SymbolFileDWARF::GetDWARFParser(*src_class_die.GetCU()));
DWARFASTParserClang *dst_dwarf_ast_parser =
static_cast<DWARFASTParserClang *>(
SymbolFileDWARF::GetDWARFParser(*dst_class_die.GetCU()));
auto *src_dwarf_ast_parser = llvm::cast<DWARFASTParserClang>(
SymbolFileDWARF::GetDWARFParser(*src_class_die.GetCU()));
auto *dst_dwarf_ast_parser = llvm::cast<DWARFASTParserClang>(
SymbolFileDWARF::GetDWARFParser(*dst_class_die.GetCU()));
auto link = [&](DWARFDIE src, DWARFDIE dst) {
auto &die_to_type = dst_class_die.GetDWARF()->GetDIEToType();
clang::DeclContext *dst_decl_ctx =
Expand Down
9 changes: 5 additions & 4 deletions lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ class DWARFASTParserClang : public lldb_private::plugin::dwarf::DWARFASTParser {

~DWARFASTParserClang() override;

// LLVM RTTI support
static bool classof(const DWARFASTParser *Parser) {
return Parser->GetKind() == Kind::DWARFASTParserClang;
}

// DWARFASTParser interface.
lldb::TypeSP
ParseTypeFromDWARF(const lldb_private::SymbolContext &sc,
Expand Down Expand Up @@ -264,10 +269,6 @@ class DWARFASTParserClang : public lldb_private::plugin::dwarf::DWARFASTParser {
lldb::ModuleSP
GetModuleForType(const lldb_private::plugin::dwarf::DWARFDIE &die);

static bool classof(const DWARFASTParser *Parser) {
return Parser->GetKind() == Kind::DWARFASTParserClang;
}

private:
struct FieldInfo {
/// Size in bits that this field occupies. Can but
Expand Down
11 changes: 5 additions & 6 deletions lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1560,17 +1560,17 @@ bool SymbolFileDWARF::HasForwardDeclForCompilerType(
auto clang_type_system = compiler_type.GetTypeSystem<TypeSystemClang>();
if (!clang_type_system)
return false;
DWARFASTParserClang *ast_parser =
static_cast<DWARFASTParserClang *>(clang_type_system->GetDWARFParser());
auto *ast_parser =
llvm::cast<DWARFASTParserClang>(clang_type_system->GetDWARFParser());
return ast_parser->GetClangASTImporter().CanImport(compiler_type);
}

bool SymbolFileDWARF::CompleteType(CompilerType &compiler_type) {
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
auto clang_type_system = compiler_type.GetTypeSystem<TypeSystemClang>();
if (clang_type_system) {
DWARFASTParserClang *ast_parser =
static_cast<DWARFASTParserClang *>(clang_type_system->GetDWARFParser());
auto *ast_parser =
llvm::cast<DWARFASTParserClang>(clang_type_system->GetDWARFParser());
if (ast_parser &&
ast_parser->GetClangASTImporter().CanImport(compiler_type))
return ast_parser->GetClangASTImporter().CompleteType(compiler_type);
Expand Down Expand Up @@ -1614,8 +1614,7 @@ bool SymbolFileDWARF::CompleteType(CompilerType &compiler_type) {

if (decl_die != def_die) {
GetDIEToType()[def_die.GetDIE()] = type;
DWARFASTParserClang *ast_parser =
static_cast<DWARFASTParserClang *>(dwarf_ast);
auto *ast_parser = llvm::cast<DWARFASTParserClang>(dwarf_ast);
ast_parser->MapDeclDIEToDefDIE(decl_die, def_die);
}

Expand Down
2 changes: 1 addition & 1 deletion lldb/unittests/Symbol/TestClangASTImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ TEST_F(TestClangASTImporter, RecordLayoutFromOrigin) {
clang_utils::SourceASTWithRecord source;

auto *dwarf_parser =
static_cast<DWARFASTParserClang *>(source.ast->GetDWARFParser());
llvm::cast<DWARFASTParserClang>(source.ast->GetDWARFParser());
auto &importer = dwarf_parser->GetClangASTImporter();

// Set the layout for the origin decl in the origin ClangASTImporter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ TEST_F(DWARFASTParserClangTests, TestParseSubroutine_ExplicitObjectParameter) {
ASSERT_TRUE(static_cast<bool>(ts_or_err));
llvm::consumeError(ts_or_err.takeError());
auto *parser =
static_cast<DWARFASTParserClang *>((*ts_or_err)->GetDWARFParser());
llvm::cast<DWARFASTParserClang>((*ts_or_err)->GetDWARFParser());

auto context_die = cu_die.GetFirstChild();
ASSERT_TRUE(context_die.IsValid());
Expand Down Expand Up @@ -1434,7 +1434,7 @@ TEST_F(DWARFASTParserClangTests, TestParseSubroutine_ParameterCreation) {
llvm::consumeError(ts_or_err.takeError());

auto *ts = static_cast<TypeSystemClang *>(ts_or_err->get());
auto *parser = static_cast<DWARFASTParserClang *>(ts->GetDWARFParser());
auto *parser = llvm::cast<DWARFASTParserClang>(ts->GetDWARFParser());

auto subprogram = cu_die.GetFirstChild();
ASSERT_TRUE(subprogram.IsValid());
Expand Down
Loading