This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Don't emit a warning when using Objective-C getters in expressions
ClosedPublic

Authored by teemperor on Jan 8 2021, 7:11 AM.

Details

Summary

Clang emits a warning when accessing an Objective-C getter but not using the result.
This gets triggered when just trying to print a getter value in the expression parser (where
Clang just sees a normal expression like obj.getter while parsing).

This patch just disables the warning in the expression parser (similar to what we do with
the C++ equivalent of just accessing a member variable but not doing anything with it).

Diff Detail

Event Timeline

teemperor requested review of this revision.Jan 8 2021, 7:11 AM
teemperor created this revision.
kastiglione accepted this revision.Feb 8 2021, 8:25 PM
kastiglione added inline comments.
lldb/test/API/lang/objc/warnings-in-expr-parser/main.m
3–10

property getters and setters are automatically generated, this could be an empty @implementation.

15

I don't think the pool is necessary, the MyClass instance isn't using it.

You could compile this file with -fobjc-arc and then it would do automatic memory management, tho for this file it really doesn't matter.

This revision is now accepted and ready to land.Feb 8 2021, 8:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 11 2021, 7:49 AM