Fix a few comments in maint-test-settings.c
[deliverable/binutils-gdb.git] / gdb / valops.c
index 1d68c04bfe2be47019b1829811961b540ac15e00..948ad89fe9270b1e85f8242f7722b27fe946f8a9 100644 (file)
@@ -1,6 +1,6 @@
 /* Perform non-arithmetic operations on values, for GDB.
 
 /* Perform non-arithmetic operations on values, for GDB.
 
-   Copyright (C) 1986-2018 Free Software Foundation, Inc.
+   Copyright (C) 1986-2019 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 
    This file is part of GDB.
 
@@ -39,7 +39,7 @@
 #include "observable.h"
 #include "objfiles.h"
 #include "extension.h"
 #include "observable.h"
 #include "objfiles.h"
 #include "extension.h"
-#include "byte-vector.h"
+#include "common/byte-vector.h"
 
 extern unsigned int overload_debug;
 /* Local functions.  */
 
 extern unsigned int overload_debug;
 /* Local functions.  */
@@ -68,9 +68,9 @@ static int find_oload_champ_namespace_loop (gdb::array_view<value *> args,
 
 static int find_oload_champ (gdb::array_view<value *> args,
                             size_t num_fns,
 
 static int find_oload_champ (gdb::array_view<value *> args,
                             size_t num_fns,
-                            fn_field *fns_ptr,
-                            xmethod_worker_up *xm_worker_vec,
-                            symbol **oload_syms,
+                            fn_field *methods,
+                            xmethod_worker_up *xmethods,
+                            symbol **functions,
                             badness_vector *oload_champ_bv);
 
 static int oload_method_static_p (struct fn_field *, int);
                             badness_vector *oload_champ_bv);
 
 static int oload_method_static_p (struct fn_field *, int);
@@ -402,12 +402,12 @@ value_cast (struct type *type, struct value *arg2)
                       "divide object size in cast"));
          /* FIXME-type-allocation: need a way to free this type when
             we are done with it.  */
                       "divide object size in cast"));
          /* FIXME-type-allocation: need a way to free this type when
             we are done with it.  */
-         range_type = create_static_range_type ((struct type *) NULL,
+         range_type = create_static_range_type (NULL,
                                                 TYPE_TARGET_TYPE (range_type),
                                                 low_bound,
                                                 new_length + low_bound - 1);
          deprecated_set_value_type (arg2, 
                                                 TYPE_TARGET_TYPE (range_type),
                                                 low_bound,
                                                 new_length + low_bound - 1);
          deprecated_set_value_type (arg2, 
-                                    create_array_type ((struct type *) NULL,
+                                    create_array_type (NULL,
                                                        element_type, 
                                                        range_type));
          return arg2;
                                                        element_type, 
                                                        range_type));
          return arg2;
