Tidy dwarf1 cached section contents
[binutils-gdb.git] / gdb / c-varobj.c
index 8056c1c9ec1ccd373dd7585b49d73108aba801de..ef4d0bd5047073ccce6b228cdcf434a64515c007 100644 (file)
@@ -1,6 +1,6 @@
 /* varobj support for C and C++.
 
-   Copyright (C) 1999-2021 Free Software Foundation, Inc.
+   Copyright (C) 1999-2023 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -165,7 +165,7 @@ c_is_path_expr_parent (const struct varobj *var)
              const char *field_name;
 
              gdb_assert (var->index < parent_type->num_fields ());
-             field_name = TYPE_FIELD_NAME (parent_type, var->index);
+             field_name = parent_type->field (var->index).name ();
              return !(field_name == NULL || *field_name == '\0');
            }
        }
@@ -191,9 +191,9 @@ c_number_of_children (const struct varobj *var)
   switch (type->code ())
     {
     case TYPE_CODE_ARRAY:
-      if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (target) > 0
+      if (type->length () > 0 && target->length () > 0
          && (type->bounds ()->high.kind () != PROP_UNDEFINED))
-       children = TYPE_LENGTH (type) / TYPE_LENGTH (target);
+       children = type->length () / target->length ();
       else
        /* If we don't know how many elements there are, don't display
           any.  */
@@ -245,7 +245,7 @@ static struct value *
 value_struct_element_index (struct value *value, int type_index)
 {
   struct value *result = NULL;
-  struct type *type = value_type (value);
+  struct type *type = value->type ();
 
   type = check_typedef (type);
 
@@ -257,7 +257,7 @@ value_struct_element_index (struct value *value, int type_index)
       if (field_is_static (&type->field (type_index)))
        result = value_static_field (type, type_index);
       else
-       result = value_primitive_field (value, 0, type_index, type);
+       result = value->primitive_field (0, type_index, type);
     }
   catch (const gdb_exception_error &e)
     {
@@ -341,7 +341,7 @@ c_describe_child (const struct varobj *parent, int index,
 
        /* If the type is anonymous and the field has no name,
           set an appropriate name.  */
-       field_name = TYPE_FIELD_NAME (type, index);
+       field_name = type->field (index).name ();
        if (field_name == NULL || *field_name == '\0')
          {
            if (cname)
@@ -403,7 +403,7 @@ c_describe_child (const struct varobj *parent, int index,
         check_typedef and here, we want to show the true
         declared type of the variable.  */
       if (ctype)
-       *ctype = TYPE_TARGET_TYPE (type);
+       *ctype = type->target_type ();
 
       if (cfull_expression)
        *cfull_expression = string_printf ("*(%s)", parent_expression.c_str ());
@@ -482,7 +482,7 @@ c_value_of_variable (const struct varobj *var,
 
   /* Strip top-level references.  */
   while (TYPE_IS_REFERENCE (type))
-    type = check_typedef (TYPE_TARGET_TYPE (type));
+    type = check_typedef (type->target_type ());
 
   switch (type->code ())
     {
@@ -506,14 +506,14 @@ c_value_of_variable (const struct varobj *var,
          }
        else
          {
-           if (var->not_fetched && value_lazy (var->value.get ()))
+           if (var->not_fetched && var->value->lazy ())
              /* Frozen variable and no value yet.  We don't
                 implicitly fetch the value.  MI response will
                 use empty string for the value, which is OK.  */
              return std::string ();
 
            gdb_assert (varobj_value_is_changeable_p (var));
-           gdb_assert (!value_lazy (var->value.get ()));
+           gdb_assert (!var->value->lazy ());
            
            /* If the specified format is the current one,
               we can reuse print_value.  */
@@ -761,7 +761,7 @@ cplus_describe_child (const struct varobj *parent, int index,
 
          /* If the type is anonymous and the field has no name,
             set an appropriate name.  */
-         field_name = TYPE_FIELD_NAME (type, type_index);
+         field_name = type->field (type_index).name ();
          if (field_name == NULL || *field_name == '\0')
            {
              if (cname)
@@ -780,7 +780,7 @@ cplus_describe_child (const struct varobj *parent, int index,
          else
            {
              if (cname)
-               *cname = TYPE_FIELD_NAME (type, type_index);
+               *cname = type->field (type_index).name ();
 
              if (cfull_expression)
                *cfull_expression
@@ -798,7 +798,7 @@ cplus_describe_child (const struct varobj *parent, int index,
        {
          /* This is a baseclass.  */
          if (cname)
-           *cname = TYPE_FIELD_NAME (type, index);
+           *cname = type->field (index).name ();
 
          if (cvalue && value)
            *cvalue = value_cast (type->field (index).type (), value);
@@ -827,7 +827,7 @@ cplus_describe_child (const struct varobj *parent, int index,
                 'class' keyword.  See PR mi/11912  */
              *cfull_expression = string_printf ("(%s(class %s%s) %s)",
                                                 ptr,
-                                                TYPE_FIELD_NAME (type, index),
+                                                type->field (index).name (),
                                                 ptr,
                                                 parent_expression);
            }