Add target_ops argument to to_info_record
[deliverable/binutils-gdb.git] / gdb / c-exp.y
index fecfd152f1dedbdddca2f939f68a5737d6c57d5a..4704845e203efc45917df0d7e33a1751dda12806 100644 (file)
@@ -1,5 +1,5 @@
 /* YACC parser for C expressions, for GDB.
-   Copyright (C) 1986-2013 Free Software Foundation, Inc.
+   Copyright (C) 1986-2014 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -36,7 +36,7 @@
 %{
 
 #include "defs.h"
-#include "gdb_string.h"
+#include <string.h>
 #include <ctype.h>
 #include "expression.h"
 #include "value.h"
@@ -169,8 +169,10 @@ static struct stoken operator_stoken (const char *);
 static void check_parameter_typelist (VEC (type_ptr) *);
 static void write_destructor_name (struct stoken);
 
+#ifdef YYBISON
 static void c_print_token (FILE *file, int type, YYSTYPE value);
 #define YYPRINT(FILE, TYPE, VALUE) c_print_token (FILE, TYPE, VALUE)
+#endif
 %}
 
 %type <voidval> exp exp1 type_exp start variable qualified_name lcurly
@@ -2960,13 +2962,39 @@ classify_inner_name (const struct block *block, struct type *context)
 
   copy = copy_name (yylval.ssym.stoken);
   yylval.ssym.sym = cp_lookup_nested_symbol (type, copy, block);
+
+  /* If no symbol was found, search for a matching base class named
+     COPY.  This will allow users to enter qualified names of class members
+     relative to the `this' pointer.  */
   if (yylval.ssym.sym == NULL)
-    return ERROR;
+    {
+      struct type *base_type = find_type_baseclass_by_name (type, copy);
+
+      if (base_type != NULL)
+       {
+         yylval.tsym.type = base_type;
+         return TYPENAME;
+       }
+
+      return ERROR;
+    }
 
   switch (SYMBOL_CLASS (yylval.ssym.sym))
     {
     case LOC_BLOCK:
     case LOC_LABEL:
+      /* cp_lookup_nested_symbol might have accidentally found a constructor
+        named COPY when we really wanted a base class of the same name.
+        Double-check this case by looking for a base class.  */
+      {
+       struct type *base_type = find_type_baseclass_by_name (type, copy);
+
+       if (base_type != NULL)
+         {
+           yylval.tsym.type = base_type;
+           return TYPENAME;
+         }
+      }
       return ERROR;
 
     case LOC_TYPEDEF:
@@ -3175,6 +3203,8 @@ c_parse (void)
   return result;
 }
 
+#ifdef YYBISON
+
 /* This is called via the YYPRINT macro when parser debugging is
    enabled.  It prints a token's value.  */
 
@@ -3229,6 +3259,8 @@ c_print_token (FILE *file, int type, YYSTYPE value)
     }
 }
 
+#endif
+
 void
 yyerror (char *msg)
 {
This page took 0.024126 seconds and 4 git commands to generate.