@@ -1980,23 +1980,12 @@ search_struct_method (const char *name, struct value **arg1p,
   int i;
   struct value *v;
   int name_matched = 0;
   int i;
   struct value *v;
   int name_matched = 0;
-  char dem_opname[64];
 
   type = check_typedef (type);
   for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; i--)
     {
       const char *t_field_name = TYPE_FN_FIELDLIST_NAME (type, i);
 
 
   type = check_typedef (type);
   for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; i--)
     {
       const char *t_field_name = TYPE_FN_FIELDLIST_NAME (type, i);
 
-      /* FIXME!  May need to check for ARM demangling here.  */
-      if (startswith (t_field_name, "__") ||
-         startswith (t_field_name, "op") ||
-         startswith (t_field_name, "type"))
-       {
-         if (cplus_demangle_opname (t_field_name, dem_opname, DMGL_ANSI))
-           t_field_name = dem_opname;
-         else if (cplus_demangle_opname (t_field_name, dem_opname, 0))
-           t_field_name = dem_opname;
-       }
       if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
        {
          int j = TYPE_FN_FIELDLIST_LENGTH (type, i) - 1;
       if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
        {
          int j = TYPE_FN_FIELDLIST_LENGTH (type, i) - 1;
@@ -2289,22 +2278,22 @@ value_union_variant (struct type *union_type, const gdb_byte *contents)
 }
 
 /* Search through the methods of an object (and its bases) to find a
 }
 
 /* Search through the methods of an object (and its bases) to find a
-   specified method.  Return a reference to the fn_field list FN_LIST of
+   specified method.  Return a reference to the fn_field list METHODS of
    overloaded instances defined in the source language.  If available
    and matching, a vector of matching xmethods defined in extension
    overloaded instances defined in the source language.  If available
    and matching, a vector of matching xmethods defined in extension
-   languages are also returned in XM_WORKER_VEC
+   languages are also returned in XMETHODS.
 
    Helper function for value_find_oload_list.
    ARGP is a pointer to a pointer to a value (the object).
    METHOD is a string containing the method name.
    OFFSET is the offset within the value.
    TYPE is the assumed type of the object.
 
    Helper function for value_find_oload_list.
    ARGP is a pointer to a pointer to a value (the object).
    METHOD is a string containing the method name.
    OFFSET is the offset within the value.
    TYPE is the assumed type of the object.
-   FN_LIST is the pointer to matching overloaded instances defined in
-      source language.  Since this is a recursive function, *FN_LIST
-      should be set to NULL when calling this function.
+   METHODS is a pointer to the matching overloaded instances defined
+      in the source language.  Since this is a recursive function,
+      *METHODS should be set to NULL when calling this function.
    NUM_FNS is the number of overloaded instances.  *NUM_FNS should be set to
       0 when calling this function.
    NUM_FNS is the number of overloaded instances.  *NUM_FNS should be set to
       0 when calling this function.
-   XM_WORKER_VEC is the vector of matching xmethod workers.  *XM_WORKER_VEC
+   XMETHODS is the vector of matching xmethod workers.  *XMETHODS
       should also be set to NULL when calling this function.
    BASETYPE is set to the actual type of the subobject where the
       method is found.
       should also be set to NULL when calling this function.
    BASETYPE is set to the actual type of the subobject where the
       method is found.
@@ -2313,21 +2302,21 @@ value_union_variant (struct type *union_type, const gdb_byte *contents)
 static void
 find_method_list (struct value **argp, const char *method,
                  LONGEST offset, struct type *type,
 static void
 find_method_list (struct value **argp, const char *method,
                  LONGEST offset, struct type *type,
-                 gdb::array_view<fn_field> *fn_list,
-                 std::vector<xmethod_worker_up> *xm_worker_vec,
+                 gdb::array_view<fn_field> *methods,
+                 std::vector<xmethod_worker_up> *xmethods,
                  struct type **basetype, LONGEST *boffset)
 {
   int i;
   struct fn_field *f = NULL;
 
                  struct type **basetype, LONGEST *boffset)
 {
   int i;
   struct fn_field *f = NULL;
 
-  gdb_assert (fn_list != NULL && xm_worker_vec != NULL);
+  gdb_assert (methods != NULL && xmethods != NULL);
   type = check_typedef (type);
 
   /* First check in object itself.
      This function is called recursively to search through base classes.
      If there is a source method match found at some stage, then we need not
      look for source methods in consequent recursive calls.  */
   type = check_typedef (type);
 
   /* First check in object itself.
      This function is called recursively to search through base classes.
      If there is a source method match found at some stage, then we need not
      look for source methods in consequent recursive calls.  */
-  if (fn_list->empty ())
+  if (methods->empty ())
     {
       for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; i--)
        {
     {
       for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; i--)
        {
@@ -2338,7 +2327,7 @@ find_method_list (struct value **argp, const char *method,
            {
              int len = TYPE_FN_FIELDLIST_LENGTH (type, i);
              f = TYPE_FN_FIELDLIST1 (type, i);
            {
              int len = TYPE_FN_FIELDLIST_LENGTH (type, i);
              f = TYPE_FN_FIELDLIST1 (type, i);
-             *fn_list = gdb::make_array_view (f, len);
+             *methods = gdb::make_array_view (f, len);
 
              *basetype = type;
              *boffset = offset;
 
              *basetype = type;
              *boffset = offset;
@@ -2358,7 +2347,7 @@ find_method_list (struct value **argp, const char *method,
      and hence there is no point restricting them with something like method
      hiding.  Moreover, if hiding is done for xmethods as well, then we will
      have to provide a mechanism to un-hide (like the 'using' construct).  */
      and hence there is no point restricting them with something like method
      hiding.  Moreover, if hiding is done for xmethods as well, then we will
      have to provide a mechanism to un-hide (like the 'using' construct).  */
-  get_matching_xmethod_workers (type, method, xm_worker_vec);
+  get_matching_xmethod_workers (type, method, xmethods);
 
   /* If source methods are not found in current class, look for them in the
      base classes.  We also have to go through the base classes to gather
 
   /* If source methods are not found in current class, look for them in the
      base classes.  We also have to go through the base classes to gather
@@ -2381,22 +2370,22 @@ find_method_list (struct value **argp, const char *method,
        }
 
       find_method_list (argp, method, base_offset + offset,
        }
 
       find_method_list (argp, method, base_offset + offset,
-                       TYPE_BASECLASS (type, i), fn_list,
-                       xm_worker_vec, basetype, boffset);
+                       TYPE_BASECLASS (type, i), methods,
+                       xmethods, basetype, boffset);
     }
 }
 
 /* Return the list of overloaded methods of a specified name.  The methods
    could be those GDB finds in the binary, or xmethod.  Methods found in
     }
 }
 
 /* Return the list of overloaded methods of a specified name.  The methods
    could be those GDB finds in the binary, or xmethod.  Methods found in
-   the binary are returned in FN_LIST, and xmethods are returned in
-   XM_WORKER_VEC.
+   the binary are returned in METHODS, and xmethods are returned in
+   XMETHODS.
 
    ARGP is a pointer to a pointer to a value (the object).
    METHOD is the method name.
    OFFSET is the offset within the value contents.
 
    ARGP is a pointer to a pointer to a value (the object).
    METHOD is the method name.
    OFFSET is the offset within the value contents.
-   FN_LIST is the list of matching overloaded instances defined in
-      source language.
-   XM_WORKER_VEC is the vector of matching xmethod workers defined in
+   METHODS is the list of matching overloaded instances defined in
+      the source language.
+   XMETHODS is the vector of matching xmethod workers defined in
       extension languages.
    BASETYPE is set to the type of the base subobject that defines the
       method.
       extension languages.
    BASETYPE is set to the type of the base subobject that defines the
       method.
@@ -2405,8 +2394,8 @@ find_method_list (struct value **argp, const char *method,
 static void
 value_find_oload_method_list (struct value **argp, const char *method,
                              LONGEST offset,
 static void
 value_find_oload_method_list (struct value **argp, const char *method,
                              LONGEST offset,
-                             gdb::array_view<fn_field> *fn_list,
-                             std::vector<xmethod_worker_up> *xm_worker_vec,
+                             gdb::array_view<fn_field> *methods,
+                             std::vector<xmethod_worker_up> *xmethods,
                              struct type **basetype, LONGEST *boffset)
 {
   struct type *t;
                              struct type **basetype, LONGEST *boffset)
 {
   struct type *t;
@@ -2428,13 +2417,13 @@ value_find_oload_method_list (struct value **argp, const char *method,
     error (_("Attempt to extract a component of a "
             "value that is not a struct or union"));
 
     error (_("Attempt to extract a component of a "
             "value that is not a struct or union"));
 
-  gdb_assert (fn_list != NULL && xm_worker_vec != NULL);
+  gdb_assert (methods != NULL && xmethods != NULL);
 
   /* Clear the lists.  */
 
   /* Clear the lists.  */
-  *fn_list = {};
-  xm_worker_vec->clear ();
+  *methods = {};
+  xmethods->clear ();
 
 
-  find_method_list (argp, method, 0, t, fn_list, xm_worker_vec,
+  find_method_list (argp, method, 0, t, methods, xmethods,
                    basetype, boffset);
 }
 
                    basetype, boffset);
 }
 
@@ -2508,18 +2497,17 @@ find_overload_match (gdb::array_view<value *> args,
 
   struct value *temp = obj;
   /* For methods, the list of overloaded methods.  */
 
   struct value *temp = obj;
   /* For methods, the list of overloaded methods.  */
-  gdb::array_view<fn_field> fns_list;
+  gdb::array_view<fn_field> methods;
   /* For non-methods, the list of overloaded function symbols.  */
   /* For non-methods, the list of overloaded function symbols.  */
-  std::vector<symbol *> oload_syms;
+  std::vector<symbol *> functions;
   /* For xmethods, the vector of xmethod workers.  */
   /* For xmethods, the vector of xmethod workers.  */
-  std::vector<xmethod_worker_up> xm_worker_vec;
+  std::vector<xmethod_worker_up> xmethods;
   struct type *basetype = NULL;
   LONGEST boffset;
 
   struct type *basetype = NULL;
   LONGEST boffset;
 
-  struct cleanup *all_cleanups = make_cleanup (null_cleanup, NULL);
-
   const char *obj_type_name = NULL;
   const char *func_name = NULL;
   const char *obj_type_name = NULL;
   const char *func_name = NULL;
+  gdb::unique_xmalloc_ptr<char> temp_func;
   enum oload_classification match_quality;
   enum oload_classification method_match_quality = INCOMPATIBLE;
   enum oload_classification src_method_match_quality = INCOMPATIBLE;
   enum oload_classification match_quality;
   enum oload_classification method_match_quality = INCOMPATIBLE;
   enum oload_classification src_method_match_quality = INCOMPATIBLE;
@@ -2546,17 +2534,16 @@ find_overload_match (gdb::array_view<value *> args,
          if (*valp)
            {
              *staticp = 1;
          if (*valp)
            {
              *staticp = 1;
-             do_cleanups (all_cleanups);
              return 0;
            }
        }
 
       /* Retrieve the list of methods with the name NAME.  */
              return 0;
            }
        }
 
       /* Retrieve the list of methods with the name NAME.  */
-      value_find_oload_method_list (&temp, name, 0, &fns_list,
-                                   &xm_worker_vec, &basetype, &boffset);
+      value_find_oload_method_list (&temp, name, 0, &methods,
+                                   &xmethods, &basetype, &boffset);
       /* If this is a method only search, and no methods were found
          the search has failed.  */
       /* If this is a method only search, and no methods were found
          the search has failed.  */
-      if (method == METHOD && fns_list.empty () && xm_worker_vec.empty ())
+      if (method == METHOD && methods.empty () && xmethods.empty ())
        error (_("Couldn't find method %s%s%s"),
               obj_type_name,
               (obj_type_name && *obj_type_name) ? "::" : "",
        error (_("Couldn't find method %s%s%s"),
               obj_type_name,
               (obj_type_name && *obj_type_name) ? "::" : "",
@@ -2564,27 +2551,27 @@ find_overload_match (gdb::array_view<value *> args,
       /* If we are dealing with stub method types, they should have
         been resolved by find_method_list via
         value_find_oload_method_list above.  */
       /* If we are dealing with stub method types, they should have
         been resolved by find_method_list via
         value_find_oload_method_list above.  */
-      if (!fns_list.empty ())
+      if (!methods.empty ())
        {
        {
-         gdb_assert (TYPE_SELF_TYPE (fns_list[0].type) != NULL);
+         gdb_assert (TYPE_SELF_TYPE (methods[0].type) != NULL);
 
          src_method_oload_champ
            = find_oload_champ (args,
 
          src_method_oload_champ
            = find_oload_champ (args,
-                               fns_list.size (),
-                               fns_list.data (), NULL, NULL,
+                               methods.size (),
+                               methods.data (), NULL, NULL,
                                &src_method_badness);
 
          src_method_match_quality = classify_oload_match
            (src_method_badness, args.size (),
                                &src_method_badness);
 
          src_method_match_quality = classify_oload_match
            (src_method_badness, args.size (),
-            oload_method_static_p (fns_list.data (), src_method_oload_champ));
+            oload_method_static_p (methods.data (), src_method_oload_champ));
        }
 
        }
 
-      if (!xm_worker_vec.empty ())
+      if (!xmethods.empty ())
        {
          ext_method_oload_champ
            = find_oload_champ (args,
        {
          ext_method_oload_champ
            = find_oload_champ (args,
-                               xm_worker_vec.size (),
-                               NULL, xm_worker_vec.data (), NULL,
+                               xmethods.size (),
+                               NULL, xmethods.data (), NULL,
                                &ext_method_badness);
          ext_method_match_quality = classify_oload_match (ext_method_badness,
                                                           args.size (), 0);
                                &ext_method_badness);
          ext_method_match_quality = classify_oload_match (ext_method_badness,
                                                           args.size (), 0);
@@ -2666,20 +2653,17 @@ find_overload_match (gdb::array_view<value *> args,
               && TYPE_CODE (check_typedef (SYMBOL_TYPE (fsym)))
              == TYPE_CODE_FUNC)
             {
               && TYPE_CODE (check_typedef (SYMBOL_TYPE (fsym)))
              == TYPE_CODE_FUNC)
             {
-             char *temp_func;
-
              temp_func = cp_func_name (qualified_name);
 
              /* If cp_func_name did not remove anything, the name of the
                 symbol did not include scope or argument types - it was
                 probably a C-style function.  */
              temp_func = cp_func_name (qualified_name);
 
              /* If cp_func_name did not remove anything, the name of the
                 symbol did not include scope or argument types - it was
                 probably a C-style function.  */
-             if (temp_func)
+             if (temp_func != nullptr)
                {
                {
-                 make_cleanup (xfree, temp_func);
-                 if (strcmp (temp_func, qualified_name) == 0)
+                 if (strcmp (temp_func.get (), qualified_name) == 0)
                    func_name = NULL;
                  else
                    func_name = NULL;
                  else
-                   func_name = temp_func;
+                   func_name = temp_func.get ();
                }
             }
         }
                }
             }
         }
@@ -2695,14 +2679,13 @@ find_overload_match (gdb::array_view<value *> args,
       if (func_name == NULL)
         {
          *symp = fsym;
       if (func_name == NULL)
         {
          *symp = fsym;
-         do_cleanups (all_cleanups);
           return 0;
         }
 
       func_oload_champ = find_oload_champ_namespace (args,
                                                      func_name,
                                                      qualified_name,
           return 0;
         }
 
       func_oload_champ = find_oload_champ_namespace (args,
                                                      func_name,
                                                      qualified_name,
-                                                     &oload_syms,
+                                                     &functions,
                                                      &func_badness,
                                                      no_adl);
 
                                                      &func_badness,
                                                      no_adl);
 
@@ -2784,29 +2767,29 @@ find_overload_match (gdb::array_view<value *> args,
     }
 
   if (staticp != NULL)
     }
 
   if (staticp != NULL)
-    *staticp = oload_method_static_p (fns_list.data (), method_oload_champ);
+    *staticp = oload_method_static_p (methods.data (), method_oload_champ);
 
   if (method_oload_champ >= 0)
     {
       if (src_method_oload_champ >= 0)
        {
 
   if (method_oload_champ >= 0)
     {
       if (src_method_oload_champ >= 0)
        {
-         if (TYPE_FN_FIELD_VIRTUAL_P (fns_list, method_oload_champ)
+         if (TYPE_FN_FIELD_VIRTUAL_P (methods, method_oload_champ)
              && noside != EVAL_AVOID_SIDE_EFFECTS)
            {
              && noside != EVAL_AVOID_SIDE_EFFECTS)
            {
-             *valp = value_virtual_fn_field (&temp, fns_list.data (),
+             *valp = value_virtual_fn_field (&temp, methods.data (),
                                              method_oload_champ, basetype,
                                              boffset);
            }
          else
                                              method_oload_champ, basetype,
                                              boffset);
            }
          else
-           *valp = value_fn_field (&temp, fns_list.data (),
+           *valp = value_fn_field (&temp, methods.data (),
                                    method_oload_champ, basetype, boffset);
        }
       else
        *valp = value_from_xmethod
                                    method_oload_champ, basetype, boffset);
        }
       else
        *valp = value_from_xmethod
-         (std::move (xm_worker_vec[ext_method_oload_champ]));
+         (std::move (xmethods[ext_method_oload_champ]));
     }
   else
     }
   else
-    *symp = oload_syms[func_oload_champ];
+    *symp = functions[func_oload_champ];
 
   if (objp)
     {
 
   if (objp)
     {
@@ -2822,8 +2805,6 @@ find_overload_match (gdb::array_view<value *> args,
       *objp = temp;
     }
 
       *objp = temp;
     }
 
-  do_cleanups (all_cleanups);
-
   switch (match_quality)
     {
     case INCOMPATIBLE:
   switch (match_quality)
     {
     case INCOMPATIBLE:
@@ -2973,12 +2954,12 @@ find_oload_champ_namespace_loop (gdb::array_view<value *> args,
 }
 
 /* Look for a function to take ARGS.  Find the best match from among
 }
 
 /* Look for a function to take ARGS.  Find the best match from among
-   the overloaded methods or functions given by FNS_PTR or OLOAD_SYMS
-   or XM_WORKER_VEC, respectively.  One, and only one of FNS_PTR,
-   OLOAD_SYMS and XM_WORKER_VEC can be non-NULL.
+   the overloaded methods or functions given by METHODS or FUNCTIONS
+   or XMETHODS, respectively.  One, and only one of METHODS, FUNCTIONS
+   and XMETHODS can be non-NULL.
 
 
-   NUM_FNS is the length of the array pointed at by FNS_PTR,
-   OLOAD_SYMS or XM_WORKER_VEC, whichever is non-NULL.
+   NUM_FNS is the length of the array pointed at by METHODS, FUNCTIONS
+   or XMETHODS, whichever is non-NULL.
 
    Return the index of the best match; store an indication of the
    quality of the match in OLOAD_CHAMP_BV.  */
 
    Return the index of the best match; store an indication of the
    quality of the match in OLOAD_CHAMP_BV.  */
@@ -2986,9 +2967,9 @@ find_oload_champ_namespace_loop (gdb::array_view<value *> args,
 static int
 find_oload_champ (gdb::array_view<value *> args,
                  size_t num_fns,
 static int
 find_oload_champ (gdb::array_view<value *> args,
                  size_t num_fns,
-                 fn_field *fns_ptr,
-                 xmethod_worker_up *xm_worker_vec,
-                 symbol **oload_syms,
+                 fn_field *methods,
+                 xmethod_worker_up *xmethods,
+                 symbol **functions,
                  badness_vector *oload_champ_bv)
 {
   /* A measure of how good an overloaded instance is.  */
                  badness_vector *oload_champ_bv)
 {
   /* A measure of how good an overloaded instance is.  */
@@ -3002,7 +2983,7 @@ find_oload_champ (gdb::array_view<value *> args,
   /* A champion can be found among methods alone, or among functions
      alone, or in xmethods alone, but not in more than one of these
      groups.  */
   /* A champion can be found among methods alone, or among functions
      alone, or in xmethods alone, but not in more than one of these
      groups.  */
-  gdb_assert ((fns_ptr != NULL) + (oload_syms != NULL) + (xm_worker_vec != NULL)
+  gdb_assert ((methods != NULL) + (functions != NULL) + (xmethods != NULL)
              == 1);
 
   /* Consider each candidate in turn.  */
              == 1);
 
   /* Consider each candidate in turn.  */
@@ -3012,26 +2993,26 @@ find_oload_champ (gdb::array_view<value *> args,
       int static_offset = 0;
       std::vector<type *> parm_types;
 
       int static_offset = 0;
       std::vector<type *> parm_types;
 
-      if (xm_worker_vec != NULL)
-       parm_types = xm_worker_vec[ix]->get_arg_types ();
+      if (xmethods != NULL)
+       parm_types = xmethods[ix]->get_arg_types ();
       else
        {
          size_t nparms;
 
       else
        {
          size_t nparms;
 
-         if (fns_ptr != NULL)
+         if (methods != NULL)
            {
            {
-             nparms = TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (fns_ptr, ix));
-             static_offset = oload_method_static_p (fns_ptr, ix);
+             nparms = TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (methods, ix));
+             static_offset = oload_method_static_p (methods, ix);
            }
          else
            }
          else
-           nparms = TYPE_NFIELDS (SYMBOL_TYPE (oload_syms[ix]));
+           nparms = TYPE_NFIELDS (SYMBOL_TYPE (functions[ix]));
 
          parm_types.reserve (nparms);
          for (jj = 0; jj < nparms; jj++)
            {
 
          parm_types.reserve (nparms);
          for (jj = 0; jj < nparms; jj++)
            {
-             type *t = (fns_ptr != NULL
-                        ? (TYPE_FN_FIELD_ARGS (fns_ptr, ix)[jj].type)
-                        : TYPE_FIELD_TYPE (SYMBOL_TYPE (oload_syms[ix]),
+             type *t = (methods != NULL
+                        ? (TYPE_FN_FIELD_ARGS (methods, ix)[jj].type)
+                        : TYPE_FIELD_TYPE (SYMBOL_TYPE (functions[ix]),
                                            jj));
              parm_types.push_back (t);
            }
                                            jj));
              parm_types.push_back (t);
            }
@@ -3068,11 +3049,11 @@ find_oload_champ (gdb::array_view<value *> args,
          }
       if (overload_debug)
        {
          }
       if (overload_debug)
        {
-         if (fns_ptr != NULL)
+         if (methods != NULL)
            fprintf_filtered (gdb_stderr,
                              "Overloaded method instance %s, # of parms %d\n",
            fprintf_filtered (gdb_stderr,
                              "Overloaded method instance %s, # of parms %d\n",
-                             fns_ptr[ix].physname, (int) parm_types.size ());
-         else if (xm_worker_vec != NULL)
+                             methods[ix].physname, (int) parm_types.size ());
+         else if (xmethods != NULL)
            fprintf_filtered (gdb_stderr,
                              "Xmethod worker, # of parms %d\n",
                              (int) parm_types.size ());
            fprintf_filtered (gdb_stderr,
                              "Xmethod worker, # of parms %d\n",
                              (int) parm_types.size ());
@@ -3080,7 +3061,7 @@ find_oload_champ (gdb::array_view<value *> args,
            fprintf_filtered (gdb_stderr,
                              "Overloaded function instance "
                              "%s # of parms %d\n",
            fprintf_filtered (gdb_stderr,
                              "Overloaded function instance "
                              "%s # of parms %d\n",
-                             SYMBOL_DEMANGLED_NAME (oload_syms[ix]), 
+                             SYMBOL_DEMANGLED_NAME (functions[ix]),
                              (int) parm_types.size ());
          for (jj = 0; jj < args.size () - static_offset; jj++)
            fprintf_filtered (gdb_stderr,
                              (int) parm_types.size ());
          for (jj = 0; jj < args.size () - static_offset; jj++)
            fprintf_filtered (gdb_stderr,
@@ -3429,19 +3410,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
   for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
     {
       const char *t_field_name = TYPE_FN_FIELDLIST_NAME (t, i);
   for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
     {
       const char *t_field_name = TYPE_FN_FIELDLIST_NAME (t, i);
-      char dem_opname[64];
 
 
-      if (startswith (t_field_name, "__") 
-         || startswith (t_field_name, "op") 
-         || startswith (t_field_name, "type"))
-       {
-         if (cplus_demangle_opname (t_field_name, 
-                                    dem_opname, DMGL_ANSI))
-           t_field_name = dem_opname;
-         else if (cplus_demangle_opname (t_field_name, 
-                                         dem_opname, 0))
-           t_field_name = dem_opname;
-       }
       if (t_field_name && strcmp (t_field_name, name) == 0)
        {
          int j;
       if (t_field_name && strcmp (t_field_name, name) == 0)
        {
          int j;
@@ -3652,11 +3621,11 @@ value_rtti_indirect_type (struct value *v, int *full,
   else if (TYPE_CODE (type) == TYPE_CODE_PTR)
     {
 
   else if (TYPE_CODE (type) == TYPE_CODE_PTR)
     {
 
-      TRY
+      try
         {
          target = value_ind (v);
         }
         {
          target = value_ind (v);
         }
-      CATCH (except, RETURN_MASK_ERROR)
+      catch (const gdb_exception_error &except)
        {
          if (except.error == MEMORY_ERROR)
            {
        {
          if (except.error == MEMORY_ERROR)
            {
@@ -3665,9 +3634,8 @@ value_rtti_indirect_type (struct value *v, int *full,
                 type.  */
              return NULL;
            }
                 type.  */
              return NULL;
            }
-         throw_exception (except);
+         throw;
        }
        }
-      END_CATCH
     }
   else
     return NULL;
     }
   else
     return NULL;
@@ -3805,14 +3773,13 @@ value_of_this_silent (const struct language_defn *lang)
 {
   struct value *ret = NULL;
 
 {
   struct value *ret = NULL;
 
-  TRY
+  try
     {
       ret = value_of_this (lang);
     }
     {
       ret = value_of_this (lang);
     }
-  CATCH (except, RETURN_MASK_ERROR)
+  catch (const gdb_exception_error &except)
     {
     }
     {
     }
-  END_CATCH
 
   return ret;
 }
 
   return ret;
 }
@@ -3834,6 +3801,11 @@ value_slice (struct value *array, int lowbound, int length)
       && TYPE_CODE (array_type) != TYPE_CODE_STRING)
     error (_("cannot take slice of non-array"));
 
       && TYPE_CODE (array_type) != TYPE_CODE_STRING)
     error (_("cannot take slice of non-array"));
 
+  if (type_not_allocated (array_type))
+    error (_("array not allocated"));
+  if (type_not_associated (array_type))
+    error (_("array not associated"));
+
   range_type = TYPE_INDEX_TYPE (array_type);
   if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
     error (_("slice from bad array or bitstring"));
   range_type = TYPE_INDEX_TYPE (array_type);
   if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
     error (_("slice from bad array or bitstring"));
@@ -3844,7 +3816,7 @@ value_slice (struct value *array, int lowbound, int length)
 
   /* FIXME-type-allocation: need a way to free this type when we are
      done with it.  */
 
   /* FIXME-type-allocation: need a way to free this type when we are
      done with it.  */
-  slice_range_type = create_static_range_type ((struct type *) NULL,
+  slice_range_type = create_static_range_type (NULL,
                                               TYPE_TARGET_TYPE (range_type),
                                               lowbound,
                                               lowbound + length - 1);
                                               TYPE_TARGET_TYPE (range_type),
                                               lowbound,
                                               lowbound + length - 1);
@@ -3854,7 +3826,7 @@ value_slice (struct value *array, int lowbound, int length)
     LONGEST offset
       = (lowbound - lowerbound) * TYPE_LENGTH (check_typedef (element_type));
 
     LONGEST offset
       = (lowbound - lowerbound) * TYPE_LENGTH (check_typedef (element_type));
 
-    slice_type = create_array_type ((struct type *) NULL,
+    slice_type = create_array_type (NULL,
                                    element_type,
                                    slice_range_type);
     TYPE_CODE (slice_type) = TYPE_CODE (array_type);
                                    element_type,
                                    slice_range_type);
     TYPE_CODE (slice_type) = TYPE_CODE (array_type);
This page took 0.033316 seconds and 4 git commands to generate.