]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/dwarf: remove nullptr prop check in dwarf2_evaluate_property
authorSimon Marchi <simon.marchi@polymtl.ca>
Tue, 25 Nov 2025 04:04:30 +0000 (23:04 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 1 Dec 2025 17:39:17 +0000 (12:39 -0500)
This nullptr is pointless most of the time: almost all callers either
check that the prop is not nullptr or they pass the address of a local
variable, which is necessarily not nullptr.  I propose to remove it.  I
found only one call site where I needed to add a check.

Change-Id: Iada84d529b8edc6b20486f3539c675dad6b364f5
Approved-By: Tom Tromey <tom@tromey.com>
gdb/dwarf2/loc.c
gdb/gdbtypes.c

index 73e744c8b974c46ee0aa204433f9805c8b53df3d..9ab0c70b8f72be1880154c60684221586dd5fdfa 100644 (file)
@@ -1646,9 +1646,6 @@ dwarf2_evaluate_property (const dynamic_prop *prop,
                          CORE_ADDR *value,
                          gdb::array_view<CORE_ADDR> push_values)
 {
-  if (prop == NULL)
-    return false;
-
   /* Evaluating a property should not change the current language.
      Without this here this could happen if the code below selects a
      frame.  */
index 9e3c07e0ee59e4813fb70705fbffb0a6299aa88f..6736de96c042be416d44939f89cd688995dd71fe 100644 (file)
@@ -2431,7 +2431,8 @@ resolve_dynamic_array_or_string (struct type *type,
 
   /* Resolve the rank property to get rank value.  */
   struct dynamic_prop *prop = type->dyn_prop (DYN_PROP_RANK);
-  if (dwarf2_evaluate_property (prop, frame, addr_stack, &value))
+  if (prop != nullptr
+      && dwarf2_evaluate_property (prop, frame, addr_stack, &value))
     {
       prop->set_const_val (value);
       rank = value;