summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/python_api/debugger/TestDebuggerAPI.py
diff options
context:
space:
mode:
authorAdrian McCarthy <amccarth@google.com>2019-04-03 19:49:14 +0000
committerAdrian McCarthy <amccarth@google.com>2019-04-03 19:49:14 +0000
commitffa857c7a6550c75b3f6dab8272592b4640425cf (patch)
tree49c457873b4f646c36e6b9fefc8c0154033a0b69 /lldb/packages/Python/lldbsuite/test/python_api/debugger/TestDebuggerAPI.py
parentc26d6f05d298a4de2151b531f0a43b1142e6d918 (diff)
downloadbcm5719-llvm-ffa857c7a6550c75b3f6dab8272592b4640425cf.tar.gz
bcm5719-llvm-ffa857c7a6550c75b3f6dab8272592b4640425cf.zip
Fix and simplify PrepareCommandsForSourcing
Spotted some problems in the Driver's PrepareCommandsForSourcing while helping a colleague track another problem. 1. One error case was not handled because there was no else clause. Fixed by switching to llvm's early-out style instead of nested `if (succes) { } else { }` cases. This keeps error handling close to the actual error. 2. One call-site failed to call the clean-up function. I solved this by simplifying the API. PrepareCommandsForSourcing no longer requires the caller to provide a buffer for the pipe's file descriptors and to call a separate clean-up function later. PrepareCommandsForSourcing now ensures the file descriptors are handled before returning. (The read end of the pipe is held open by the returned FILE * as before.) I also eliminated an unnecessary local, shorted the lifetime of another, and tried to improve the comments. I wrapped the call to open the pipe to get the `#ifdef`s out of the mainline. I replaced the `close`/`_close` calls with a platform-neutral helper from `llvm::sys` for the same reason. Per discussion on the review, I'm leaving the `fdopen` call to use the spelling that Windows has officially deprecated because it still works it avoids more `#ifdef`s. Differential Revision: https://reviews.llvm.org/D60152 llvm-svn: 357626
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/debugger/TestDebuggerAPI.py')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud