aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-exp.y
diff options
context:
space:
mode:
authorSami Wagiaalla <swagiaal@redhat.com>2010-05-07 14:46:28 +0000
committerSami Wagiaalla <swagiaal@redhat.com>2010-05-07 14:46:28 +0000
commit7322dca9c16dfce7e9019240ac21037f2a4d6cb7 (patch)
tree15ef1ee23eb0d09d802c4f8fc1424b430d2a76f8 /gdb/c-exp.y
parent3f1f688424574eaba15256ec436b564a8e2e8c20 (diff)
downloadfsf-binutils-gdb-7322dca9c16dfce7e9019240ac21037f2a4d6cb7.zip
fsf-binutils-gdb-7322dca9c16dfce7e9019240ac21037f2a4d6cb7.tar.gz
fsf-binutils-gdb-7322dca9c16dfce7e9019240ac21037f2a4d6cb7.tar.bz2
Add ADL support
2010-05-07 Sami Wagiaalla <swagiaal@redhat.com> PR C++/7943: * valops.c (find_overload_match): Handle fsym == NULL case. Add int no_adl argument. (find_oload_champ_namespace_loop): Call make_symbol_overload_list_adl when appropriate. Add int no_adl argument. (find_oload_champ_namespace): Add int no_adl argument. * parse.c (operator_length_standard): Return length for OP_ADL_FUNC expression. * expprint.c (op_name_standard): Added string for OP_ADL_FUNC case. * eval.c (evaluate_subexp_standard): Added OP_ADL_FUNC case. Evaluate arguments and use them to perform ADL lookup. Pass no_adl argument to find_overload_match. Disable adl lookup when evaluating a fully qualified OP_FUNCALL. * cp-support.h: Added prototype for make_symbol_overload_list_namespace. * cp-support.c (make_symbol_overload_list_namespace): New function. (make_symbol_overload_list_adl_namespace): New function. (make_symbol_overload_list_adl): New function. (make_symbol_overload_list_using): Moved code to add function to overload set to make_symbol_overload_list_namespace. * c-exp.y: create UNKNOWN_CPP_NAME token. Add parse rule for ADL functions. (classify_name): Recognize an UNKNOWN_CPP_NAME. 2010-05-07 Sami Wagiaalla <swagiaal@redhat.com> * gdb.cp/koenig.exp: New test. * gdb.cp/koenig.cc: New test program.
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r--gdb/c-exp.y32
1 files changed, 32 insertions, 0 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 44fa690..4db4103 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -186,6 +186,7 @@ static struct stoken operator_stoken (const char *);
%token <tsval> STRING
%token <tsval> CHAR
%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */
+%token <ssym> UNKNOWN_CPP_NAME
%token <voidval> COMPLETE
%token <tsym> TYPENAME
%type <sval> name
@@ -391,6 +392,29 @@ exp : exp '('
write_exp_elt_opcode (OP_FUNCALL); }
;
+exp : UNKNOWN_CPP_NAME '('
+ {
+ /* This could potentially be a an argument defined
+ lookup function (Koenig). */
+ write_exp_elt_opcode (OP_ADL_FUNC);
+ write_exp_elt_block (expression_context_block);
+ write_exp_elt_sym (NULL); /* Placeholder. */
+ write_exp_string ($1.stoken);
+ write_exp_elt_opcode (OP_ADL_FUNC);
+
+ /* This is to save the value of arglist_len
+ being accumulated by an outer function call. */
+
+ start_arglist ();
+ }
+ arglist ')' %prec ARROW
+ {
+ write_exp_elt_opcode (OP_FUNCALL);
+ write_exp_elt_longcst ((LONGEST) end_arglist ());
+ write_exp_elt_opcode (OP_FUNCALL);
+ }
+ ;
+
lcurly : '{'
{ start_arglist (); }
;
@@ -1224,6 +1248,7 @@ name : NAME { $$ = $1.stoken; }
| BLOCKNAME { $$ = $1.stoken; }
| TYPENAME { $$ = $1.stoken; }
| NAME_OR_INT { $$ = $1.stoken; }
+ | UNKNOWN_CPP_NAME { $$ = $1.stoken; }
| operator { $$ = $1; }
;
@@ -1244,6 +1269,7 @@ name_not_typename : NAME
VAR_DOMAIN,
&$$.is_a_field_of_this);
}
+ | UNKNOWN_CPP_NAME
;
%%
@@ -2387,6 +2413,12 @@ classify_name (struct block *block)
/* Any other kind of symbol */
yylval.ssym.sym = sym;
yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+
+ if (sym == NULL
+ && parse_language->la_language == language_cplus
+ && !lookup_minimal_symbol (copy, NULL, NULL))
+ return UNKNOWN_CPP_NAME;
+
return NAME;
}