[Lldb-commits] [PATCH] D104162: NFC Fix the handling of BreakpointOptions - return references to make it clear when you will get a valid object

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 11 17:15:45 PDT 2021


jingham created this revision.
jingham added reviewers: aprantl, shafik.
jingham requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

  Many of the API's that returned BreakpointOptions always returned valid ones.
  However, 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, since it wasn't clear 
  when you did and didn't have to validate the pointers.
  
  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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104162

Files:
  lldb/include/lldb/Breakpoint/Breakpoint.h
  lldb/include/lldb/Breakpoint/BreakpointLocation.h
  lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h
  lldb/include/lldb/Breakpoint/BreakpointSite.h
  lldb/include/lldb/Interpreter/ScriptInterpreter.h
  lldb/source/API/SBBreakpoint.cpp
  lldb/source/API/SBBreakpointLocation.cpp
  lldb/source/API/SBBreakpointName.cpp
  lldb/source/Breakpoint/Breakpoint.cpp
  lldb/source/Breakpoint/BreakpointLocation.cpp
  lldb/source/Breakpoint/BreakpointLocationCollection.cpp
  lldb/source/Breakpoint/BreakpointName.cpp
  lldb/source/Breakpoint/BreakpointOptions.cpp
  lldb/source/Breakpoint/BreakpointSite.cpp
  lldb/source/Commands/CommandObjectBreakpoint.cpp
  lldb/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/source/Core/IOHandlerCursesGUI.cpp
  lldb/source/Interpreter/ScriptInterpreter.cpp
  lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp
  lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
  lldb/source/Target/StopInfo.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104162.351596.patch
Type: text/x-patch
Size: 56001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210612/08d27e6b/attachment-0001.bin>


More information about the lldb-commits mailing list