This is an archive of the discontinued LLVM Phabricator instance.

Make Scalar::GetValue more consistent
ClosedPublic

Authored by labath on Sep 1 2016, 3:49 AM.

Details

Summary

It seems the original intention of the function was printing signed values in decimal format, and
unsigned values in hex (without the leading "0x"). However, signed and unsigned long were
exchanged, which lead to amusing test failures in TestMemoryFind.py.

Instead of just switching the two, I think we should just print everything in decimal here, as
the current behaviour is very confusing (especially when one does not request printing of types).
Nothing seems to depend on this behaviour except and we already have a way for the user to
request the format he wants when printing values for most commands (which presumably does not go
through this function).

I also add a unit tests for the function in question.

Diff Detail

Repository
rL LLVM

Event Timeline

labath updated this revision to Diff 69979.Sep 1 2016, 3:49 AM
labath retitled this revision from to Make Scalar::GetValue more consistent.
labath updated this object.
labath added reviewers: clayborg, granata.enrico.
labath added a subscriber: lldb-commits.
clayborg accepted this revision.Sep 1 2016, 10:07 AM
clayborg edited edge metadata.
This revision is now accepted and ready to land.Sep 1 2016, 10:07 AM
This revision was automatically updated to reflect the committed changes.