* c-exp.y (block, variable, name_not_typename, lex_one_token,
authorTom Tromey <tromey@redhat.com>
Fri, 14 Dec 2012 17:47:40 +0000 (17:47 +0000)
committerTom Tromey <tromey@redhat.com>
Fri, 14 Dec 2012 17:47:40 +0000 (17:47 +0000)
classify_name): Update.
* c-valprint.c (c_val_print): Update.
* f-exp.y (yylex): Update.
* go-exp.y (package_name_p, classify_packaged_name)
(classify_name): Update.
* jv-exp.y (push_variable): Update.
* m2-exp.y (variable): Update.
* mi/mi-cmd-stack.c (list_args_or_locals): Update.
* p-exp.y (block, variable, yylex): Update.
* p-valprint.c (pascal_val_print): Update.
* parse.c (write_dollar_variable): Update.
* printcmd.c (address_info): Update.
* python/py-symbol.c (gdbpy_lookup_symbol): Update.
* symtab.c (lookup_symbol_aux, lookup_symbol_in_language)
(lookup_symbol): Change type of 'is_a_field_of_this'.
(check_field): Add 'is_a_field_of_this' argument.
* symtab.h (struct field_of_this_result): New.
(lookup_symbol, lookup_symbol_in_language): Update.

15 files changed:
gdb/ChangeLog
gdb/c-exp.y
gdb/c-valprint.c
gdb/f-exp.y
gdb/go-exp.y
gdb/jv-exp.y
gdb/m2-exp.y
gdb/mi/mi-cmd-stack.c
gdb/p-exp.y
gdb/p-valprint.c
gdb/parse.c
gdb/printcmd.c
gdb/python/py-symbol.c
gdb/symtab.c
gdb/symtab.h

index b33c14229c0cd9bf1fb7b8039ee6da0fafe89629..9791be6221cbd4887f0101271bba1f9d87b4c7f2 100644 (file)
@@ -1,3 +1,25 @@
+2012-12-14  Tom Tromey  <tromey@redhat.com>
+
+       * c-exp.y (block, variable, name_not_typename, lex_one_token,
+       classify_name): Update.
+       * c-valprint.c (c_val_print): Update.
+       * f-exp.y (yylex): Update.
+       * go-exp.y (package_name_p, classify_packaged_name)
+       (classify_name): Update.
+       * jv-exp.y (push_variable): Update.
+       * m2-exp.y (variable): Update.
+       * mi/mi-cmd-stack.c (list_args_or_locals): Update.
+       * p-exp.y (block, variable, yylex): Update.
+       * p-valprint.c (pascal_val_print): Update.
+       * parse.c (write_dollar_variable): Update.
+       * printcmd.c (address_info): Update.
+       * python/py-symbol.c (gdbpy_lookup_symbol): Update.
+       * symtab.c (lookup_symbol_aux, lookup_symbol_in_language)
+       (lookup_symbol): Change type of 'is_a_field_of_this'.
+       (check_field): Add 'is_a_field_of_this' argument.
+       * symtab.h (struct field_of_this_result): New.
+       (lookup_symbol, lookup_symbol_in_language): Update.
+
 2012-12-14  Tom Tromey  <tromey@redhat.com>
 
        * symtab.c (check_field): Now static.  Move from...
index dc89c3eaa22a1e1db73e0983ab41382e81ba9d7e..2c6eedaac25f4817e7af06ab98f675b3e9867eb0 100644 (file)
@@ -871,7 +871,7 @@ block       :       BLOCKNAME
 block  :       block COLONCOLON name
                        { struct symbol *tem
                            = lookup_symbol (copy_name ($3), $1,
-                                            VAR_DOMAIN, (int *) NULL);
+                                            VAR_DOMAIN, NULL);
                          if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
                            error (_("No function \"%s\" in specified context."),
                                   copy_name ($3));
@@ -896,7 +896,7 @@ variable:   name_not_typename ENTRY
 variable:      block COLONCOLON name
                        { struct symbol *sym;
                          sym = lookup_symbol (copy_name ($3), $1,
-                                              VAR_DOMAIN, (int *) NULL);
+                                              VAR_DOMAIN, NULL);
                          if (sym == 0)
                            error (_("No symbol \"%s\" in specified context."),
                                   copy_name ($3));
