[Lldb-commits] [PATCH] D99513: [lldb] Add a test for Obj-C properties with conflicting names

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 30 02:08:37 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG6919c58262b0: [lldb] Add a test for Obj-C properties with conflicting names (authored by teemperor).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99513/new/

https://reviews.llvm.org/D99513

Files:
  lldb/test/API/lang/objc/objc-property/TestObjCProperty.py
  lldb/test/API/lang/objc/objc-property/main.m


Index: lldb/test/API/lang/objc/objc-property/main.m
===================================================================
--- lldb/test/API/lang/objc/objc-property/main.m
+++ lldb/test/API/lang/objc/objc-property/main.m
@@ -22,12 +22,16 @@
 
 - (int) getAccessCount;
 
++ (int) propConflict;
+
 +(BaseClass *) baseClassWithBackedInt: (int) inInt andUnbackedInt: (int) inOtherInt;
 
 @property(getter=myGetUnbackedInt,setter=mySetUnbackedInt:) int unbackedInt;
 @property int backedInt;
 @property (nonatomic, assign) id <MyProtocol> idWithProtocol;
 @property(class) int classInt;
+ at property(getter=propConflict,readonly) int propConflict;
+ at property(readonly,class) int propConflict;
 @end
 
 @implementation BaseClass
@@ -85,6 +89,15 @@
 {
   return _access_count;
 }
+
+- (int) propConflict
+{
+  return 4;
+}
++ (int) propConflict
+{
+  return 6;
+}
 @end
 
 typedef BaseClass TypedefBaseClass;
@@ -94,6 +107,7 @@
 {
   BaseClass *mine = [BaseClass baseClassWithBackedInt: 10 andUnbackedInt: 20];
   TypedefBaseClass *typedefd = mine;
+  int propConflict = mine.propConflict + BaseClass.propConflict;
   
   // Set a breakpoint here.
   int nonexistant = mine.nonexistantInt;
Index: lldb/test/API/lang/objc/objc-property/TestObjCProperty.py
===================================================================
--- lldb/test/API/lang/objc/objc-property/TestObjCProperty.py
+++ lldb/test/API/lang/objc/objc-property/TestObjCProperty.py
@@ -137,3 +137,8 @@
         value = frame.EvaluateExpression("BaseClass.classInt", False)
         self.assertTrue(value.GetError().Success())
         self.assertEquals(value.GetValueAsUnsigned(11111), 234)
+
+        # Test that accessing two distinct class and instance properties that
+        # share the same name works.
+        self.expect_expr("mine.propConflict", result_value="4")
+        self.expect_expr("BaseClass.propConflict", result_value="6")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99513.334082.patch
Type: text/x-patch
Size: 1898 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210330/107d0b7a/attachment.bin>


More information about the lldb-commits mailing list