Remove duplicate or commented-out #includes
[deliverable/binutils-gdb.git] / gdb / rust-lang.c
index 43db722142b87aeb2069c50979f269da4c590de0..1cd92ff47a865159338bc9d3a77758cfe913ddac 100644 (file)
@@ -1,6 +1,6 @@
 /* Rust language support routines for GDB, the GNU debugger.
 
-   Copyright (C) 2016-2018 Free Software Foundation, Inc.
+   Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -811,8 +811,6 @@ rust_internal_print_type (struct type *type, const char *varstring,
                          const struct type_print_options *flags,
                          bool for_rust_enum, print_offset_data *podata)
 {
-  int i;
-
   QUIT;
   if (show <= 0
       && TYPE_NAME (type) != NULL)
@@ -846,7 +844,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
       if (varstring != NULL)
        fputs_filtered (varstring, stream);
       fputs_filtered ("(", stream);
-      for (i = 0; i < TYPE_NFIELDS (type); ++i)
+      for (int i = 0; i < TYPE_NFIELDS (type); ++i)
        {
          QUIT;
          if (i > 0)
@@ -891,7 +889,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
 
     case TYPE_CODE_ENUM:
       {
-       int i, len = 0;
+       int len = 0;
 
        fputs_filtered ("enum ", stream);
        if (TYPE_NAME (type) != NULL)
@@ -902,7 +900,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
          }
        fputs_filtered ("{\n", stream);
 
-       for (i = 0; i < TYPE_NFIELDS (type); ++i)
+       for (int i = 0; i < TYPE_NFIELDS (type); ++i)
          {
            const char *name = TYPE_FIELD_NAME (type, i);
 
@@ -920,6 +918,20 @@ rust_internal_print_type (struct type *type, const char *varstring,
       }
       break;
 
+    case TYPE_CODE_PTR:
+      {
+       if (TYPE_NAME (type) != nullptr)
+         fputs_filtered (TYPE_NAME (type), stream);
+       else
+         {
+           /* We currently can't distinguish between pointers and
+              references.  */
+           fputs_filtered ("*mut ", stream);
+           type_print (TYPE_TARGET_TYPE (type), "", stream, 0);
+         }
+      }
+      break;
+
     default:
     c_printer:
       c_print_type (type, varstring, stream, show, level, flags);
@@ -1160,7 +1172,7 @@ rust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside)
   if (noside == EVAL_AVOID_SIDE_EFFECTS)
     result = value_zero (TYPE_TARGET_TYPE (fn_type), not_lval);
   else
-    result = call_function_by_hand (function, NULL, num_args + 1, args.data ());
+    result = call_function_by_hand (function, NULL, args);
   return result;
 }
 
This page took 0.025043 seconds and 4 git commands to generate.