Skip to content
Open
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
14 changes: 7 additions & 7 deletions lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,

switch (tag) {
case DW_TAG_typedef:
case DW_TAG_template_alias:
case DW_TAG_base_type:
case DW_TAG_pointer_type:
case DW_TAG_reference_type:
Expand Down Expand Up @@ -777,7 +778,7 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext &sc,
TypeSP type_sp;
CompilerType clang_type;

if (tag == DW_TAG_typedef) {
if (tag == DW_TAG_typedef || tag == DW_TAG_template_alias) {
// DeclContext will be populated when the clang type is materialized in
// Type::ResolveCompilerType.
PrepareContextToReceiveMembers(
Expand Down Expand Up @@ -865,6 +866,7 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext &sc,
encoding_data_type = Type::eEncodingIsRValueReferenceUID;
break;
case DW_TAG_typedef:
case DW_TAG_template_alias:
encoding_data_type = Type::eEncodingIsTypedefUID;
break;
case DW_TAG_const_type:
Expand Down Expand Up @@ -3848,12 +3850,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 @@ -276,10 +281,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 @@ -1573,17 +1573,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 @@ -1627,8 +1627,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
Loading