This is an archive of the discontinued LLVM Phabricator instance.

NFC Fix the handling of BreakpointOptions - return references to make it clear when you will get a valid object
ClosedPublic

Authored by jingham on Jun 11 2021, 5:15 PM.

Details

Summary
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.

Diff Detail

Event Timeline

jingham requested review of this revision.Jun 11 2021, 5:15 PM
jingham created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJun 11 2021, 5:15 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jun 15 2021, 2:34 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.