@@ -972,7 +972,7 @@ variable:   qualified_name
 
                          sym =
                            lookup_symbol (name, (const struct block *) NULL,
-                                          VAR_DOMAIN, (int *) NULL);
+                                          VAR_DOMAIN, NULL);
                          if (sym)
                            {
                              write_exp_elt_opcode (OP_VAR_VALUE);
@@ -1577,11 +1577,15 @@ name_not_typename :     NAME
  */
        |       operator
                        {
+                         struct field_of_this_result is_a_field_of_this;
+
                          $$.stoken = $1;
                          $$.sym = lookup_symbol ($1.ptr,
                                                  expression_context_block,
                                                  VAR_DOMAIN,
-                                                 &$$.is_a_field_of_this);
+                                                 &is_a_field_of_this);
+                         $$.is_a_field_of_this
+                           = is_a_field_of_this.type != NULL;
                        }
        |       UNKNOWN_CPP_NAME
        ;
@@ -2690,7 +2694,7 @@ lex_one_token (void)
 
        if ((ident_tokens[i].flags & FLAG_SHADOW) != 0)
          {
-           int is_a_field_of_this = 0;
+           struct field_of_this_result is_a_field_of_this;
 
            if (lookup_symbol (copy, expression_context_block,
                               VAR_DOMAIN,
@@ -2747,18 +2751,22 @@ classify_name (const struct block *block)
 {
   struct symbol *sym;
   char *copy;
-  int is_a_field_of_this = 0;
+  struct field_of_this_result is_a_field_of_this;
 
   copy = copy_name (yylval.sval);
 
+  /* Initialize this in case we *don't* use it in this call; that way
+     we can refer to it unconditionally below.  */
+  memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
+
   sym = lookup_symbol (copy, block, VAR_DOMAIN, 
                       parse_language->la_name_of_this
-                      ? &is_a_field_of_this : (int *) NULL);
+                      ? &is_a_field_of_this : NULL);
 
   if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
     {
       yylval.ssym.sym = sym;
-      yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+      yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
       return BLOCKNAME;
     }
   else if (!sym)
@@ -2812,18 +2820,18 @@ classify_name (const struct block *block)
       if (hextype == INT)
        {
          yylval.ssym.sym = sym;
-         yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+         yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
          return NAME_OR_INT;
        }
     }
 
   /* Any other kind of symbol */
   yylval.ssym.sym = sym;
-  yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+  yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
 
   if (sym == NULL
       && parse_language->la_language == language_cplus
-      && !is_a_field_of_this
+      && is_a_field_of_this.type == NULL
       && !lookup_minimal_symbol (copy, NULL, NULL))
     return UNKNOWN_CPP_NAME;
 
index dada9e2ac2cc5a436decd60ae3b563d3f80ce2d0..09fd540da9beae154da1d88e55f51a8a96937bfe 100644 (file)
@@ -333,7 +333,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
                  struct symbol *wsym = (struct symbol *) NULL;
                  struct type *wtype;
                  struct block *block = (struct block *) NULL;
-                 int is_this_fld;
+                 struct field_of_this_result is_this_fld;
 
                  if (want_space)
                    fputs_filtered (" ", stream);
index 33c7418caedf7509e2d6536e0cd86d042f4150c7..8e941749f675b1d1788e41dce4c20679b76ac24c 100644 (file)
@@ -1175,9 +1175,13 @@ yylex (void)
   {
     char *tmp = copy_name (yylval.sval);
     struct symbol *sym;
-    int is_a_field_of_this = 0;
+    struct field_of_this_result is_a_field_of_this;
     int hextype;
     
+    /* Initialize this in case we *don't* use it in this call; that
+       way we can refer to it unconditionally below.  */
+    memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
+
     sym = lookup_symbol (tmp, expression_context_block,
                         VAR_DOMAIN,
                         parse_language->la_language == language_cplus
@@ -1205,14 +1209,14 @@ yylex (void)
        if (hextype == INT)
          {
            yylval.ssym.sym = sym;
-           yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+           yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
            return NAME_OR_INT;
          }
       }
     
     /* Any other kind of symbol */
     yylval.ssym.sym = sym;
-    yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+    yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
     return NAME;
   }
 }
index ed403d17ee2c03f94ac02458490a1c07f4684251..730b22b0273133398f82262a9b37a5e29dc8bdd9 100644 (file)
@@ -1365,7 +1365,7 @@ static int
 package_name_p (const char *name, const struct block *block)
 {
   struct symbol *sym;
-  int is_a_field_of_this;
+  struct field_of_this_result is_a_field_of_this;
 
   sym = lookup_symbol (name, block, STRUCT_DOMAIN, &is_a_field_of_this);
 
@@ -1406,7 +1406,7 @@ classify_packaged_name (const struct block *block)
 {
   char *copy;
   struct symbol *sym;
-  int is_a_field_of_this = 0;
+  struct field_of_this_result is_a_field_of_this;
 
   copy = copy_name (yylval.sval);
 
@@ -1415,7 +1415,7 @@ classify_packaged_name (const struct block *block)
   if (sym)
     {
       yylval.ssym.sym = sym;
-      yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+      yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
     }
 
   return NAME;
@@ -1435,7 +1435,7 @@ classify_name (const struct block *block)
   struct type *type;
   struct symbol *sym;
   char *copy;
-  int is_a_field_of_this = 0;
+  struct field_of_this_result is_a_field_of_this;
 
   copy = copy_name (yylval.sval);
 
@@ -1458,7 +1458,7 @@ classify_name (const struct block *block)
   if (sym)
     {
       yylval.ssym.sym = sym;
-      yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+      yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
       return NAME;
     }
 
@@ -1484,7 +1484,7 @@ classify_name (const struct block *block)
          {
            yylval.ssym.stoken = sval;
            yylval.ssym.sym = sym;
-           yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+           yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
            return NAME;
          }
       }
index d0fca67ce6546b5202e95fed8d66de124f6bdb78..80ef7e3dc03ea87b222d44f77837ad5e5fa0d480 100644 (file)
@@ -1227,7 +1227,7 @@ static int
 push_variable (struct stoken name)
 {
   char *tmp = copy_name (name);
-  int is_a_field_of_this = 0;
+  struct field_of_this_result is_a_field_of_this;
   struct symbol *sym;
   sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN,
                       &is_a_field_of_this);
@@ -1248,7 +1248,7 @@ push_variable (struct stoken name)
       write_exp_elt_opcode (OP_VAR_VALUE);
       return 1;
     }
-  if (is_a_field_of_this)
+  if (is_a_field_of_this.type != NULL)
     {
       /* it hangs off of `this'.  Must not inadvertently convert from a
         method call to data ref.  */
index 19f9c24545a7c26f4671e1dcd124368a95eb62c1..879c25d38c3f4001f7c85d40e7d0185531d9f2a2 100644 (file)
@@ -602,7 +602,7 @@ variable:   block COLONCOLON NAME
 /* Base case for variables.  */
 variable:      NAME
                        { struct symbol *sym;
-                         int is_a_field_of_this;
+                         struct field_of_this_result is_a_field_of_this;
 
                          sym = lookup_symbol (copy_name ($1),
                                               expression_context_block,
index fe3e0bf2bcd17a494a4d59ea92503cc4d4338910..32e8c9ec6019e3b78d06e533a1822e97bf6225f0 100644 (file)
@@ -397,7 +397,7 @@ list_args_or_locals (enum what_to_list what, enum print_values values,
              if (SYMBOL_IS_ARGUMENT (sym))
                sym2 = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
                                      block, VAR_DOMAIN,
-                                     (int *) NULL);
+                                     NULL);
              else
                sym2 = sym;
              gdb_assert (sym2 != NULL);
index 4c0cc573b79e6b4f8154e959f5ea24a9b0b06a99..dc576641a49b919ce83f16a52c3d021c2d22b48d 100644 (file)
@@ -658,7 +658,7 @@ block       :       BLOCKNAME
 block  :       block COLONCOLON name
                        { struct symbol *tem
                            = lookup_symbol (copy_name ($3), $1,
-                                            VAR_DOMAIN, (int *) NULL);
+                                            VAR_DOMAIN, NULL);
                          if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
                            error (_("No function \"%s\" in specified context."),
                                   copy_name ($3));
@@ -668,7 +668,7 @@ block       :       block COLONCOLON name
 variable:      block COLONCOLON name
                        { struct symbol *sym;
                          sym = lookup_symbol (copy_name ($3), $1,
-                                              VAR_DOMAIN, (int *) NULL);
+                                              VAR_DOMAIN, NULL);
                          if (sym == 0)
                            error (_("No symbol \"%s\" in specified context."),
                                   copy_name ($3));
@@ -704,7 +704,7 @@ variable:   qualified_name
 
                          sym =
                            lookup_symbol (name, (const struct block *) NULL,
-                                          VAR_DOMAIN, (int *) NULL);
+                                          VAR_DOMAIN, NULL);
                          if (sym)
                            {
                              write_exp_elt_opcode (OP_VAR_VALUE);
@@ -1483,7 +1483,7 @@ yylex (void)
          static const char this_name[] = "this";
 
          if (lookup_symbol (this_name, expression_context_block,
-                            VAR_DOMAIN, (int *) NULL))
+                            VAR_DOMAIN, NULL))
            {
              free (uptokstart);
              return THIS;
@@ -1522,7 +1522,7 @@ yylex (void)
   {
     char *tmp = copy_name (yylval.sval);
     struct symbol *sym;
-    int is_a_field_of_this = 0;
+    struct field_of_this_result is_a_field_of_this;
     int is_a_field = 0;
     int hextype;
 
@@ -1535,7 +1535,7 @@ yylex (void)
       sym = lookup_symbol (tmp, expression_context_block,
                           VAR_DOMAIN, &is_a_field_of_this);
     /* second chance uppercased (as Free Pascal does).  */
-    if (!sym && !is_a_field_of_this && !is_a_field)
+    if (!sym && is_a_field_of_this.type == NULL && !is_a_field)
       {
        for (i = 0; i <= namelen; i++)
          {
@@ -1549,7 +1549,7 @@ yylex (void)
        else
         sym = lookup_symbol (tmp, expression_context_block,
                              VAR_DOMAIN, &is_a_field_of_this);
-       if (sym || is_a_field_of_this || is_a_field)
+       if (sym || is_a_field_of_this.type != NULL || is_a_field)
          for (i = 0; i <= namelen; i++)
            {
              if ((tokstart[i] >= 'a' && tokstart[i] <= 'z'))
@@ -1557,7 +1557,7 @@ yylex (void)
            }
       }
     /* Third chance Capitalized (as GPC does).  */
-    if (!sym && !is_a_field_of_this && !is_a_field)
+    if (!sym && is_a_field_of_this.type == NULL && !is_a_field)
       {
        for (i = 0; i <= namelen; i++)
          {
@@ -1577,7 +1577,7 @@ yylex (void)
        else
         sym = lookup_symbol (tmp, expression_context_block,
                              VAR_DOMAIN, &is_a_field_of_this);
-       if (sym || is_a_field_of_this || is_a_field)
+       if (sym || is_a_field_of_this.type != NULL || is_a_field)
           for (i = 0; i <= namelen; i++)
             {
               if (i == 0)
@@ -1607,7 +1607,7 @@ yylex (void)
         || lookup_symtab (tmp))
       {
        yylval.ssym.sym = sym;
-       yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+       yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
        free (uptokstart);
        return BLOCKNAME;
       }
@@ -1673,7 +1673,7 @@ yylex (void)
                      memcpy (tmp1, namestart, p - namestart);
                      tmp1[p - namestart] = '\0';
                      cur_sym = lookup_symbol (ncopy, expression_context_block,
-                                              VAR_DOMAIN, (int *) NULL);
+                                              VAR_DOMAIN, NULL);
                      if (cur_sym)
                        {
                          if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)
@@ -1722,7 +1722,7 @@ yylex (void)
        if (hextype == INT)
          {
            yylval.ssym.sym = sym;
-           yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+           yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
            free (uptokstart);
            return NAME_OR_INT;
          }
@@ -1731,7 +1731,7 @@ yylex (void)
     free(uptokstart);
     /* Any other kind of symbol.  */
     yylval.ssym.sym = sym;
-    yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+    yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
     return NAME;
   }
 }
index b2287f2177d1a767f183304d61ccc4c39ed597b4..023db696a6c096f827b08e8760f7b7c02b4c5525 100644 (file)
@@ -243,7 +243,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
              struct symbol *wsym = (struct symbol *) NULL;
              struct type *wtype;
              struct block *block = (struct block *) NULL;
-             int is_this_fld;
+             struct field_of_this_result is_this_fld;
 
              if (want_space)
                fputs_filtered (" ", stream);
index 8e558e3228d6251dcd28e5da03d01de06acae813..fe12693c785114ddd4401b0138036e7d9efd0725 100644 (file)
@@ -692,7 +692,7 @@ write_dollar_variable (struct stoken str)
      have names beginning with $ or $$.  Check for those, first.  */
 
   sym = lookup_symbol (copy_name (str), (struct block *) NULL,
-                      VAR_DOMAIN, (int *) NULL);
+                      VAR_DOMAIN, NULL);
   if (sym)
     {
       write_exp_elt_opcode (OP_VAR_VALUE);
index 25b14e1ccb86a877092e2da46ba1c590d45c37b5..805d1ff5b2137fbbcdbaeea74ee58ccf654edf8a 100644 (file)
@@ -1199,8 +1199,7 @@ address_info (char *exp, int from_tty)
   long val;
   struct obj_section *section;
   CORE_ADDR load_addr, context_pc = 0;
-  int is_a_field_of_this;      /* C++: lookup_symbol sets this to nonzero
-                                  if exp is a field of `this'.  */
+  struct field_of_this_result is_a_field_of_this;
 
   if (exp == 0)
     error (_("Argument required."));
@@ -1209,7 +1208,7 @@ address_info (char *exp, int from_tty)
                       &is_a_field_of_this);
   if (sym == NULL)
     {
-      if (is_a_field_of_this)
+      if (is_a_field_of_this.type != NULL)
        {
          printf_filtered ("Symbol \"");
          fprintf_symbol_filtered (gdb_stdout, exp,
index 5cfd3ab2a4cb47de42120f03fc00c7b0cf378424..4f7ebee2e61da830eabd9549c7f888f0c6e11d9c 100644 (file)
@@ -354,7 +354,8 @@ sympy_dealloc (PyObject *obj)
 PyObject *
 gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
 {
-  int domain = VAR_DOMAIN, is_a_field_of_this = 0;
+  int domain = VAR_DOMAIN;
+  struct field_of_this_result is_a_field_of_this;
   const char *name;
   static char *keywords[] = { "name", "block", "domain", NULL };
   struct symbol *symbol = NULL;
@@ -407,7 +408,7 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
     }
   PyTuple_SET_ITEM (ret_tuple, 0, sym_obj);
 
-  bool_obj = is_a_field_of_this? Py_True : Py_False;
+  bool_obj = (is_a_field_of_this.type != NULL) ? Py_True : Py_False;
   Py_INCREF (bool_obj);
   PyTuple_SET_ITEM (ret_tuple, 1, bool_obj);
 
index 1de3454401c5c2667b421ac4744ae9381f8637e6..97f114fc34f331c46eb609ac15820161ca69a490 100644 (file)
@@ -82,7 +82,7 @@ static struct symbol *lookup_symbol_aux (const char *name,
                                         const struct block *block,
                                         const domain_enum domain,
                                         enum language language,
-                                        int *is_a_field_of_this);
+                                        struct field_of_this_result *is_a_field_of_this);
 
 static
 struct symbol *lookup_symbol_aux_local (const char *name,
@@ -1225,7 +1225,7 @@ demangle_for_lookup (const char *name, enum language lang,
 struct symbol *
 lookup_symbol_in_language (const char *name, const struct block *block,
                           const domain_enum domain, enum language lang,
-                          int *is_a_field_of_this)
+                          struct field_of_this_result *is_a_field_of_this)
 {
   const char *modified_name;
   struct symbol *returnval;
@@ -1243,7 +1243,8 @@ lookup_symbol_in_language (const char *name, const struct block *block,
 
 struct symbol *
 lookup_symbol (const char *name, const struct block *block,
-              domain_enum domain, int *is_a_field_of_this)
+              domain_enum domain,
+              struct field_of_this_result *is_a_field_of_this)
 {
   return lookup_symbol_in_language (name, block, domain,
                                    current_language->la_language,
@@ -1283,7 +1284,8 @@ lookup_language_this (const struct language_defn *lang,
    structure/union is defined, otherwise, return 0.  */
 
 static int
-check_field (struct type *type, const char *name)
+check_field (struct type *type, const char *name,
+            struct field_of_this_result *is_a_field_of_this)
 {
   int i;
 
@@ -1295,7 +1297,11 @@ check_field (struct type *type, const char *name)
       const char *t_field_name = TYPE_FIELD_NAME (type, i);
 
       if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
-       return 1;
+       {
+         is_a_field_of_this->type = type;
+         is_a_field_of_this->field = &TYPE_FIELD (type, i);
+         return 1;
+       }
     }
 
   /* C++: If it was not found as a data field, then try to return it
@@ -1304,11 +1310,15 @@ check_field (struct type *type, const char *name)
   for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; --i)
     {
       if (strcmp_iw (TYPE_FN_FIELDLIST_NAME (type, i), name) == 0)
-       return 1;
+       {
+         is_a_field_of_this->type = type;
+         is_a_field_of_this->fn_field = &TYPE_FN_FIELDLIST (type, i);
+         return 1;
+       }
     }
 
   for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--)
-    if (check_field (TYPE_BASECLASS (type, i), name))
+    if (check_field (TYPE_BASECLASS (type, i), name, is_a_field_of_this))
       return 1;
 
   return 0;
@@ -1320,18 +1330,17 @@ check_field (struct type *type, const char *name)
 static struct symbol *
 lookup_symbol_aux (const char *name, const struct block *block,
                   const domain_enum domain, enum language language,
-                  int *is_a_field_of_this)
+                  struct field_of_this_result *is_a_field_of_this)
 {
   struct symbol *sym;
   const struct language_defn *langdef;
 
   /* Make sure we do something sensible with is_a_field_of_this, since
      the callers that set this parameter to some non-null value will
-     certainly use it later and expect it to be either 0 or 1.
-     If we don't set it, the contents of is_a_field_of_this are
-     undefined.  */
+     certainly use it later.  If we don't set it, the contents of
+     is_a_field_of_this are undefined.  */
   if (is_a_field_of_this != NULL)
-    *is_a_field_of_this = 0;
+    memset (is_a_field_of_this, 0, sizeof (*is_a_field_of_this));
 
   /* Search specified block and its superiors.  Don't search
      STATIC_BLOCK or GLOBAL_BLOCK.  */
@@ -1365,11 +1374,8 @@ lookup_symbol_aux (const char *name, const struct block *block,
            error (_("Internal error: `%s' is not an aggregate"),
                   langdef->la_name_of_this);
 
-         if (check_field (t, name))
-           {
-             *is_a_field_of_this = 1;
-             return NULL;
-           }
+         if (check_field (t, name, is_a_field_of_this))
+           return NULL;
        }
     }
 
index a933132c0d13eb2f2d5cc6b0e5a131a7a4695ea7..6683cf5886df509b8f2b153b0fc0e899f8302f65 100644 (file)
@@ -919,19 +919,42 @@ int symbol_matches_domain (enum language symbol_language,
 
 extern struct symtab *lookup_symtab (const char *);
 
+/* An object of this type is passed as the 'is_a_field_of_this'
+   argument to lookup_symbol and lookup_symbol_in_language.  */
+
+struct field_of_this_result
+{
+  /* The type in which the field was found.  If this is NULL then the
+     symbol was not found in 'this'.  If non-NULL, then one of the
+     other fields will be non-NULL as well.  */
+
+  struct type *type;
+
+  /* If the symbol was found as an ordinary field of 'this', then this
+     is non-NULL and points to the particular field.  */
+
+  struct field *field;
+
+  /* If the symbol was found as an function field of 'this', then this
+     is non-NULL and points to the particular field.  */
+
+  struct fn_fieldlist *fn_field;
+};
+
 /* lookup a symbol by name (optional block) in language.  */
 
 extern struct symbol *lookup_symbol_in_language (const char *,
                                                 const struct block *,
                                                 const domain_enum,
                                                 enum language,
-                                                int *);
+                                                struct field_of_this_result *);
 
 /* lookup a symbol by name (optional block, optional symtab)
    in the current language.  */
 
 extern struct symbol *lookup_symbol (const char *, const struct block *,
-                                    const domain_enum, int *);
+                                    const domain_enum,
+                                    struct field_of_this_result *);
 
 /* A default version of lookup_symbol_nonlocal for use by languages
    that can't think of anything better to do.  */
This page took 0.043103 seconds and 4 git commands to generate.