This revision was automatically updated to reflect the committed changes. Closed by commit rG19b4d3ce27d5: [lldb] Don't emit a warning when using Objective-C getters in expressions (authored by teemperor). Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
Changed prior to commit: https://reviews.llvm.org/D94307?vs=315389&id=323018#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D94307/new/ https://reviews.llvm.org/D94307 Files: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp lldb/test/API/lang/objc/warnings-in-expr-parser/Makefile lldb/test/API/lang/objc/warnings-in-expr-parser/TestObjCWarningsInExprParser.py lldb/test/API/lang/objc/warnings-in-expr-parser/main.m Index: lldb/test/API/lang/objc/warnings-in-expr-parser/main.m =================================================================== --- /dev/null +++ lldb/test/API/lang/objc/warnings-in-expr-parser/main.m @@ -0,0 +1,15 @@ +#include <Foundation/Foundation.h> + +@interface MyClass : NSObject +@property int m; +@end + +@implementation MyClass { +} +@end + +int main() { + MyClass *m = [[MyClass alloc] init]; + m.m; + return 0; // break here +} Index: lldb/test/API/lang/objc/warnings-in-expr-parser/TestObjCWarningsInExprParser.py =================================================================== --- /dev/null +++ lldb/test/API/lang/objc/warnings-in-expr-parser/TestObjCWarningsInExprParser.py @@ -0,0 +1,23 @@ +""" +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())) Index: lldb/test/API/lang/objc/warnings-in-expr-parser/Makefile =================================================================== --- /dev/null +++ lldb/test/API/lang/objc/warnings-in-expr-parser/Makefile @@ -0,0 +1,5 @@ +OBJC_SOURCES := main.m +LD_EXTRAS := -framework Foundation +CFLAGS_EXTRAS := -fobjc-arc + +include Makefile.rules Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -343,6 +343,7 @@ const std::vector<const char *> groupsToIgnore = { "unused-value", "odr", + "unused-getter-return-value", }; for (const char *group : groupsToIgnore) { compiler.getDiagnostics().setSeverityForGroup(
Index: lldb/test/API/lang/objc/warnings-in-expr-parser/main.m =================================================================== --- /dev/null +++ lldb/test/API/lang/objc/warnings-in-expr-parser/main.m @@ -0,0 +1,15 @@ +#include <Foundation/Foundation.h> + +@interface MyClass : NSObject +@property int m; +@end + +@implementation MyClass { +} +@end + +int main() { + MyClass *m = [[MyClass alloc] init]; + m.m; + return 0; // break here +} Index: lldb/test/API/lang/objc/warnings-in-expr-parser/TestObjCWarningsInExprParser.py =================================================================== --- /dev/null +++ lldb/test/API/lang/objc/warnings-in-expr-parser/TestObjCWarningsInExprParser.py @@ -0,0 +1,23 @@ +""" +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())) Index: lldb/test/API/lang/objc/warnings-in-expr-parser/Makefile =================================================================== --- /dev/null +++ lldb/test/API/lang/objc/warnings-in-expr-parser/Makefile @@ -0,0 +1,5 @@ +OBJC_SOURCES := main.m +LD_EXTRAS := -framework Foundation +CFLAGS_EXTRAS := -fobjc-arc + +include Makefile.rules Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -343,6 +343,7 @@ const std::vector<const char *> groupsToIgnore = { "unused-value", "odr", + "unused-getter-return-value", }; for (const char *group : groupsToIgnore) { compiler.getDiagnostics().setSeverityForGroup(
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits