This is an archive of the discontinued LLVM Phabricator instance.

Fix evaluation of unicode character array types (char16_t[] and char32_t[])
ClosedPublic

Authored by evgeny777 on Sep 22 2015, 5:07 AM.

Details

Summary

Suppose we have UTF-16 string

char16_t[] s = u"hello";

If we try to evaluate it with lldb we will get this:

(char16_t [6]) $0 = ([0] = U+0068 u'h', [1] = U+0065 u'e', [2] = U+006c u'l', [3] = U+006c u'l', [4] = U+006f u'o', [5] = U+0000 u'\0')

After applying the patch we'll get this:

(char16_t [6]) $0 = u"hello"

Diff Detail

Repository
rL LLVM

Event Timeline

evgeny777 updated this revision to Diff 35364.Sep 22 2015, 5:07 AM
evgeny777 retitled this revision from to Fix evaluation of unicode character array types (char16_t[] and char32_t[]).
evgeny777 updated this object.
evgeny777 added a reviewer: granata.enrico.
evgeny777 added a subscriber: dawn.
granata.enrico accepted this revision.Sep 22 2015, 10:33 AM
granata.enrico edited edge metadata.

Only thing I would suggest is using LLDB_INVALID_ADDRESS instead of 0 in GetArrayAddressOrPointerValue()

Other than that LGTM!

source/DataFormatters/FormattersHelpers.cpp
302 ↗(On Diff #35364)

Is there a reason not to use LLDB_INVALID_ADDRESS instead of 0?

This revision is now accepted and ready to land.Sep 22 2015, 10:33 AM
This revision was automatically updated to reflect the committed changes.