This is an archive of the discontinued LLVM Phabricator instance.

Print reference values on one line.
AbandonedPublic

Authored by chaoren on Jul 24 2015, 3:31 PM.

Details

Diff Detail

Event Timeline

chaoren updated this revision to Diff 30617.Jul 24 2015, 3:31 PM
chaoren retitled this revision from to Print reference values on one line..
chaoren updated this object.
chaoren added reviewers: ovyalov, clayborg.
chaoren added a subscriber: lldb-commits.

I am assuming that your intent is:

int x = 1;
int& y = 1;

(lldb) frame variable y
(int&) y = 0x123456 (y = 1)

If so, two things:
a) a much better way would be to make FormatManager::ShouldPrintAsOneLiner() decide that a T& can be printed on one-line iff the referenced thing can
b) test cases would be great

If I am reading your intent wrong, can you please elaborate on what you're trying to achieve?

I would really appreciate if you didn't commit this.

granata.enrico requested changes to this revision.Jul 24 2015, 3:41 PM
granata.enrico added a reviewer: granata.enrico.
granata.enrico edited edge metadata.
This revision now requires changes to proceed.Jul 24 2015, 3:43 PM
clayborg resigned from this revision.Jul 24 2015, 3:43 PM
clayborg removed a reviewer: clayborg.

I will defer to Enrico on this one.

chaoren added a comment.EditedJul 24 2015, 3:48 PM

I am assuming that your intent is:

Yep.

a) a much better way would be to make FormatManager::ShouldPrintAsOneLiner() decide that a T& can be printed on one-line iff the referenced thing can

I thought ShouldPrintAsOneLiner already does that for each of the < 50 children. The change around bool print_oneline is only refactoring for readability. The only difference is that curr_ptr_depth is not set to 1 so ShouldPrintAsOneLiner can actually get called.

Can you please try using revision 243301 or later?

In my testing, this change makes references work the way you expect
If you're still not getting the behavior you expect, can you please include a test case that fails before your change but succeeds after? That should help ensure we don't regress, and might also help us pinpoint the correct change to make

chaoren abandoned this revision.Jul 27 2015, 11:59 AM

Yes, rL243301 does make references print correctly. This change won't be necessary anymore. It seems like it'd be nice to have a test case regardless. Could you please add a test case for your change?