This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Make GetDIENamesAndRanges() allow 0-valued decl and call lines
ClosedPublic

Authored by dstenb on Jan 25 2023, 8:18 AM.

Details

Summary

In an upcoming patch, D142556, Clang is proposed to be changed to emit
line locations that are inlined at line 0. This clashed with the behavior of
GetDIENamesAndRanges() which used 0 as a default value to determine if
file, line or column numbers had been set. Users of that function then
checked for any non-0 values when setting up the call site:

if (call_file != 0 || call_line != 0 || call_column != 0)
  [...]

which did not work with the Clang change since all three values then
could be 0.

This changes the function to use std::optional to catch non-set values
instead.

Diff Detail

Event Timeline

dstenb created this revision.Jan 25 2023, 8:18 AM
Herald added a project: Restricted Project. · View Herald Transcript
dstenb requested review of this revision.Jan 25 2023, 8:18 AM

First time looking at LLDB, so I had trouble finding a suitable way to create a reproducer for this. I would be happy to change to another type of lit test if that is more suitable.

dstenb edited the summary of this revision. (Show Details)Jan 25 2023, 8:37 AM
clayborg accepted this revision.Jan 26 2023, 1:40 PM

As long as there are no regressions in the test suite this looks good to me

This revision is now accepted and ready to land.Jan 26 2023, 1:40 PM
dstenb added a comment.Mar 6 2023, 5:22 AM

As long as there are no regressions in the test suite this looks good to me

Thanks, and sorry for the delay with landing this! I have ran check-lldb. I will land this shortly.