This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Fix matchers for char array formatters
ClosedPublic

Authored by labath on Oct 28 2021, 5:15 AM.

Details

Summary

They were being applied too narrowly (they didn't cover signed char *,
for instance), and too broadly (they covered SomeTemplate<char[6]>) at
the same time.

Depends on D112708.

Diff Detail

Event Timeline

labath requested review of this revision.Oct 28 2021, 5:15 AM
labath created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2021, 5:15 AM
shafik added a subscriber: shafik.Oct 28 2021, 8:17 PM

Nice catch!

lldb/test/API/functionalities/data-formatter/stringprinter/main.cpp
21

It feels like writing out the decls by hand would have been quicker but perhaps less satisfying...

labath added inline comments.Oct 29 2021, 1:35 AM
lldb/test/API/functionalities/data-formatter/stringprinter/main.cpp
21

:D

@jingham, @shafik, do you see any issues with this patch?

jingham accepted this revision.Dec 16 2021, 12:13 PM

The substance is fine, you kept the common cases fast and then added fallback for the others with the regex.

That test seems like an object lesson in what not to do in an inline test, but that wasn't your invention, so it's hard to complain too much.

This revision is now accepted and ready to land.Dec 16 2021, 12:13 PM
This revision was automatically updated to reflect the committed changes.

Pavel, I apologize no one let you know earlier but it looks like this change broke TestFormattersBoolRefPtr.py test.

see: https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/39449/

Because BOOL is actually a signed char

shafik added a subscriber: aprantl.Jan 5 2022, 1:32 PM

Because BOOL is actually a signed char

@aprantl corrected me, it can vary on some platforms it is signed char but on others it is bool.

Thanks for the heads up. I've reverted the problematic parts in 31c7165a2b. I'll come with a proper fix soon-ish.

it can vary on some platforms it is signed char but on others it is bool.

For those interested, Objective-C BOOL is a signed char on macOS and 32-bit iOS and bool on 64-bit iOS and derived platforms (watchOS & tvOS).