Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
Show First 20 Lines • Show All 2,388 Lines • ▼ Show 20 Lines | |||||
Function * | Function * | ||||
DWARFASTParserClang::ParseFunctionFromDWARF(CompileUnit &comp_unit, | DWARFASTParserClang::ParseFunctionFromDWARF(CompileUnit &comp_unit, | ||||
const DWARFDIE &die, | const DWARFDIE &die, | ||||
const AddressRange &func_range) { | const AddressRange &func_range) { | ||||
assert(func_range.GetBaseAddress().IsValid()); | assert(func_range.GetBaseAddress().IsValid()); | ||||
DWARFRangeList func_ranges; | DWARFRangeList func_ranges; | ||||
const char *name = nullptr; | const char *name = nullptr; | ||||
const char *mangled = nullptr; | const char *mangled = nullptr; | ||||
int decl_file = 0; | std::optional<int> decl_file; | ||||
int decl_line = 0; | std::optional<int> decl_line; | ||||
int decl_column = 0; | std::optional<int> decl_column; | ||||
int call_file = 0; | std::optional<int> call_file; | ||||
int call_line = 0; | std::optional<int> call_line; | ||||
int call_column = 0; | std::optional<int> call_column; | ||||
DWARFExpressionList frame_base; | DWARFExpressionList frame_base; | ||||
const dw_tag_t tag = die.Tag(); | const dw_tag_t tag = die.Tag(); | ||||
if (tag != DW_TAG_subprogram) | if (tag != DW_TAG_subprogram) | ||||
return nullptr; | return nullptr; | ||||
if (die.GetDIENamesAndRanges(name, mangled, func_ranges, decl_file, decl_line, | if (die.GetDIENamesAndRanges(name, mangled, func_ranges, decl_file, decl_line, | ||||
Show All 13 Lines | else if ((die.GetParent().Tag() == DW_TAG_compile_unit || | ||||
// demangled name using the decl context. We skip if the function is | // demangled name using the decl context. We skip if the function is | ||||
// "main" as its name is never mangled. | // "main" as its name is never mangled. | ||||
func_name.SetValue(ConstructDemangledNameFromDWARF(die), false); | func_name.SetValue(ConstructDemangledNameFromDWARF(die), false); | ||||
} else | } else | ||||
func_name.SetValue(ConstString(name), false); | func_name.SetValue(ConstString(name), false); | ||||
FunctionSP func_sp; | FunctionSP func_sp; | ||||
std::unique_ptr<Declaration> decl_up; | std::unique_ptr<Declaration> decl_up; | ||||
if (decl_file != 0 || decl_line != 0 || decl_column != 0) | if (decl_file || decl_line || decl_column) | ||||
decl_up = std::make_unique<Declaration>(die.GetCU()->GetFile(decl_file), | decl_up = std::make_unique<Declaration>( | ||||
decl_line, decl_column); | die.GetCU()->GetFile(decl_file ? *decl_file : 0), | ||||
decl_line ? *decl_line : 0, decl_column ? *decl_column : 0); | |||||
SymbolFileDWARF *dwarf = die.GetDWARF(); | SymbolFileDWARF *dwarf = die.GetDWARF(); | ||||
// Supply the type _only_ if it has already been parsed | // Supply the type _only_ if it has already been parsed | ||||
Type *func_type = dwarf->GetDIEToType().lookup(die.GetDIE()); | Type *func_type = dwarf->GetDIEToType().lookup(die.GetDIE()); | ||||
assert(func_type == nullptr || func_type != DIE_IS_BEING_PARSED); | assert(func_type == nullptr || func_type != DIE_IS_BEING_PARSED); | ||||
const user_id_t func_user_id = die.GetID(); | const user_id_t func_user_id = die.GetID(); | ||||
▲ Show 20 Lines • Show All 1,253 Lines • Show Last 20 Lines |