Convert these two modules to use the compact truth value testing as well.

llvm-svn: 132072
This commit is contained in:
Johnny Chen 2011-05-25 19:06:18 +00:00
parent 9605a698b0
commit 3cd1e55103
2 changed files with 5 additions and 5 deletions

View File

@ -522,7 +522,7 @@ class TestBase(unittest2.TestCase):
except AttributeError:
self.dbg = lldb.SBDebugger.Create()
if not self.dbg.IsValid():
if not self.dbg:
raise Exception('Invalid debugger instance')
# We want our debugger to be synchronous.
@ -715,7 +715,7 @@ class TestBase(unittest2.TestCase):
# Terminate the current process being debugged, if any.
if self.runStarted:
self.runCmd("process kill", PROCESS_KILLED, check=False)
elif self.process and self.process.IsValid():
elif self.process:
rc = self.invoke(self.process, "Kill")
self.assertTrue(rc.Success(), PROCESS_KILLED)
del self.process

View File

@ -382,7 +382,7 @@ def print_stacktrace(thread, string_buffer = False):
function = frame.GetFunction()
load_addr = addrs[i].GetLoadAddress(target)
if not function.IsValid():
if not function:
file_addr = addrs[i].GetFileAddress()
print >> output, " frame #{num}: {addr:#016x} {mod}`{symbol} + ????".format(
num=i, addr=load_addr, mod=mods[i], symbol=symbols[i])
@ -440,9 +440,9 @@ def get_args_as_string(frame):
args.append("(%s)%s=%s" % (var.GetTypeName(),
var.GetName(),
var.GetValue(frame)))
if frame.GetFunction().IsValid():
if frame.GetFunction():
name = frame.GetFunction().GetName()
elif frame.GetSymbol().IsValid():
elif frame.GetSymbol():
name = frame.GetSymbol().GetName()
else:
name = ""