[Lldb-commits] [PATCH] D66863: [lldb] Unify target checking in CommandObject

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 28 01:50:32 PDT 2019


teemperor created this revision.
teemperor added a reviewer: labath.
Herald added subscribers: lldb-commits, abidh.
Herald added a project: LLDB.

We currently have several CommandObjects that manually reimplement the checking for a selected target
or a target in the execution context (which is the selected target when they are invoked). This patch removes
all these checks and replaces them by setting the eCommandRequiresTarget flag that Pavel suggested. With
this flag we are doing the same check but without having to duplicate this code in all these CommandObjects.

I also added a `GetSelectedTarget()` variant of the `GetSelectedOrDummyTarget()` function to the
CommandObject that checks that the flag is set and then returns a reference to the target. I didn't rewrite
all the `target` variables from `Target *` to `Target &` in this patch as last time this change caused a lot of merge
conflicts in Swift and I would prefer having that in a separate NFC commit.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D66863

Files:
  lldb/include/lldb/Interpreter/CommandObject.h
  lldb/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/source/Commands/CommandObjectDisassemble.cpp
  lldb/source/Commands/CommandObjectProcess.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Commands/CommandObjectWatchpoint.cpp
  lldb/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/source/Interpreter/CommandObject.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66863.217580.patch
Type: text/x-patch
Size: 88916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190828/5f86147a/attachment-0001.bin>


More information about the lldb-commits mailing list