gdb: rename type::{arch,objfile} -> type::{arch_owner,objfile_owner}
[deliverable/binutils-gdb.git] / gdb / parse.c
index 80a67c6c707e0da8b587ae9cffdc0246d51655b4..933960fa30ce5cba3e19c93dc294b98045a94473 100644 (file)
@@ -1,6 +1,6 @@
 /* Parse expressions for GDB.
 
-   Copyright (C) 1986-2020 Free Software Foundation, Inc.
+   Copyright (C) 1986-2021 Free Software Foundation, Inc.
 
    Modified from expread.y by the Department of Computer Science at the
    State University of New York at Buffalo, 1991.
@@ -1158,13 +1158,20 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
   return result;
 }
 
-/* Parse STRING as an expression, and complain if this fails
-   to use up all of the contents of STRING.  */
+/* Parse STRING as an expression, and complain if this fails to use up
+   all of the contents of STRING.  TRACKER, if non-null, will be
+   updated by the parser.  VOID_CONTEXT_P should be true to indicate
+   that the expression may be expected to return a value with void
+   type.  Parsers are free to ignore this, or to use it to help with
+   overload resolution decisions.  */
 
 expression_up
-parse_expression (const char *string, innermost_block_tracker *tracker)
+parse_expression (const char *string, innermost_block_tracker *tracker,
+                 bool void_context_p)
 {
-  expression_up exp = parse_exp_1 (&string, 0, 0, 0, tracker);
+  expression_up exp = parse_exp_in_context (&string, 0, nullptr, 0,
+                                           void_context_p, nullptr,
+                                           tracker, nullptr);
   if (*string)
     error (_("Junk after end of expression."));
   return exp;
@@ -1313,7 +1320,7 @@ operator_check_standard (struct expression *exp, int pos,
        for (arg = 0; arg < nargs; arg++)
          {
            struct type *inst_type = elts[pos + 3 + arg].type;
-           struct objfile *inst_objfile = TYPE_OBJFILE (inst_type);
+           struct objfile *inst_objfile = inst_type->objfile_owner ();
 
            if (inst_objfile && (*objfile_func) (inst_objfile, data))
              return 1;
@@ -1344,9 +1351,10 @@ operator_check_standard (struct expression *exp, int pos,
 
   /* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL.  */
 
-  if (type && TYPE_OBJFILE (type)
-      && (*objfile_func) (TYPE_OBJFILE (type), data))
+  if (type != nullptr && type->objfile_owner () != nullptr
+      && objfile_func (type->objfile_owner (), data))
     return 1;
+
   if (objfile && (*objfile_func) (objfile, data))
     return 1;
 
This page took 0.024107 seconds and 4 git commands to generate.