diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 207d58e80a63..b0cf2d8ff89e 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12214,22 +12214,20 @@ create_excep_cond_exprs (struct ada_catchpoint *c,
 
   /* Iterate over all the catchpoint's locations, and parse an
      expression for each.  */
-  for (bp_location *bl : c->locations ())
+  for (bp_location &bl : c->locations ())
     {
-      struct ada_catchpoint_location *ada_loc
-	= (struct ada_catchpoint_location *) bl;
+      ada_catchpoint_location &ada_loc
+	= static_cast<ada_catchpoint_location &> (bl);
       expression_up exp;
 
-      if (!bl->shlib_disabled)
+      if (!bl.shlib_disabled)
 	{
 	  const char *s;
 
 	  s = cond_string.c_str ();
 	  try
 	    {
-	      exp = parse_exp_1 (&s, bl->address,
-				 block_for_pc (bl->address),
-				 0);
+	      exp = parse_exp_1 (&s, bl.address, block_for_pc (bl.address), 0);
 	    }
 	  catch (const gdb_exception_error &e)
 	    {
@@ -12239,7 +12237,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c,
 	    }
 	}
 
-      ada_loc->excep_cond_expr = std::move (exp);
+      ada_loc.excep_cond_expr = std::move (exp);
     }
 }
 
diff --git a/gdb/break-catch-load.c b/gdb/break-catch-load.c
index d33313a1d989..43962880cd96 100644
--- a/gdb/break-catch-load.c
+++ b/gdb/break-catch-load.c
@@ -102,9 +102,9 @@ solib_catchpoint::breakpoint_hit (const struct bp_location *bl,
       if (pspace != NULL && other->pspace != pspace)
 	continue;
 
-      for (bp_location *other_bl : other->locations ())
+      for (bp_location &other_bl : other->locations ())
 	{
-	  if (other->breakpoint_hit (other_bl, aspace, bp_addr, ws))
+	  if (other->breakpoint_hit (&other_bl, aspace, bp_addr, ws))
 	    return 1;
 	}
     }
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 6ec0f6a11e88..bd3258a742e2 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -842,8 +842,8 @@ mark_breakpoint_modified (struct breakpoint *b)
   if (!is_breakpoint (b))
     return;
 
-  for (bp_location *loc : b->locations ())
-    loc->condition_changed = condition_modified;
+  for (bp_location &loc : b->locations ())
+    loc.condition_changed = condition_modified;
 }
 
 /* Mark location as "conditions have changed" in case the target supports
@@ -1007,14 +1007,14 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp,
       else
 	{
 	  int loc_num = 1;
-	  for (bp_location *loc : b->locations ())
+	  for (bp_location &loc : b->locations ())
 	    {
-	      loc->cond.reset ();
-	      if (loc->disabled_by_cond && loc->enabled)
+	      loc.cond.reset ();
+	      if (loc.disabled_by_cond && loc.enabled)
 		gdb_printf (_("Breakpoint %d's condition is now valid at "
 			      "location %d, enabling.\n"),
 			    b->number, loc_num);
-	      loc->disabled_by_cond = false;
+	      loc.disabled_by_cond = false;
 	      loc_num++;
 
 	      /* No need to free the condition agent expression
@@ -1054,7 +1054,7 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp,
 	       bp_loc_it != bp_loc_range.end ();
 	       ++bp_loc_it)
 	    {
-	      bp_location &loc = **bp_loc_it;
+	      bp_location &loc = *bp_loc_it;
 
 	      try
 		{
@@ -1077,9 +1077,9 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp,
 
 	  /* If we reach here, the condition is valid at some locations.  */
 	  int loc_num = 1;
-	  for (bp_location *loc : b->locations ())
+	  for (bp_location &loc : b->locations ())
 	    {
-	      set_breakpoint_location_condition (exp, loc, b->number, loc_num);
+	      set_breakpoint_location_condition (exp, &loc, b->number, loc_num);
 	      loc_num++;
 	    }
 	}
@@ -1417,8 +1417,8 @@ static_tracepoints_here (CORE_ADDR addr)
     if (b->type == bp_static_tracepoint
 	|| b->type == bp_static_marker_tracepoint)
       {
-	for (bp_location *loc : b->locations ())
-	  if (loc->address == addr)
+	for (bp_location &loc : b->locations ())
+	  if (loc.address == addr)
 	    found.push_back (b);
       }
 
@@ -2122,7 +2122,6 @@ update_watchpoint (struct watchpoint *b, bool reparse)
 		  b->add_location (*loc);
 
 		  loc->gdbarch = v->type ()->arch ();
-
 		  loc->pspace = frame_pspace;
 		  loc->address
 		    = gdbarch_remove_non_address_bits (loc->gdbarch, addr);
@@ -2237,8 +2236,9 @@ update_watchpoint (struct watchpoint *b, bool reparse)
 
 	  loc_type = (b->type == bp_watchpoint? bp_loc_software_watchpoint
 		      : bp_loc_hardware_watchpoint);
-	  for (bp_location *bl : b->locations ())
-	    bl->loc_type = loc_type;
+
+	  for (bp_location &bl : b->locations ())
+	    bl.loc_type = loc_type;
 	}
 
       /* If a software watchpoint is not watching any memory, then the
@@ -3187,9 +3187,9 @@ insert_breakpoint_locations (void)
 
       if (bpt->disposition == disp_del_at_next_stop)
 	continue;
-      
-      for (bp_location *loc : bpt->locations ())
-	if (!loc->inserted && should_be_inserted (loc))
+
+      for (bp_location &loc : bpt->locations ())
+	if (!loc.inserted && should_be_inserted (&loc))
 	  {
 	    some_failed = true;
 	    break;
@@ -3197,9 +3197,9 @@ insert_breakpoint_locations (void)
 
       if (some_failed)
 	{
-	  for (bp_location *loc : bpt->locations ())
-	    if (loc->inserted)
-	      remove_breakpoint (loc);
+	  for (bp_location &loc : bpt->locations ())
+	    if (loc.inserted)
+	      remove_breakpoint (&loc);
 
 	  hw_breakpoint_error = 1;
 	  tmp_error_stream.printf ("Could not insert "
@@ -4355,14 +4355,14 @@ hardware_watchpoint_inserted_in_range (const address_space *aspace,
       if (!breakpoint_enabled (bpt))
 	continue;
 
-      for (bp_location *loc : bpt->locations ())
-	if (loc->pspace->aspace == aspace && loc->inserted)
+      for (bp_location &loc : bpt->locations ())
+	if (loc.pspace->aspace == aspace && loc.inserted)
 	  {
 	    CORE_ADDR l, h;
 
 	    /* Check for intersection.  */
-	    l = std::max<CORE_ADDR> (loc->address, addr);
-	    h = std::min<CORE_ADDR> (loc->address + loc->length, addr + len);
+	    l = std::max<CORE_ADDR> (loc.address, addr);
+	    h = std::min<CORE_ADDR> (loc.address + loc.length, addr + len);
 	    if (l < h)
 	      return 1;
 	  }
@@ -4514,9 +4514,9 @@ bpstat_locno (const bpstat *bs)
     {
       int locno = 1;
 
-      for (bp_location *loc : b->locations ())
+      for (bp_location &loc : b->locations ())
 	{
-	  if (bl == loc)
+	  if (bl == &loc)
 	    return locno;
 
 	  ++locno;
@@ -5041,12 +5041,12 @@ watchpoints_triggered (const target_waitstatus &ws)
 	struct watchpoint *w = (struct watchpoint *) b;
 
 	w->watchpoint_triggered = watch_triggered_no;
-	for (bp_location *loc : b->locations ())
+	for (bp_location &loc : b->locations ())
 	  {
 	    if (is_masked_watchpoint (b))
 	      {
 		CORE_ADDR newaddr = addr & w->hw_wp_mask;
-		CORE_ADDR start = loc->address & w->hw_wp_mask;
+		CORE_ADDR start = loc.address & w->hw_wp_mask;
 
 		if (newaddr == start)
 		  {
@@ -5056,8 +5056,8 @@ watchpoints_triggered (const target_waitstatus &ws)
 	      }
 	    /* Exact match not required.  Within range is sufficient.  */
 	    else if (target_watchpoint_addr_within_range
-		       (current_inferior ()->top_target (), addr, loc->address,
-			loc->length))
+		       (current_inferior ()->top_target (), addr, loc.address,
+			loc.length))
 	      {
 		w->watchpoint_triggered = watch_triggered_yes;
 		break;
@@ -5613,26 +5613,26 @@ build_bpstat_chain (const address_space *aspace, CORE_ADDR bp_addr,
       if (!breakpoint_enabled (b))
 	continue;
 
-      for (bp_location *bl : b->locations ())
+      for (bp_location &bl : b->locations ())
 	{
 	  /* For hardware watchpoints, we look only at the first
 	     location.  The watchpoint_check function will work on the
 	     entire expression, not the individual locations.  For
 	     read watchpoints, the watchpoints_triggered function has
 	     checked all locations already.  */
-	  if (b->type == bp_hardware_watchpoint && bl != &b->first_loc ())
+	  if (b->type == bp_hardware_watchpoint && &bl != &b->first_loc ())
 	    break;
 
-	  if (!bl->enabled || bl->disabled_by_cond || bl->shlib_disabled)
+	  if (!bl.enabled || bl.disabled_by_cond || bl.shlib_disabled)
 	    continue;
 
-	  if (!bpstat_check_location (bl, aspace, bp_addr, ws))
+	  if (!bpstat_check_location (&bl, aspace, bp_addr, ws))
 	    continue;
 
 	  /* Come here if it's a watchpoint, or if the break address
 	     matches.  */
 
-	  bpstat *bs = new bpstat (bl, &bs_link);	/* Alloc a bpstat to
+	  bpstat *bs = new bpstat (&bl, &bs_link);	/* Alloc a bpstat to
 							   explain stop.  */
 
 	  /* Assume we stop.  Should we find a watchpoint that is not
@@ -6109,9 +6109,9 @@ bp_condition_evaluator (const breakpoint *b)
       || !target_supports_evaluation_of_breakpoint_conditions ())
     return condition_evaluation_host;
 
-  for (bp_location *bl : b->locations ())
+  for (bp_location &bl : b->locations ())
     {
-      if (bl->cond_bytecode)
+      if (bl.cond_bytecode)
 	target_evals++;
       else
 	host_evals++;
@@ -6743,10 +6743,10 @@ print_one_breakpoint (breakpoint *b, const bp_location **last_loc, int allflag)
 	    locations_list.emplace (uiout, "locations");
 
 	  int n = 1;
-	  for (bp_location *loc : b->locations ())
+	  for (bp_location &loc : b->locations ())
 	    {
 	      ui_out_emit_tuple loc_tuple_emitter (uiout, NULL);
-	      print_one_breakpoint_location (b, loc, n, last_loc,
+	      print_one_breakpoint_location (b, &loc, n, last_loc,
 					     allflag, allflag);
 	      n++;
 	    }
@@ -6759,12 +6759,12 @@ breakpoint_address_bits (struct breakpoint *b)
 {
   int print_address_bits = 0;
 
-  for (bp_location *loc : b->locations ())
+  for (bp_location &loc : b->locations ())
     {
-      if (!bl_address_is_meaningful (loc))
+      if (!bl_address_is_meaningful (&loc))
 	continue;
 
-      int addr_bit = gdbarch_addr_bit (loc->gdbarch);
+      int addr_bit = gdbarch_addr_bit (loc.gdbarch);
       if (addr_bit > print_address_bits)
 	print_address_bits = addr_bit;
     }
@@ -6924,8 +6924,8 @@ breakpoint_1 (const char *bp_num_list, bool show_internal,
 	if (show_internal || user_breakpoint_p (b))
 	  {
 	    print_one_breakpoint (b, &last_loc, show_internal);
-	    for (bp_location *loc : b->locations ())
-	      if (loc->disabled_by_cond)
+	    for (bp_location &loc : b->locations ())
+	      if (loc.disabled_by_cond)
 		has_disabled_by_cond_location = true;
 	  }
       }
@@ -7018,11 +7018,11 @@ breakpoint_has_pc (struct breakpoint *b,
 		   struct program_space *pspace,
 		   CORE_ADDR pc, struct obj_section *section)
 {
-  for (bp_location *bl : b->locations ())
+  for (bp_location &bl : b->locations ())
     {
-      if (bl->pspace == pspace
-	  && bl->address == pc
-	  && (!overlay_debugging || bl->section == section))
+      if (bl.pspace == pspace
+	  && bl.address == pc
+	  && (!overlay_debugging || bl.section == section))
 	return true;
     }
   return false;
@@ -7927,34 +7927,34 @@ disable_breakpoints_in_freed_objfile (struct objfile *objfile)
       if (!is_breakpoint (b) && !is_tracepoint (b))
 	continue;
 
-      for (bp_location *loc : b->locations ())
+      for (bp_location &loc : b->locations ())
 	{
-	  CORE_ADDR loc_addr = loc->address;
+	  CORE_ADDR loc_addr = loc.address;
 
-	  if (loc->loc_type != bp_loc_hardware_breakpoint
-	      && loc->loc_type != bp_loc_software_breakpoint)
+	  if (loc.loc_type != bp_loc_hardware_breakpoint
+	      && loc.loc_type != bp_loc_software_breakpoint)
 	    continue;
 
-	  if (loc->shlib_disabled != 0)
+	  if (loc.shlib_disabled != 0)
 	    continue;
 
-	  if (objfile->pspace != loc->pspace)
+	  if (objfile->pspace != loc.pspace)
 	    continue;
 
-	  if (loc->loc_type != bp_loc_hardware_breakpoint
-	      && loc->loc_type != bp_loc_software_breakpoint)
+	  if (loc.loc_type != bp_loc_hardware_breakpoint
+	      && loc.loc_type != bp_loc_software_breakpoint)
 	    continue;
 
 	  if (is_addr_in_objfile (loc_addr, objfile))
 	    {
-	      loc->shlib_disabled = 1;
+	      loc.shlib_disabled = 1;
 	      /* At this point, we don't know whether the object was
 		 unmapped from the inferior or not, so leave the
 		 inserted flag alone.  We'll handle failure to
 		 uninsert quietly, in case the object was indeed
 		 unmapped.  */
 
-	      mark_breakpoint_location_modified (loc);
+	      mark_breakpoint_location_modified (&loc);
 
 	      bp_modified = true;
 	    }
@@ -8016,11 +8016,11 @@ hw_breakpoint_used_count (void)
 
   for (breakpoint *b : all_breakpoints ())
     if (b->type == bp_hardware_breakpoint && breakpoint_enabled (b))
-      for (bp_location *bl : b->locations ())
+      for (bp_location &bl : b->locations ())
 	{
 	  /* Special types of hardware breakpoints may use more than
 	     one register.  */
-	  i += b->resources_needed (bl);
+	  i += b->resources_needed (&bl);
 	}
 
   return i;
@@ -8037,11 +8037,11 @@ hw_watchpoint_use_count (struct breakpoint *b)
   if (!breakpoint_enabled (b))
     return 0;
 
-  for (bp_location *bl : b->locations ())
+  for (bp_location &bl : b->locations ())
     {
       /* Special types of hardware watchpoints may use more than
 	 one register.  */
-      i += b->resources_needed (bl);
+      i += b->resources_needed (&bl);
     }
 
   return i;
@@ -8545,10 +8545,10 @@ code_breakpoint::code_breakpoint (struct gdbarch *gdbarch_,
   /* The order of the locations is now stable.  Set the location
      condition using the location's number.  */
   int loc_num = 1;
-  for (bp_location *bl : locations ())
+  for (bp_location &bl : locations ())
     {
       if (cond_string != nullptr)
-	set_breakpoint_location_condition (cond_string.get (), bl,
+	set_breakpoint_location_condition (cond_string.get (), &bl,
 					   number, loc_num);
 
       ++loc_num;
@@ -10838,24 +10838,24 @@ clear_command (const char *arg, int from_tty)
 	  if (b->type != bp_none && !is_watchpoint (b)
 	      && user_breakpoint_p (b))
 	    {
-	      for (bp_location *loc : b->locations ())
+	      for (bp_location &loc : b->locations ())
 		{
 		  /* If the user specified file:line, don't allow a PC
 		     match.  This matches historical gdb behavior.  */
 		  int pc_match = (!sal.explicit_line
 				  && sal.pc
-				  && (loc->pspace == sal.pspace)
-				  && (loc->address == sal.pc)
-				  && (!section_is_overlay (loc->section)
-				      || loc->section == sal.section));
+				  && (loc.pspace == sal.pspace)
+				  && (loc.address == sal.pc)
+				  && (!section_is_overlay (loc.section)
+				      || loc.section == sal.section));
 		  int line_match = 0;
 
 		  if ((default_match || sal.explicit_line)
-		      && loc->symtab != NULL
+		      && loc.symtab != NULL
 		      && sal_fullname != NULL
-		      && sal.pspace == loc->pspace
-		      && loc->line_number == sal.line
-		      && filename_cmp (symtab_to_fullname (loc->symtab),
+		      && sal.pspace == loc.pspace
+		      && loc.line_number == sal.line
+		      && filename_cmp (symtab_to_fullname (loc.symtab),
 				       sal_fullname) == 0)
 		    line_match = 1;
 
@@ -11041,19 +11041,19 @@ download_tracepoint_locations (void)
       if (can_download_tracepoint == TRIBOOL_FALSE)
 	break;
 
-      for (bp_location *bl : b->locations ())
+      for (bp_location &bl : b->locations ())
 	{
 	  /* In tracepoint, locations are _never_ duplicated, so
 	     should_be_inserted is equivalent to
 	     unduplicated_should_be_inserted.  */
-	  if (!should_be_inserted (bl) || bl->inserted)
+	  if (!should_be_inserted (&bl) || bl.inserted)
 	    continue;
 
-	  switch_to_program_space_and_thread (bl->pspace);
+	  switch_to_program_space_and_thread (bl.pspace);
 
-	  target_download_tracepoint (bl);
+	  target_download_tracepoint (&bl);
 
-	  bl->inserted = 1;
+	  bl.inserted = 1;
 	  bp_location_downloaded = true;
 	}
       t = (struct tracepoint *) b;
@@ -11167,8 +11167,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
   bp_locations.clear ();
 
   for (breakpoint *b : all_breakpoints ())
-    for (bp_location *loc : b->locations ())
-      bp_locations.push_back (loc);
+    for (bp_location &loc : b->locations ())
+      bp_locations.push_back (&loc);
 
   /* See if we need to "upgrade" a software breakpoint to a hardware
      breakpoint.  Do this before deciding whether locations are
@@ -11616,9 +11616,7 @@ code_breakpoint::say_where () const
 
 bp_location_range breakpoint::locations () const
 {
-  return bp_location_range
-    (bp_location_pointer_iterator (m_locations.begin ()),
-     bp_location_pointer_iterator (m_locations.end ()));
+  return bp_location_range (m_locations.begin (), m_locations.end ());
 }
 
 struct bp_location *
@@ -12504,11 +12502,11 @@ delete_command (const char *arg, int from_tty)
 static bool
 all_locations_are_pending (struct breakpoint *b, struct program_space *pspace)
 {
-  for (bp_location *loc : b->locations ())
+  for (bp_location &loc : b->locations ())
     if ((pspace == NULL
-	 || loc->pspace == pspace)
-	&& !loc->shlib_disabled
-	&& !loc->pspace->executing_startup)
+	 || loc.pspace == pspace)
+	&& !loc.shlib_disabled
+	&& !loc.pspace->executing_startup)
       return false;
   return true;
 }
@@ -12523,10 +12521,10 @@ ambiguous_names_p (const bp_location_range &locs)
   htab_up htab (htab_create_alloc (13, htab_hash_string, htab_eq_string, NULL,
 				   xcalloc, xfree));
 
-  for (const bp_location *l : locs)
+  for (const bp_location &l : locs)
     {
       const char **slot;
-      const char *name = l->function_name.get ();
+      const char *name = l.function_name.get ();
 
       /* Allow for some names to be NULL, ignore them.  */
       if (name == NULL)
@@ -12679,16 +12677,16 @@ locations_are_equal (const bp_location_list &a, const bp_location_range &b)
 
   for (; a_iter != a.end () && b_iter != b.end (); ++a_iter, ++b_iter)
     {
-      if (a_iter->address != (*b_iter)->address)
+      if (a_iter->address != b_iter->address)
 	return false;
 
-      if (a_iter->shlib_disabled != (*b_iter)->shlib_disabled)
+      if (a_iter->shlib_disabled != b_iter->shlib_disabled)
 	return false;
 
-      if (a_iter->enabled != (*b_iter)->enabled)
+      if (a_iter->enabled != b_iter->enabled)
 	return false;
 
-      if (a_iter->disabled_by_cond != (*b_iter)->disabled_by_cond)
+      if (a_iter->disabled_by_cond != b_iter->disabled_by_cond)
 	return false;
     }
 
@@ -12806,7 +12804,7 @@ update_breakpoint_locations (code_breakpoint *b,
 	  {
 	    if (have_ambiguous_names)
 	      {
-		for (bp_location *l : b->locations ())
+		for (bp_location &l : b->locations ())
 		  {
 		    /* Ignore software vs hardware location type at
 		       this point, because with "set breakpoint
@@ -12815,23 +12813,23 @@ update_breakpoint_locations (code_breakpoint *b,
 		       As mentioned above, this is an heuristic and in
 		       practice should give the correct answer often
 		       enough.  */
-		    if (breakpoint_locations_match (&e, l, true))
+		    if (breakpoint_locations_match (&e, &l, true))
 		      {
-			l->enabled = e.enabled;
-			l->disabled_by_cond = e.disabled_by_cond;
+			l.enabled = e.enabled;
+			l.disabled_by_cond = e.disabled_by_cond;
 			break;
 		      }
 		  }
 	      }
 	    else
 	      {
-		for (bp_location *l : b->locations ())
-		  if (l->function_name
+		for (bp_location &l : b->locations ())
+		  if (l.function_name
 		      && strcmp (e.function_name.get (),
-				 l->function_name.get ()) == 0)
+				 l.function_name.get ()) == 0)
 		    {
-		      l->enabled = e.enabled;
-		      l->disabled_by_cond = e.disabled_by_cond;
+		      l.enabled = e.enabled;
+		      l.disabled_by_cond = e.disabled_by_cond;
 		      break;
 		    }
 	      }
@@ -13186,9 +13184,9 @@ find_location_by_number (int bp_num, int loc_num)
     error (_("Bad breakpoint location number '%d'"), loc_num);
 
   int n = 0;
-  for (bp_location *loc : b->locations ())
+  for (bp_location &loc : b->locations ())
     if (++n == loc_num)
-      return loc;
+      return &loc;
 
   error (_("Bad breakpoint location number '%d'"), loc_num);
 }
@@ -13356,9 +13354,9 @@ find_loc_num_by_location (const bp_location *loc)
     {
       /* Locations use 1-based indexing.  */
       int loc_num = 1;
-      for (bp_location *it : loc->owner->locations ())
+      for (bp_location &it : loc->owner->locations ())
 	{
-	  if (it == loc)
+	  if (&it == loc)
 	    return loc_num;
 	  loc_num++;
 	}
@@ -13439,8 +13437,8 @@ disable_breakpoint (struct breakpoint *bpt)
   if (target_supports_enable_disable_tracepoint ()
       && current_trace_status ()->running && is_tracepoint (bpt))
     {
-      for (bp_location *location : bpt->locations ())
-	target_disable_tracepoint (location);
+      for (bp_location &location : bpt->locations ())
+	target_disable_tracepoint (&location);
     }
 
   update_global_location_list (UGLL_DONT_INSERT);
@@ -13562,8 +13560,8 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
   if (target_supports_enable_disable_tracepoint ()
       && current_trace_status ()->running && is_tracepoint (bpt))
     {
-      for (bp_location *location : bpt->locations ())
-	target_enable_tracepoint (location);
+      for (bp_location &location : bpt->locations ())
+	target_enable_tracepoint (&location);
     }
 
   bpt->disposition = disposition;
@@ -13657,10 +13655,10 @@ invalidate_bp_value_on_memory_change (struct inferior *inferior,
 
 	if (wp->val_valid && wp->val != nullptr)
 	  {
-	    for (bp_location *loc : bp->locations ())
-	      if (loc->loc_type == bp_loc_hardware_watchpoint
-		  && loc->address + loc->length > addr
-		  && addr + len > loc->address)
+	    for (bp_location &loc : bp->locations ())
+	      if (loc.loc_type == bp_loc_hardware_watchpoint
+		  && loc.address + loc.length > addr
+		  && addr + len > loc.address)
 		{
 		  wp->val = NULL;
 		  wp->val_valid = false;
@@ -13736,9 +13734,9 @@ breakpoint_has_location_inserted_here (struct breakpoint *bp,
 				       const address_space *aspace,
 				       CORE_ADDR pc)
 {
-  for (bp_location *loc : bp->locations ())
-    if (loc->inserted
-	&& breakpoint_location_address_match (loc, aspace, pc))
+  for (bp_location &loc : bp->locations ())
+    if (loc.inserted
+	&& breakpoint_location_address_match (&loc, aspace, pc))
       return 1;
 
   return 0;
@@ -14275,9 +14273,9 @@ save_breakpoints (const char *filename, int from_tty,
 	{
 	  int n = 1;
 
-	  for (bp_location *loc : tp->locations ())
+	  for (bp_location &loc : tp->locations ())
 	    {
-	      if (!loc->enabled)
+	      if (!loc.enabled)
 		fp.printf ("disable $bpnum.%d\n", n);
 
 	      n++;
@@ -14416,10 +14414,10 @@ pc_at_non_inline_function (const address_space *aspace, CORE_ADDR pc,
       if (!is_non_inline_function (b))
 	continue;
 
-      for (bp_location *bl : b->locations ())
+      for (bp_location &bl : b->locations ())
 	{
-	  if (!bl->shlib_disabled
-	      && bpstat_check_location (bl, aspace, pc, ws))
+	  if (!bl.shlib_disabled
+	      && bpstat_check_location (&bl, aspace, pc, ws))
 	    return 1;
 	}
     }
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 4da64d8c27c8..8c9541902cdd 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -606,9 +606,7 @@ extern bool target_exact_watchpoints;
 
 using bp_location_list = intrusive_list<bp_location>;
 using bp_location_iterator = bp_location_list::iterator;
-using bp_location_pointer_iterator
-  = reference_to_pointer_iterator<bp_location_iterator>;
-using bp_location_range = iterator_range<bp_location_pointer_iterator>;
+using bp_location_range = iterator_range<bp_location_iterator>;
 
 /* Note that the ->silent field is not currently used by any commands
    (though the code is in there if it was to be, and set_raw_breakpoint
diff --git a/gdb/jit.c b/gdb/jit.c
index e085d5623336..25c8ed8499a2 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -845,14 +845,14 @@ jit_breakpoint_deleted (struct breakpoint *b)
   if (b->type != bp_jit_event)
     return;
 
-  for (bp_location *iter : b->locations ())
+  for (bp_location &iter : b->locations ())
     {
-      for (objfile *objf : iter->pspace->objfiles ())
+      for (objfile *objf : iter.pspace->objfiles ())
 	{
 	  jiter_objfile_data *jiter_data = objf->jiter_data.get ();
 
 	  if (jiter_data != nullptr
-	      && jiter_data->jit_breakpoint == iter->owner)
+	      && jiter_data->jit_breakpoint == iter.owner)
 	    {
 	      jiter_data->cached_code_address = 0;
 	      jiter_data->jit_breakpoint = nullptr;
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index becb04c91c15..8a306c6b3318 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -752,14 +752,14 @@ bppy_get_locations (PyObject *self, void *closure)
   if (list == nullptr)
     return nullptr;
 
-  for (bp_location *loc : self_bp->bp->locations ())
+  for (bp_location &loc : self_bp->bp->locations ())
     {
       gdbpy_ref<py_bploc_t> py_bploc
 	(PyObject_New (py_bploc_t, &breakpoint_location_object_type));
       if (py_bploc == nullptr)
 	return nullptr;
 
-      bp_location_ref_ptr ref = bp_location_ref_ptr::new_reference (loc);
+      bp_location_ref_ptr ref = bp_location_ref_ptr::new_reference (&loc);
       /* The location takes a reference to the owner breakpoint.
 	 Decrements when they are de-allocated in bplocpy_dealloc */
       Py_INCREF (self);
diff --git a/gdb/remote.c b/gdb/remote.c
index 8eaa1b2c4d15..f7d5758cfdc5 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -13720,14 +13720,14 @@ remote_target::get_tracepoint_status (struct breakpoint *bp,
     {
       tp->hit_count = 0;
       tp->traceframe_usage = 0;
-      for (bp_location *loc : tp->locations ())
+      for (bp_location &loc : tp->locations ())
 	{
 	  /* If the tracepoint was never downloaded, don't go asking for
 	     any status.  */
 	  if (tp->number_on_target == 0)
 	    continue;
 	  xsnprintf (rs->buf.data (), size, "qTP:%x:%s", tp->number_on_target,
-		     phex_nz (loc->address, 0));
+		     phex_nz (loc.address, 0));
 	  putpkt (rs->buf);
 	  reply = remote_get_noisy_reply ();
 	  if (reply && *reply)
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 5a728939111a..46f09a7e63ce 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -2117,16 +2117,16 @@ svr4_update_solib_event_breakpoint (struct breakpoint *b)
       return false;
     }
 
-  for (bp_location *loc : b->locations ())
+  for (bp_location &loc : b->locations ())
     {
       struct svr4_info *info;
       struct probe_and_action *pa;
 
-      info = solib_svr4_pspace_data.get (loc->pspace);
+      info = solib_svr4_pspace_data.get (loc.pspace);
       if (info == NULL || info->probes_table == NULL)
 	continue;
 
-      pa = solib_event_probe_at (info, loc->address);
+      pa = solib_event_probe_at (info, loc.address);
       if (pa == NULL)
 	continue;
 
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 3e0bdafa19d3..fa65e0493720 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -676,11 +676,11 @@ validate_actionline (const char *line, struct breakpoint *b)
 	      /* else fall thru, treat p as an expression and parse it!  */
 	    }
 	  tmp_p = p;
-	  for (bp_location *loc : t->locations ())
+	  for (bp_location &loc : t->locations ())
 	    {
 	      p = tmp_p;
-	      expression_up exp = parse_exp_1 (&p, loc->address,
-					       block_for_pc (loc->address), 1);
+	      expression_up exp = parse_exp_1 (&p, loc.address,
+					       block_for_pc (loc.address), 1);
 
 	      if (exp->first_opcode () == OP_VAR_VALUE)
 		{
@@ -708,7 +708,7 @@ validate_actionline (const char *line, struct breakpoint *b)
 	      /* We have something to collect, make sure that the expr to
 		 bytecode translator can handle it and that it's not too
 		 long.  */
-	      agent_expr_up aexpr = gen_trace_for_expr (loc->address,
+	      agent_expr_up aexpr = gen_trace_for_expr (loc.address,
 							exp.get (),
 							trace_string);
 
@@ -726,18 +726,18 @@ validate_actionline (const char *line, struct breakpoint *b)
 	  p = skip_spaces (p);
 
 	  tmp_p = p;
-	  for (bp_location *loc : t->locations ())
+	  for (bp_location &loc : t->locations ())
 	    {
 	      p = tmp_p;
 
 	      /* Only expressions are allowed for this action.  */
-	      expression_up exp = parse_exp_1 (&p, loc->address,
-					       block_for_pc (loc->address), 1);
+	      expression_up exp = parse_exp_1 (&p, loc.address,
+					       block_for_pc (loc.address), 1);
 
 	      /* We have something to evaluate, make sure that the expr to
 		 bytecode translator can handle it and that it's not too
 		 long.  */
-	      agent_expr_up aexpr = gen_eval_for_expr (loc->address, exp.get ());
+	      agent_expr_up aexpr = gen_eval_for_expr (loc.address, exp.get ());
 
 	      finalize_tracepoint_aexpr (aexpr.get ());
 	    }
@@ -1529,9 +1529,9 @@ process_tracepoint_on_disconnect (void)
 	}
       else
 	{
-	  for (bp_location *loc1 : b->locations ())
+	  for (bp_location &loc1 : b->locations ())
 	    {
-	      if (loc1->shlib_disabled)
+	      if (loc1.shlib_disabled)
 		{
 		  has_pending_p = 1;
 		  break;
@@ -1608,8 +1608,8 @@ start_tracing (const char *notes)
       int bp_location_downloaded = 0;
 
       /* Clear `inserted' flag.  */
-      for (bp_location *loc : b->locations ())
-	loc->inserted = 0;
+      for (bp_location &loc : b->locations ())
+	loc.inserted = 0;
 
       if ((b->type == bp_fast_tracepoint
 	   ? !may_insert_fast_tracepoints
@@ -1618,24 +1618,23 @@ start_tracing (const char *notes)
 
       t->number_on_target = 0;
 
-      for (bp_location *loc : b->locations ())
+      for (bp_location &loc : b->locations ())
 	{
 	  /* Since tracepoint locations are never duplicated, `inserted'
 	     flag should be zero.  */
-	  gdb_assert (!loc->inserted);
+	  gdb_assert (!loc.inserted);
 
-	  target_download_tracepoint (loc);
+	  target_download_tracepoint (&loc);
 
-	  loc->inserted = 1;
+	  loc.inserted = 1;
 	  bp_location_downloaded = 1;
 	}
 
       t->number_on_target = b->number;
 
-      for (bp_location *loc : b->locations ())
-	if (loc->probe.prob != NULL)
-	  loc->probe.prob->set_semaphore (loc->probe.objfile,
-					  loc->gdbarch);
+      for (bp_location &loc : b->locations ())
+	if (loc.probe.prob != NULL)
+	  loc.probe.prob->set_semaphore (loc.probe.objfile, loc.gdbarch);
 
       if (bp_location_downloaded)
 	gdb::observers::breakpoint_modified.notify (b);
@@ -1717,15 +1716,14 @@ stop_tracing (const char *note)
 	   : !may_insert_tracepoints))
 	continue;
 
-      for (bp_location *loc : t->locations ())
+      for (bp_location &loc : t->locations ())
 	{
 	  /* GDB can be totally absent in some disconnected trace scenarios,
 	     but we don't really care if this semaphore goes out of sync.
 	     That's why we are decrementing it here, but not taking care
 	     in other places.  */
-	  if (loc->probe.prob != NULL)
-	    loc->probe.prob->clear_semaphore (loc->probe.objfile,
-					      loc->gdbarch);
+	  if (loc.probe.prob != NULL)
+	    loc.probe.prob->clear_semaphore (loc.probe.objfile, loc.gdbarch);
 	}
     }
 
@@ -2740,11 +2738,11 @@ get_traceframe_location (int *stepping_frame_p)
      locations, assume it is a direct hit rather than a while-stepping
      frame.  (FIXME this is not reliable, should record each frame's
      type.)  */
-  for (bp_location *tloc : t->locations ())
-    if (tloc->address == regcache_read_pc (regcache))
+  for (bp_location &tloc : t->locations ())
+    if (tloc.address == regcache_read_pc (regcache))
       {
 	*stepping_frame_p = 0;
-	return tloc;
+	return &tloc;
       }
 
   /* If this is a stepping frame, we don't know which location
@@ -3057,11 +3055,9 @@ find_matching_tracepoint_location (struct uploaded_tp *utp)
 	  )
 	{
 	  /* Scan the locations for an address match.  */
-	  for (bp_location *loc : b->locations ())
-	    {
-	      if (loc->address == utp->addr)
-		return loc;
-	    }
+	  for (bp_location &loc : b->locations ())
+	    if (loc.address == utp->addr)
+	      return &loc;
 	}
     }
   return NULL;
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 3fc38b7be233..9e4760618187 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -630,9 +630,9 @@ tui_source_window_base::update_breakpoint_info
 	  if (bp == being_deleted)
 	    continue;
 
-	  for (bp_location *loc : bp->locations ())
+	  for (bp_location &loc : bp->locations ())
 	    {
-	      if (location_matches_p (loc, i))
+	      if (location_matches_p (&loc, i))
 		{
 		  if (bp->enable_state == bp_disabled)
 		    mode |= TUI_BP_DISABLED;
