from __future__ import division
-import re
import lldb.formatters.Logger
# C++ STL formatters for LLDB
try:
self.payload = self.valobj.GetChildMemberWithName('_M_payload')
self.value = self.payload.GetChildMemberWithName('_M_payload')
- self.count = self.payload.GetChildMemberWithName('_M_engaged').GetValueAsUnsigned(0)
+ self.has_value = self.payload.GetChildMemberWithName('_M_engaged').GetValueAsUnsigned(0) != 0
except:
- self.count = 0
+ self.has_value = False
return False
def num_children(self):
- return self.count
+ return 1 if self.has_value else 0
def get_child_index(self, name):
return 0
// __engaged_ is a bool flag and is true if the optional contains a value.
// Converting it to unsigned gives us a size of 1 if it contains a value
// and 0 if not.
- m_has_value = engaged_sp->GetValueAsUnsigned(0) == 1;
+ m_has_value = engaged_sp->GetValueAsUnsigned(0) != 0;
return false;
}
def do_test_with_run_command(self, stdlib_type):
"""Test that that file and class static variables display correctly."""
+ # This is the function to remove the custom formats in order to have a
+ # clean slate for the next test case.
+ def cleanup():
+ self.runCmd('type format clear', check=False)
+ self.runCmd('type summary clear', check=False)
+ self.runCmd('type filter clear', check=False)
+ self.runCmd('type synth clear', check=False)
+ self.addTearDownHook(cleanup)
+
self.build(dictionary={stdlib_type: "1"})
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)