================ @@ -320,25 +320,37 @@ void Function::GetStartLineSourceInfo(SupportFileSP &source_file_sp, } } -void Function::GetEndLineSourceInfo(FileSpec &source_file, uint32_t &line_no) { - line_no = 0; - source_file.Clear(); - - // The -1 is kind of cheesy, but I want to get the last line entry for the - // given function, not the first entry of the next. - Address scratch_addr(GetAddressRange().GetBaseAddress()); - scratch_addr.SetOffset(scratch_addr.GetOffset() + - GetAddressRange().GetByteSize() - 1); - +llvm::Expected<std::pair<SupportFileSP, Function::SourceRange>> +Function::GetSourceInfo() { + SupportFileSP source_file_sp; + uint32_t start_line; + GetStartLineSourceInfo(source_file_sp, start_line); LineTable *line_table = m_comp_unit->GetLineTable(); - if (line_table == nullptr) - return; + if (start_line == 0 || !line_table) { ---------------- jimingham wrote:
Is the assumption here that the first source line of a function can never legitimately be a compiler-generated line that we assign 0? Is that guaranteed even in optimized code? https://github.com/llvm/llvm-project/pull/126526 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits