[4/6] Minor cleanup in linespec.c:add_minsym

Message ID 20250108-linespec-state-cxx-v1-4-a721e95ee050@tromey.com
State New
Headers
Series More linespec cleanups and C++-ification |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Tom Tromey Jan. 8, 2025, 7:23 a.m. UTC
  This cleans up a 'return' in linespec.c:add_minsym.
---
 gdb/linespec.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
  

Comments

Simon Marchi Jan. 9, 2025, 3:30 a.m. UTC | #1
On 2025-01-08 02:23, Tom Tromey wrote:
> This cleans up a 'return' in linespec.c:add_minsym.
> ---
>  gdb/linespec.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/gdb/linespec.c b/gdb/linespec.c
> index 053af6f9bb595294bc9a512a9f465ddc3ff73f65..4f80a42484fef33bed5b4c9f36e78486bbd4f97d 100644
> --- a/gdb/linespec.c
> +++ b/gdb/linespec.c
> @@ -4149,11 +4149,8 @@ add_minsym (struct minimal_symbol *minsym, struct objfile *objfile,
>      }
>  
>    /* Exclude data symbols when looking for breakpoint locations.  */
> -  if (!list_mode && !msymbol_is_function (objfile, minsym))
> -    return;
> -
> -  msyms->emplace_back (minsym, objfile);
> -  return;
> +  if (list_mode || msymbol_is_function (objfile, minsym))
> +    msyms->emplace_back (minsym, objfile);
>  }
>  
>  /* Search for minimal symbols called NAME.  If SEARCH_PSPACE
> 

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon
  

Patch

diff --git a/gdb/linespec.c b/gdb/linespec.c
index 053af6f9bb595294bc9a512a9f465ddc3ff73f65..4f80a42484fef33bed5b4c9f36e78486bbd4f97d 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -4149,11 +4149,8 @@  add_minsym (struct minimal_symbol *minsym, struct objfile *objfile,
     }
 
   /* Exclude data symbols when looking for breakpoint locations.  */
-  if (!list_mode && !msymbol_is_function (objfile, minsym))
-    return;
-
-  msyms->emplace_back (minsym, objfile);
-  return;
+  if (list_mode || msymbol_is_function (objfile, minsym))
+    msyms->emplace_back (minsym, objfile);
 }
 
 /* Search for minimal symbols called NAME.  If SEARCH_PSPACE