diff options
author | Jason Merrill <jason@redhat.com> | 2009-03-17 19:31:18 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2009-03-17 19:31:18 -0400 |
commit | 448545cb51bdf3d74c3d75f3b88dbf8c7a8de984 (patch) | |
tree | a0bf6190acd7e4997d3304c4bfe60c3c1b461532 /gcc/cp/decl2.c | |
parent | 0075846f90cb2f586f7600d1dd1d522de9dbc00f (diff) | |
download | gcc-448545cb51bdf3d74c3d75f3b88dbf8c7a8de984.zip gcc-448545cb51bdf3d74c3d75f3b88dbf8c7a8de984.tar.gz gcc-448545cb51bdf3d74c3d75f3b88dbf8c7a8de984.tar.bz2 |
decl.c (grokfndecl): Set DECL_CONTEXT on parms.
cp/:
* decl.c (grokfndecl): Set DECL_CONTEXT on parms.
(duplicate_decls): Adjust DECL_CONTEXT of newdecl's parms.
* pt.c (check_explicit_specialization): Likewise.
(tsubst_copy) [PARM_DECL]: Return a dummy parm if we don't have a
local specialization.
* tree.c (cp_tree_equal) [PARM_DECL]: Check type and index, not name.
* decl2.c (parm_index): New fn.
* semantics.c (finish_decltype_type): Don't use describable_type.
* mangle.c (write_expression): Likewise. Mangle ALIGNOF_EXPR.
Give a sorry for unsupported codes rather than crash. Mangle
conversions with other than 1 operand. New mangling for PARM_DECL.
* operators.def (ALIGNOF_EXPR): Mangle as az.
* include/demangle.h (enum demangle_component_type): Add
DEMANGLE_COMPONENT_FUNCTION_PARAM.
* libiberty/cp-demangle.c (d_make_function_param): new fn.
(cplus_demangle_mangled_name): Work around abi v2 bug.
(d_expr_primary): Likewise.
(cplus_demangle_operators): Add alignof ops.
(d_expression): Handle function parameters and conversions
with other than 1 operand.
(d_print_comp): Handle function parameters. Fix bug with
function used in type of function.
From-SVN: r144924
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index d570150..deba8b4 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3907,4 +3907,27 @@ mark_used (tree decl) processing_template_decl = saved_processing_template_decl; } +/* Given function PARM_DECL PARM, return its index in the function's list + of parameters, beginning with 1. */ + +int +parm_index (tree parm) +{ + int index; + tree arg; + + for (index = 1, arg = DECL_ARGUMENTS (DECL_CONTEXT (parm)); + arg; + ++index, arg = TREE_CHAIN (arg)) + { + if (DECL_NAME (parm) == DECL_NAME (arg)) + break; + if (DECL_ARTIFICIAL (arg)) + --index; + } + + gcc_assert (arg); + return index; +} + #include "gt-cp-decl2.h" |