[PATCH] D67183: [Python] Implement truth testing for lldb.value

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 11:58:40 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL370953: [Python] Implement truth testing for lldb.value (authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67183?vs=218724&id=218763#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67183

Files:
  lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
  lldb/trunk/scripts/Python/python-extensions.swig


Index: lldb/trunk/scripts/Python/python-extensions.swig
===================================================================
--- lldb/trunk/scripts/Python/python-extensions.swig
+++ lldb/trunk/scripts/Python/python-extensions.swig
@@ -980,6 +980,9 @@
     def __nonzero__(self):
         return self.sbvalue.__nonzero__()
 
+    def __bool__(self):
+        return self.sbvalue.__bool__()
+
     def __str__(self):
         return self.sbvalue.__str__()
 
Index: lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
@@ -160,6 +160,10 @@
                 val_i.GetType()).AddressOf(),
             VALID_VARIABLE)
 
+        # Check that lldb.value implements truth testing.
+        self.assertFalse(lldb.value(frame0.FindVariable('bogus')))
+        self.assertTrue(lldb.value(frame0.FindVariable('uinthex')))
+
         self.assertTrue(int(lldb.value(frame0.FindVariable('uinthex')))
                         == 3768803088, 'uinthex == 3768803088')
         self.assertTrue(int(lldb.value(frame0.FindVariable('sinthex')))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67183.218763.patch
Type: text/x-patch
Size: 1271 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190904/35390ae0/attachment.bin>


More information about the llvm-commits mailing list