diff options
author | Jim Ingham <jingham@apple.com> | 2021-06-11 17:00:46 -0700 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2021-06-15 14:34:02 -0700 |
commit | cfb96d845a684a5c567823dbe2aa4392937ee979 (patch) | |
tree | 90bd697e80379e5571851ea981486af352823f1b /lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h | |
parent | 56da28240f3c9d1c0b7152749bfd4777c67828e0 (diff) | |
download | llvm-cfb96d845a684a5c567823dbe2aa4392937ee979.zip llvm-cfb96d845a684a5c567823dbe2aa4392937ee979.tar.gz llvm-cfb96d845a684a5c567823dbe2aa4392937ee979.tar.bz2 |
Convert functions that were returning BreakpointOption * to BreakpointOption &.
This is an NFC cleanup.
Many of the API's that returned BreakpointOptions always returned valid ones.
Internally the BreakpointLocations usually have null BreakpointOptions, since they
use their owner's options until an option is set specifically on the location.
So the original code used pointers & unique_ptr everywhere for consistency.
But that made the code hard to reason about from the outside.
This patch changes the code so that everywhere an API is guaranteed to
return a non-null BreakpointOption, it returns it as a reference to make
that clear.
It also changes the Breakpoint to hold a BreakpointOption
member where it previously had a UP. Since we were always filling the UP
in the Breakpoint constructor, having the UP wasn't helping anything.
Differential Revision: https://reviews.llvm.org/D104162
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h index 1130cee..a6908d2 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h +++ b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h @@ -9,6 +9,8 @@ #ifndef liblldb_ScriptInterpreterLua_h_ #define liblldb_ScriptInterpreterLua_h_ +#include <vector> + #include "lldb/Core/StructuredDataImpl.h" #include "lldb/Interpreter/ScriptInterpreter.h" #include "lldb/Utility/Status.h" @@ -72,21 +74,21 @@ public: llvm::Error LeaveSession(); void CollectDataForBreakpointCommandCallback( - std::vector<BreakpointOptions *> &bp_options_vec, + std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec, CommandReturnObject &result) override; - Status SetBreakpointCommandCallback(BreakpointOptions *bp_options, + Status SetBreakpointCommandCallback(BreakpointOptions &bp_options, const char *command_body_text) override; Status SetBreakpointCommandCallbackFunction( - BreakpointOptions *bp_options, const char *function_name, + BreakpointOptions &bp_options, const char *function_name, StructuredData::ObjectSP extra_args_sp) override; private: std::unique_ptr<Lua> m_lua; bool m_session_is_active = false; - Status RegisterBreakpointCallback(BreakpointOptions *bp_options, + Status RegisterBreakpointCallback(BreakpointOptions &bp_options, const char *command_body_text, StructuredData::ObjectSP extra_args_sp); }; |