struct type_stack *type_stack;
- struct objc_class_str class;
+ struct objc_class_str theclass;
}
%{
%token <ssym> UNKNOWN_CPP_NAME
%token <voidval> COMPLETE
%token <tsym> TYPENAME
-%token <class> CLASSNAME /* ObjC Class name */
+%token <theclass> CLASSNAME /* ObjC Class name */
%type <sval> name
%type <svec> string_exp
%type <ssym> name_not_typename
-%type <tsym> typename
+%type <tsym> type_name
/* This is like a '[' token, but is only generated when parsing
Objective C. This lets us reuse the same parser without
%token TEMPLATE
%token ERROR
%token NEW DELETE
-%type <sval> operator
+%type <sval> oper
%token REINTERPRET_CAST DYNAMIC_CAST STATIC_CAST CONST_CAST
%token ENTRY
%token TYPEOF
exp : OBJC_LBRAC TYPENAME
{
- CORE_ADDR class;
+ CORE_ADDR theclass;
- class = lookup_objc_class (parse_gdbarch (pstate),
+ theclass = lookup_objc_class (parse_gdbarch (pstate),
copy_name ($2.stoken));
- if (class == 0)
+ if (theclass == 0)
error (_("%s is not an ObjC Class"),
copy_name ($2.stoken));
write_exp_elt_opcode (pstate, OP_LONG);
write_exp_elt_type (pstate,
parse_type (pstate)->builtin_int);
- write_exp_elt_longcst (pstate, (LONGEST) class);
+ write_exp_elt_longcst (pstate, (LONGEST) theclass);
write_exp_elt_opcode (pstate, OP_LONG);
start_msglist();
}
write_exp_elt_opcode (pstate, OP_LONG);
write_exp_elt_type (pstate,
parse_type (pstate)->builtin_int);
- write_exp_elt_longcst (pstate, (LONGEST) $2.class);
+ write_exp_elt_longcst (pstate, (LONGEST) $2.theclass);
write_exp_elt_opcode (pstate, OP_LONG);
start_msglist();
}
(parse_language (pstate),
parse_gdbarch (pstate),
"int"));
- CHECK_TYPEDEF (type);
+ type = check_typedef (type);
/* $5.3.3/2 of the C++ Standard (n3290 draft)
says of sizeof: "When applied to a reference
if (type != C_STRING
&& type != $1.tokens[i].type)
error (_("Undefined string concatenation."));
- type = $1.tokens[i].type;
+ type = (enum c_string_type) $1.tokens[i].type;
break;
default:
/* internal error */
block : BLOCKNAME
{
- if ($1.sym)
- $$ = SYMBOL_BLOCK_VALUE ($1.sym);
+ if ($1.sym.symbol)
+ $$ = SYMBOL_BLOCK_VALUE ($1.sym.symbol);
else
error (_("No file or function \"%s\"."),
copy_name ($1.stoken));
block : block COLONCOLON name
{ struct symbol *tem
= lookup_symbol (copy_name ($3), $1,
- VAR_DOMAIN, NULL);
+ VAR_DOMAIN, NULL).symbol;
+
if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
error (_("No function \"%s\" in specified context."),
copy_name ($3));
;
variable: name_not_typename ENTRY
- { struct symbol *sym = $1.sym;
+ { struct symbol *sym = $1.sym.symbol;
if (sym == NULL || !SYMBOL_IS_ARGUMENT (sym)
|| !symbol_read_needs_frame (sym))
;
variable: block COLONCOLON name
- { struct symbol *sym;
- sym = lookup_symbol (copy_name ($3), $1,
- VAR_DOMAIN, NULL);
- if (sym == 0)
+ { struct block_symbol sym
+ = lookup_symbol (copy_name ($3), $1,
+ VAR_DOMAIN, NULL);
+
+ if (sym.symbol == 0)
error (_("No symbol \"%s\" in specified context."),
copy_name ($3));
- if (symbol_read_needs_frame (sym))
+ if (symbol_read_needs_frame (sym.symbol))
{
if (innermost_block == 0
- || contained_in (block_found,
+ || contained_in (sym.block,
innermost_block))
- innermost_block = block_found;
+ innermost_block = sym.block;
}
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
- /* block_found is set by lookup_symbol. */
- write_exp_elt_block (pstate, block_found);
- write_exp_elt_sym (pstate, sym);
+ write_exp_elt_block (pstate, sym.block);
+ write_exp_elt_sym (pstate, sym.symbol);
write_exp_elt_opcode (pstate, OP_VAR_VALUE); }
;
qualified_name: TYPENAME COLONCOLON name
{
struct type *type = $1.type;
- CHECK_TYPEDEF (type);
+ type = check_typedef (type);
if (!type_aggregate_p (type))
error (_("`%s' is not defined as an aggregate type."),
TYPE_SAFE_NAME (type));
struct stoken tmp_token;
char *buf;
- CHECK_TYPEDEF (type);
+ type = check_typedef (type);
if (!type_aggregate_p (type))
error (_("`%s' is not defined as an aggregate type."),
TYPE_SAFE_NAME (type));
struct symbol *sym;
struct bound_minimal_symbol msymbol;
- sym =
- lookup_symbol (name, (const struct block *) NULL,
- VAR_DOMAIN, NULL);
+ sym
+ = lookup_symbol (name, (const struct block *) NULL,
+ VAR_DOMAIN, NULL).symbol;
if (sym)
{
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
;
variable: name_not_typename
- { struct symbol *sym = $1.sym;
+ { struct block_symbol sym = $1.sym;
- if (sym)
+ if (sym.symbol)
{
- if (symbol_read_needs_frame (sym))
+ if (symbol_read_needs_frame (sym.symbol))
{
if (innermost_block == 0
- || contained_in (block_found,
+ || contained_in (sym.block,
innermost_block))
- innermost_block = block_found;
+ innermost_block = sym.block;
}
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
- /* We want to use the selected frame, not
- another more inner frame which happens to
- be in the same block. */
- write_exp_elt_block (pstate, NULL);
- write_exp_elt_sym (pstate, sym);
+ write_exp_elt_block (pstate, sym.block);
+ write_exp_elt_sym (pstate, sym.symbol);
write_exp_elt_opcode (pstate, OP_VAR_VALUE);
}
else if ($1.is_a_field_of_this)
not inadvertently convert from a method call
to data ref. */
if (innermost_block == 0
- || contained_in (block_found,
+ || contained_in (sym.block,
innermost_block))
- innermost_block = block_found;
+ innermost_block = sym.block;
write_exp_elt_opcode (pstate, OP_THIS);
write_exp_elt_opcode (pstate, OP_THIS);
write_exp_elt_opcode (pstate, STRUCTOP_PTR);
$2.length);
$$ = NULL;
}
- | UNSIGNED typename
+ | UNSIGNED type_name
{ $$ = lookup_unsigned_typename (parse_language (pstate),
parse_gdbarch (pstate),
TYPE_NAME($2.type)); }
{ $$ = lookup_unsigned_typename (parse_language (pstate),
parse_gdbarch (pstate),
"int"); }
- | SIGNED_KEYWORD typename
+ | SIGNED_KEYWORD type_name
{ $$ = lookup_signed_typename (parse_language (pstate),
parse_gdbarch (pstate),
TYPE_NAME($2.type)); }
{ $$ = follow_types ($1); }
;
-typename: TYPENAME
+type_name: TYPENAME
| INT_KEYWORD
{
$$.stoken.ptr = "int";
{ insert_type (tp_volatile); }
;
-operator: OPERATOR NEW
+oper: OPERATOR NEW
{ $$ = operator_stoken (" new"); }
| OPERATOR DELETE
{ $$ = operator_stoken (" delete"); }
| TYPENAME { $$ = $1.stoken; }
| NAME_OR_INT { $$ = $1.stoken; }
| UNKNOWN_CPP_NAME { $$ = $1.stoken; }
- | operator { $$ = $1; }
+ | oper { $$ = $1; }
;
name_not_typename : NAME
context where only a name could occur, this might be useful.
| NAME_OR_INT
*/
- | operator
+ | oper
{
struct field_of_this_result is_a_field_of_this;
struct token
{
- char *operator;
+ char *oper;
int token;
enum exp_opcode opcode;
enum token_flags flags;
tokstart = lexptr;
/* See if it is a special token of length 3. */
for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
- if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
+ if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
{
if ((tokentab3[i].flags & FLAG_CXX) != 0
&& parse_language (par_state)->la_language != language_cplus)
/* See if it is a special token of length 2. */
for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
- if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
+ if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
{
if ((tokentab2[i].flags & FLAG_CXX) != 0
&& parse_language (par_state)->la_language != language_cplus)
/* Catch specific keywords. */
copy = copy_name (yylval.sval);
for (i = 0; i < sizeof ident_tokens / sizeof ident_tokens[0]; i++)
- if (strcmp (copy, ident_tokens[i].operator) == 0)
+ if (strcmp (copy, ident_tokens[i].oper) == 0)
{
if ((ident_tokens[i].flags & FLAG_CXX) != 0
&& parse_language (par_state)->la_language != language_cplus)
VAR_DOMAIN,
(parse_language (par_state)->la_language
== language_cplus ? &is_a_field_of_this
- : NULL))
+ : NULL)).symbol
!= NULL)
{
/* The keyword is shadowed. */
saw_name_at_eof = 1;
yylval.ssym.stoken = yylval.sval;
- yylval.ssym.sym = NULL;
+ yylval.ssym.sym.symbol = NULL;
+ yylval.ssym.sym.block = NULL;
yylval.ssym.is_a_field_of_this = 0;
return NAME;
}
classify_name (struct parser_state *par_state, const struct block *block,
int is_quoted_name)
{
- struct symbol *sym;
+ struct block_symbol bsym;
char *copy;
struct field_of_this_result is_a_field_of_this;
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 (par_state)->la_name_of_this
- ? &is_a_field_of_this : NULL);
+ bsym = lookup_symbol (copy, block, VAR_DOMAIN,
+ parse_language (par_state)->la_name_of_this
+ ? &is_a_field_of_this : NULL);
- if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
+ if (bsym.symbol && SYMBOL_CLASS (bsym.symbol) == LOC_BLOCK)
{
- yylval.ssym.sym = sym;
+ yylval.ssym.sym = bsym;
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
return BLOCKNAME;
}
- else if (!sym)
+ else if (!bsym.symbol)
{
/* If we found a field of 'this', we might have erroneously
found a constructor where we wanted a type name. Handle this
{
struct field_of_this_result inner_is_a_field_of_this;
- sym = lookup_symbol (copy, block, STRUCT_DOMAIN,
- &inner_is_a_field_of_this);
- if (sym != NULL)
+ bsym = lookup_symbol (copy, block, STRUCT_DOMAIN,
+ &inner_is_a_field_of_this);
+ if (bsym.symbol != NULL)
{
- yylval.tsym.type = SYMBOL_TYPE (sym);
+ yylval.tsym.type = SYMBOL_TYPE (bsym.symbol);
return TYPENAME;
}
}
}
}
- if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
+ if (bsym.symbol && SYMBOL_CLASS (bsym.symbol) == LOC_TYPEDEF)
{
- yylval.tsym.type = SYMBOL_TYPE (sym);
+ yylval.tsym.type = SYMBOL_TYPE (bsym.symbol);
return TYPENAME;
}
/* See if it's an ObjC classname. */
- if (parse_language (par_state)->la_language == language_objc && !sym)
+ if (parse_language (par_state)->la_language == language_objc && !bsym.symbol)
{
CORE_ADDR Class = lookup_objc_class (parse_gdbarch (par_state), copy);
if (Class)
{
- yylval.class.class = Class;
+ struct symbol *sym;
+
+ yylval.theclass.theclass = Class;
sym = lookup_struct_typedef (copy, expression_context_block, 1);
if (sym)
- yylval.class.type = SYMBOL_TYPE (sym);
+ yylval.theclass.type = SYMBOL_TYPE (sym);
return CLASSNAME;
}
}
/* Input names that aren't symbols but ARE valid hex numbers, when
the input radix permits them, can be names or numbers depending
on the parse. Note we support radixes > 16 here. */
- if (!sym
+ if (!bsym.symbol
&& ((copy[0] >= 'a' && copy[0] < 'a' + input_radix - 10)
|| (copy[0] >= 'A' && copy[0] < 'A' + input_radix - 10)))
{
YYSTYPE newlval; /* Its value is ignored. */
int hextype = parse_number (par_state, copy, yylval.sval.length,
0, &newlval);
+
if (hextype == INT)
{
- yylval.ssym.sym = sym;
+ yylval.ssym.sym = bsym;
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.sym = bsym;
yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
- if (sym == NULL
+ if (bsym.symbol == NULL
&& parse_language (par_state)->la_language == language_cplus
&& is_a_field_of_this.type == NULL
&& lookup_minimal_symbol (copy, NULL, NULL).minsym == NULL)
return ERROR;
copy = copy_name (yylval.ssym.stoken);
- yylval.ssym.sym = cp_lookup_nested_symbol (type, copy, block);
+ /* N.B. We assume the symbol can only be in VAR_DOMAIN. */
+ yylval.ssym.sym = cp_lookup_nested_symbol (type, copy, block, VAR_DOMAIN);
/* 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)
+ if (yylval.ssym.sym.symbol == NULL)
{
struct type *base_type = cp_find_type_baseclass_by_name (type, copy);
return ERROR;
}
- switch (SYMBOL_CLASS (yylval.ssym.sym))
+ switch (SYMBOL_CLASS (yylval.ssym.sym.symbol))
{
case LOC_BLOCK:
case LOC_LABEL:
return ERROR;
case LOC_TYPEDEF:
- yylval.tsym.type = SYMBOL_TYPE (yylval.ssym.sym);
+ yylval.tsym.type = SYMBOL_TYPE (yylval.ssym.sym.symbol);
return TYPENAME;
default:
case BLOCKNAME:
fprintf (file, "ssym<name=%s, sym=%s, field_of_this=%d>",
copy_name (value.ssym.stoken),
- (value.ssym.sym == NULL
- ? "(null)" : SYMBOL_PRINT_NAME (value.ssym.sym)),
+ (value.ssym.sym.symbol == NULL
+ ? "(null)" : SYMBOL_PRINT_NAME (value.ssym.sym.symbol)),
value.ssym.is_a_field_of_this);
break;