Split rank_one_type_parm_complex from rank_one_type
[deliverable/binutils-gdb.git] / gdb / varobj.c
index e109926a27d481d7d438150f5a0fff9f8576c416..3715bb6a7dfe216f9a0ed42b067479e1d14f7160 100644 (file)
@@ -1,6 +1,6 @@
 /* Implementation of the GDB variable objects API.
 
-   Copyright (C) 1999-2018 Free Software Foundation, Inc.
+   Copyright (C) 1999-2019 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
@@ -26,7 +26,7 @@
 #include "gdb_regex.h"
 
 #include "varobj.h"
-#include "vec.h"
+#include "common/vec.h"
 #include "gdbthread.h"
 #include "inferior.h"
 #include "varobj-iter.h"
@@ -35,7 +35,6 @@
 #if HAVE_PYTHON
 #include "python/python.h"
 #include "python/python-internal.h"
-#include "python/py-ref.h"
 #else
 typedef int PyObject;
 #endif
@@ -761,7 +760,7 @@ update_dynamic_varobj_children (struct varobj *var,
          /* Release vitem->value so its lifetime is not bound to the
             execution of a command.  */
          if (item != NULL && item->value != NULL)
-           release_value (item->value).release ();
+           item->value = release_value (item->value).release ();
        }
 
       if (item == NULL)
@@ -1115,25 +1114,22 @@ install_default_visualizer (struct varobj *var)
 
   if (pretty_printing)
     {
-      PyObject *pretty_printer = NULL;
+      gdbpy_ref<> pretty_printer;
 
       if (var->value != nullptr)
        {
          pretty_printer = gdbpy_get_varobj_pretty_printer (var->value.get ());
-         if (! pretty_printer)
+         if (pretty_printer == nullptr)
            {
              gdbpy_print_stack ();
              error (_("Cannot instantiate printer for default visualizer"));
            }
        }
-      
+
       if (pretty_printer == Py_None)
-       {
-         Py_DECREF (pretty_printer);
-         pretty_printer = NULL;
-       }
+       pretty_printer.reset (nullptr);
   
-      install_visualizer (var->dynamic, NULL, pretty_printer);
+      install_visualizer (var->dynamic, NULL, pretty_printer.release ());
     }
 }
 
@@ -1629,7 +1625,7 @@ varobj_update (struct varobj **varp, bool is_explicit)
         for which -var-list-children was never invoked.  */
       if (varobj_is_dynamic_p (v))
        {
-         std::vector<varobj *> changed, type_changed, unchanged, newobj;
+         std::vector<varobj *> changed, type_changed_vec, unchanged, newobj_vec;
          bool children_changed = false;
 
          if (v->frozen)
@@ -1661,48 +1657,49 @@ varobj_update (struct varobj **varp, bool is_explicit)
 
          /* If update_dynamic_varobj_children returns false, then we have
             a non-conforming pretty-printer, so we skip it.  */
-         if (update_dynamic_varobj_children (v, &changed, &type_changed, &newobj,
-                                             &unchanged, &children_changed, true,
-                                             v->from, v->to))
+         if (update_dynamic_varobj_children (v, &changed, &type_changed_vec,
+                                             &newobj_vec,
+                                             &unchanged, &children_changed,
+                                             true, v->from, v->to))
            {
-             if (children_changed || !newobj.empty ())
+             if (children_changed || !newobj_vec.empty ())
                {
                  r.children_changed = true;
-                 r.newobj = std::move (newobj);
+                 r.newobj = std::move (newobj_vec);
                }
              /* Push in reverse order so that the first child is
                 popped from the work stack first, and so will be
                 added to result first.  This does not affect
                 correctness, just "nicer".  */
-             for (int i = type_changed.size () - 1; i >= 0; --i)
+             for (int i = type_changed_vec.size () - 1; i >= 0; --i)
                {
-                 varobj_update_result r (type_changed[i]);
+                 varobj_update_result item (type_changed_vec[i]);
 
                  /* Type may change only if value was changed.  */
-                 r.changed = true;
-                 r.type_changed = true;
-                 r.value_installed = true;
+                 item.changed = true;
+                 item.type_changed = true;
+                 item.value_installed = true;
 
-                 stack.push_back (std::move (r));
+                 stack.push_back (std::move (item));
                }
              for (int i = changed.size () - 1; i >= 0; --i)
                {
-                 varobj_update_result r (changed[i]);
+                 varobj_update_result item (changed[i]);
 
-                 r.changed = true;
-                 r.value_installed = true;
+                 item.changed = true;
+                 item.value_installed = true;
 
-                 stack.push_back (std::move (r));
+                 stack.push_back (std::move (item));
                }
              for (int i = unchanged.size () - 1; i >= 0; --i)
                {
                  if (!unchanged[i]->frozen)
                    {
-                     varobj_update_result r (unchanged[i]);
+                     varobj_update_result item (unchanged[i]);
 
-                     r.value_installed = true;
+                     item.value_installed = true;
 
-                     stack.push_back (std::move (r));
+                     stack.push_back (std::move (item));
                    }
                }
              if (r.changed || r.children_changed)
This page took 0.026464 seconds and 4 git commands to generate.