[gdb/testsuite] Rewrite gdb_test_lines
[deliverable/binutils-gdb.git] / gdb / c-varobj.c
index 2bcfe8672eb712dabc3c481aa6a935b84114dfc9..f6db3a5d1ba77ad86e7d36a2cd94ef5fdc26069b 100644 (file)
@@ -1,6 +1,6 @@
 /* varobj support for C and C++.
 
-   Copyright (C) 1999-2020 Free Software Foundation, Inc.
+   Copyright (C) 1999-2021 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
@@ -120,10 +120,10 @@ adjust_value_for_child_access (struct value **value,
 
       enclosing_type = value_actual_type (*value, 1, &real_type_found);
       if (real_type_found)
-        {
-          *type = enclosing_type;
-          *value = value_cast (enclosing_type, *value);
-        }
+       {
+         *type = enclosing_type;
+         *value = value_cast (enclosing_type, *value);
+       }
     }
 }
 
@@ -192,7 +192,7 @@ c_number_of_children (const struct varobj *var)
     {
     case TYPE_CODE_ARRAY:
       if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (target) > 0
-         && (type->index_type ()->bounds ()->high.kind () != PROP_UNDEFINED))
+         && (type->bounds ()->high.kind () != PROP_UNDEFINED))
        children = TYPE_LENGTH (type) / TYPE_LENGTH (target);
       else
        /* If we don't know how many elements there are, don't display
@@ -210,10 +210,10 @@ c_number_of_children (const struct varobj *var)
         have one child, except for function ptrs, which have no children,
         and except for void*, as we don't know what to show.
 
-         We can show char* so we allow it to be dereferenced.  If you decide
-         to test for it, please mind that a little magic is necessary to
-         properly identify it: char* has TYPE_CODE == TYPE_CODE_INT and 
-         TYPE_NAME == "char".  */
+        We can show char* so we allow it to be dereferenced.  If you decide
+        to test for it, please mind that a little magic is necessary to
+        properly identify it: char* has TYPE_CODE == TYPE_CODE_INT and 
+        TYPE_NAME == "char".  */
       if (target->code () == TYPE_CODE_FUNC
          || target->code () == TYPE_CODE_VOID)
        children = 0;
@@ -306,14 +306,13 @@ c_describe_child (const struct varobj *parent, int index,
     {
     case TYPE_CODE_ARRAY:
       if (cname)
-       *cname = int_string (index
-                            + type->index_type ()->bounds ()->low.const_val (),
+       *cname = int_string (index + type->bounds ()->low.const_val (),
                             10, 1, 0, 0);
 
       if (cvalue && value)
        {
          int real_index
-           = index + type->index_type ()->bounds ()->low.const_val ();
+           = index + type->bounds ()->low.const_val ();
 
          try
            {
@@ -330,7 +329,7 @@ c_describe_child (const struct varobj *parent, int index,
       if (cfull_expression)
        *cfull_expression = string_printf
          ("(%s)[%s]", parent_expression.c_str (),
-          int_string (index + type->index_type ()->bounds ()->low.const_val (),
+          int_string (index + type->bounds ()->low.const_val (),
                       10, 1, 0, 0));
 
       break;
@@ -573,11 +572,11 @@ cplus_number_of_children (const struct varobj *var)
 
       /* It is necessary to access a real type (via RTTI).  */
       if (opts.objectprint)
-        {
-          value = var->value.get ();
-          lookup_actual_type = (TYPE_IS_REFERENCE (var->type)
+       {
+         value = var->value.get ();
+         lookup_actual_type = (TYPE_IS_REFERENCE (var->type)
                                || var->type->code () == TYPE_CODE_PTR);
-        }
+       }
       adjust_value_for_child_access (&value, &type, NULL, lookup_actual_type);
 
       if (((type->code ()) == TYPE_CODE_STRUCT)
@@ -608,13 +607,13 @@ cplus_number_of_children (const struct varobj *var)
 
       /* It is necessary to access a real type (via RTTI).  */
       if (opts.objectprint)
-        {
+       {
          const struct varobj *parent = var->parent;
 
          value = parent->value.get ();
          lookup_actual_type = (TYPE_IS_REFERENCE (parent->type)
                                || parent->type->code () == TYPE_CODE_PTR);
-        }
+       }
       adjust_value_for_child_access (&value, &type, NULL, lookup_actual_type);
 
       cplus_class_num_children (type, kids);
@@ -818,10 +817,10 @@ cplus_describe_child (const struct varobj *parent, int index,
 
              /* Cast the parent to the base' type.  Note that in gdb,
                 expression like 
-                        (Base1)d
+                        (Base1)d
                 will create an lvalue, for all appearences, so we don't
                 need to use more fancy:
-                        *(Base1*)(&d)
+                        *(Base1*)(&d)
                 construct.
 
                 When we are in the scope of the base class or of one
This page took 0.025724 seconds and 4 git commands to generate.