Files
clang-p2996/lldb/test/API/lang/objc/warnings-in-expr-parser/TestObjCWarningsInExprParser.py
Raphael Isemann 19b4d3ce27 [lldb] Don't emit a warning when using Objective-C getters in expressions
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).

Reviewed By: kastiglione

Differential Revision: https://reviews.llvm.org/D94307
2021-02-11 16:48:41 +01:00

24 lines
782 B
Python

"""
Test the warnings that LLDB emits when parsing Objective-C expressions.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
@no_debug_info_test
def test(self):
self.build()
lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.m"))
# Don't warn about not using the result of getters. This is perfectly
# fine in the expression parser and LLDB shouldn't warn the user about that.
result = self.frame().EvaluateExpression("m.m; unknown_var_to_cause_an_error")
self.assertNotIn("getters should not", str(result.GetError()))