[Lldb-commits] [lldb] [lldb] print a notice when `source list` paging reaches the end of th… (PR #137515)

via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 29 18:43:07 PDT 2025


hapeeeeee wrote:

> That's better, but checking something the SourceManager calls the last line against UINT32_MAX seem to me too much implementation detail. I also can't see any other reason why m_last_line would be useful outside the SourceManager.
> 
> So maybe a better API would be
> 
> `bool SourceManager::AtLastLine() { return m_last_line == UINT32_MAX; } `
> 
> Then client code doesn't have to know how the SourceManager manages its paging through the source file.

As you suggested, I’ve encapsulated the `AsLastLine` for checking whether a line is the last one, and reused this API in the `SourceManager` to replace the original logic for determining the last line.

> Also, it would be good in your test to page twice past the end of the source buffer, not just once. That SHOULD just present the same error again, but it would be good to assert that it does.

I added a second `list` command when reaching the end of the file to ensure the output is consistent across both attempts.

Could you please review my commit again? @jimingham




https://github.com/llvm/llvm-project/pull/137515


More information about the lldb-commits mailing list