cp-tree.h (build_this_parm, [...]): Add FN parm.
gcc/cp/ * cp-tree.h (build_this_parm, cp_build_parm_decl) build_artificial_parm): Add FN parm. * decl.c (start_cleanup_fn): Adjust. (build_this_parm): Add FN parm, pass it through. (grokfndecl): Adjust parm building. * decl2.c (cp_build_parm_decl): Add FN parm, set context. (build_artificial_parm): Add FN parm, pass through. (maybe_retrofit_in_chrg): Adjust parm building. (start_static_storage_duration_function): Likwise. * lambda.c (maybe_aadd_lambda_conv_op): Likewise. * method.c (implicitly_declare_fn): Likewise. * parser.c (inject_this_parameter): Likewise. libcc1/ * libcp1plugin.cc (plugin_build_decl): Adjust parm building. (--This line, and those below, will be ignored-- M gcc/cp/parser.c M gcc/cp/ChangeLog M gcc/cp/decl.c M gcc/cp/lambda.c M gcc/cp/cp-tree.h M gcc/cp/method.c M gcc/cp/decl2.c M libcc1/libcp1plugin.cc M libcc1/ChangeLog From-SVN: r249268
This commit is contained in:
parent
78a8b676f1
commit
e249fcad3a
9 changed files with 47 additions and 33 deletions
|
@ -1,5 +1,18 @@
|
|||
2017-06-16 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
* cp-tree.h (build_this_parm, cp_build_parm_decl,
|
||||
build_artificial_parm): Add FN parm.
|
||||
* decl.c (start_cleanup_fn): Adjust.
|
||||
(build_this_parm): Add FN parm, pass it through.
|
||||
(grokfndecl): Adjust parm building.
|
||||
* decl2.c (cp_build_parm_decl): Add FN parm, set context.
|
||||
(build_artificial_parm): Add FN parm, pass through.
|
||||
(maybe_retrofit_in_chrg): Adjust parm building.
|
||||
(start_static_storage_duration_function): Likwise.
|
||||
* lambda.c (maybe_aadd_lambda_conv_op): Likewise.
|
||||
* method.c (implicitly_declare_fn): Likewise.
|
||||
* parser.c (inject_this_parameter): Likewise.
|
||||
|
||||
Symbol tables are insert only.
|
||||
* cp-tree.h (default_hash_traits <lang_identifier *>): Don't
|
||||
derive from pointer_hash. Make undeletable.
|
||||
|
|
|
@ -6078,7 +6078,7 @@ extern int cp_complete_array_type_or_error (tree *, tree, bool, tsubst_flags_t);
|
|||
extern tree build_ptrmemfunc_type (tree);
|
||||
extern tree build_ptrmem_type (tree, tree);
|
||||
/* the grokdeclarator prototype is in decl.h */
|
||||
extern tree build_this_parm (tree, cp_cv_quals);
|
||||
extern tree build_this_parm (tree, tree, cp_cv_quals);
|
||||
extern tree grokparms (tree, tree *);
|
||||
extern int copy_fn_p (const_tree);
|
||||
extern bool move_fn_p (const_tree);
|
||||
|
@ -6179,7 +6179,7 @@ extern void check_default_args (tree);
|
|||
extern bool mark_used (tree);
|
||||
extern bool mark_used (tree, tsubst_flags_t);
|
||||
extern void finish_static_data_member_decl (tree, tree, bool, tree, int);
|
||||
extern tree cp_build_parm_decl (tree, tree);
|
||||
extern tree cp_build_parm_decl (tree, tree, tree);
|
||||
extern tree get_guard (tree);
|
||||
extern tree get_guard_cond (tree, bool);
|
||||
extern tree set_guard (tree);
|
||||
|
@ -6188,7 +6188,7 @@ extern void mark_needed (tree);
|
|||
extern bool decl_needed_p (tree);
|
||||
extern void note_vague_linkage_fn (tree);
|
||||
extern void note_variable_template_instantiation (tree);
|
||||
extern tree build_artificial_parm (tree, tree);
|
||||
extern tree build_artificial_parm (tree, tree, tree);
|
||||
extern bool possibly_inlined_p (tree);
|
||||
extern int parm_index (tree);
|
||||
extern tree vtv_start_verification_constructor_init_function (void);
|
||||
|
|
|
@ -7823,10 +7823,7 @@ start_cleanup_fn (void)
|
|||
/* Build the parameter. */
|
||||
if (use_cxa_atexit)
|
||||
{
|
||||
tree parmdecl;
|
||||
|
||||
parmdecl = cp_build_parm_decl (NULL_TREE, ptr_type_node);
|
||||
DECL_CONTEXT (parmdecl) = fndecl;
|
||||
tree parmdecl = cp_build_parm_decl (fndecl, NULL_TREE, ptr_type_node);
|
||||
TREE_USED (parmdecl) = 1;
|
||||
DECL_READ_P (parmdecl) = 1;
|
||||
DECL_ARGUMENTS (fndecl) = parmdecl;
|
||||
|
@ -8367,12 +8364,12 @@ check_class_member_definition_namespace (tree decl)
|
|||
decl, DECL_CONTEXT (decl));
|
||||
}
|
||||
|
||||
/* Build a PARM_DECL for the "this" parameter. TYPE is the
|
||||
/* Build a PARM_DECL for the "this" parameter of FN. TYPE is the
|
||||
METHOD_TYPE for a non-static member function; QUALS are the
|
||||
cv-qualifiers that apply to the function. */
|
||||
|
||||
tree
|
||||
build_this_parm (tree type, cp_cv_quals quals)
|
||||
build_this_parm (tree fn, tree type, cp_cv_quals quals)
|
||||
{
|
||||
tree this_type;
|
||||
tree qual_type;
|
||||
|
@ -8391,7 +8388,7 @@ build_this_parm (tree type, cp_cv_quals quals)
|
|||
assigned to. */
|
||||
this_quals = (quals & TYPE_QUAL_RESTRICT) | TYPE_QUAL_CONST;
|
||||
qual_type = cp_build_qualified_type (this_type, this_quals);
|
||||
parm = build_artificial_parm (this_identifier, qual_type);
|
||||
parm = build_artificial_parm (fn, this_identifier, qual_type);
|
||||
cp_apply_type_quals_to_decl (this_quals, parm);
|
||||
return parm;
|
||||
}
|
||||
|
@ -8525,8 +8522,7 @@ grokfndecl (tree ctype,
|
|||
|
||||
if (TREE_CODE (type) == METHOD_TYPE)
|
||||
{
|
||||
tree parm;
|
||||
parm = build_this_parm (type, quals);
|
||||
tree parm = build_this_parm (decl, type, quals);
|
||||
DECL_CHAIN (parm) = parms;
|
||||
parms = parm;
|
||||
|
||||
|
@ -11625,7 +11621,8 @@ grokdeclarator (const cp_declarator *declarator,
|
|||
args && args != void_list_node;
|
||||
args = TREE_CHAIN (args))
|
||||
{
|
||||
tree decl = cp_build_parm_decl (NULL_TREE, TREE_VALUE (args));
|
||||
tree decl = cp_build_parm_decl (NULL_TREE, NULL_TREE,
|
||||
TREE_VALUE (args));
|
||||
|
||||
DECL_CHAIN (decl) = decls;
|
||||
decls = decl;
|
||||
|
@ -11794,7 +11791,7 @@ grokdeclarator (const cp_declarator *declarator,
|
|||
|
||||
if (decl_context == PARM)
|
||||
{
|
||||
decl = cp_build_parm_decl (unqualified_id, type);
|
||||
decl = cp_build_parm_decl (NULL_TREE, unqualified_id, type);
|
||||
DECL_ARRAY_PARAMETER_P (decl) = array_parameter_p;
|
||||
|
||||
bad_specifiers (decl, BSP_PARM, virtualp,
|
||||
|
|
|
@ -192,14 +192,16 @@ change_return_type (tree new_ret, tree fntype)
|
|||
return newtype;
|
||||
}
|
||||
|
||||
/* Build a PARM_DECL with NAME and TYPE, and set DECL_ARG_TYPE
|
||||
/* Build a PARM_DECL of FN with NAME and TYPE, and set DECL_ARG_TYPE
|
||||
appropriately. */
|
||||
|
||||
tree
|
||||
cp_build_parm_decl (tree name, tree type)
|
||||
cp_build_parm_decl (tree fn, tree name, tree type)
|
||||
{
|
||||
tree parm = build_decl (input_location,
|
||||
PARM_DECL, name, type);
|
||||
DECL_CONTEXT (parm) = fn;
|
||||
|
||||
/* DECL_ARG_TYPE is only used by the back end and the back end never
|
||||
sees templates. */
|
||||
if (!processing_template_decl)
|
||||
|
@ -208,13 +210,13 @@ cp_build_parm_decl (tree name, tree type)
|
|||
return parm;
|
||||
}
|
||||
|
||||
/* Returns a PARM_DECL for a parameter of the indicated TYPE, with the
|
||||
/* Returns a PARM_DECL of FN for a parameter of the indicated TYPE, with the
|
||||
indicated NAME. */
|
||||
|
||||
tree
|
||||
build_artificial_parm (tree name, tree type)
|
||||
build_artificial_parm (tree fn, tree name, tree type)
|
||||
{
|
||||
tree parm = cp_build_parm_decl (name, type);
|
||||
tree parm = cp_build_parm_decl (fn, name, type);
|
||||
DECL_ARTIFICIAL (parm) = 1;
|
||||
/* All our artificial parms are implicitly `const'; they cannot be
|
||||
assigned to. */
|
||||
|
@ -265,7 +267,7 @@ maybe_retrofit_in_chrg (tree fn)
|
|||
pass us a pointer to our VTT. */
|
||||
if (CLASSTYPE_VBASECLASSES (DECL_CONTEXT (fn)))
|
||||
{
|
||||
parm = build_artificial_parm (vtt_parm_identifier, vtt_parm_type);
|
||||
parm = build_artificial_parm (fn, vtt_parm_identifier, vtt_parm_type);
|
||||
|
||||
/* First add it to DECL_ARGUMENTS between 'this' and the real args... */
|
||||
DECL_CHAIN (parm) = parms;
|
||||
|
@ -278,7 +280,7 @@ maybe_retrofit_in_chrg (tree fn)
|
|||
}
|
||||
|
||||
/* Then add the in-charge parm (before the VTT parm). */
|
||||
parm = build_artificial_parm (in_charge_identifier, integer_type_node);
|
||||
parm = build_artificial_parm (fn, in_charge_identifier, integer_type_node);
|
||||
DECL_CHAIN (parm) = parms;
|
||||
parms = parm;
|
||||
arg_types = hash_tree_chain (integer_type_node, arg_types);
|
||||
|
@ -3502,12 +3504,10 @@ start_static_storage_duration_function (unsigned count)
|
|||
|
||||
/* Create the argument list. */
|
||||
initialize_p_decl = cp_build_parm_decl
|
||||
(get_identifier (INITIALIZE_P_IDENTIFIER), integer_type_node);
|
||||
DECL_CONTEXT (initialize_p_decl) = ssdf_decl;
|
||||
(ssdf_decl, get_identifier (INITIALIZE_P_IDENTIFIER), integer_type_node);
|
||||
TREE_USED (initialize_p_decl) = 1;
|
||||
priority_decl = cp_build_parm_decl
|
||||
(get_identifier (PRIORITY_IDENTIFIER), integer_type_node);
|
||||
DECL_CONTEXT (priority_decl) = ssdf_decl;
|
||||
(ssdf_decl, get_identifier (PRIORITY_IDENTIFIER), integer_type_node);
|
||||
TREE_USED (priority_decl) = 1;
|
||||
|
||||
DECL_CHAIN (initialize_p_decl) = priority_decl;
|
||||
|
|
|
@ -1102,7 +1102,8 @@ maybe_add_lambda_conv_op (tree type)
|
|||
DECL_ARTIFICIAL (fn) = 1;
|
||||
DECL_NOT_REALLY_EXTERN (fn) = 1;
|
||||
DECL_DECLARED_INLINE_P (fn) = 1;
|
||||
DECL_ARGUMENTS (fn) = build_this_parm (fntype, TYPE_QUAL_CONST);
|
||||
DECL_ARGUMENTS (fn) = build_this_parm (fn, fntype, TYPE_QUAL_CONST);
|
||||
|
||||
if (nested_def)
|
||||
DECL_INTERFACE_KNOWN (fn) = 1;
|
||||
|
||||
|
|
|
@ -2072,7 +2072,7 @@ implicitly_declare_fn (special_function_kind kind, tree type,
|
|||
/* Note that this parameter is *not* marked DECL_ARTIFICIAL; we
|
||||
want its type to be included in the mangled function
|
||||
name. */
|
||||
tree decl = cp_build_parm_decl (NULL_TREE, rhs_parm_type);
|
||||
tree decl = cp_build_parm_decl (fn, NULL_TREE, rhs_parm_type);
|
||||
TREE_READONLY (decl) = 1;
|
||||
retrofit_lang_decl (decl);
|
||||
DECL_PARM_INDEX (decl) = DECL_PARM_LEVEL (decl) = 1;
|
||||
|
@ -2085,11 +2085,10 @@ implicitly_declare_fn (special_function_kind kind, tree type,
|
|||
for (tree parm = inherited_parms; parm && parm != void_list_node;
|
||||
parm = TREE_CHAIN (parm))
|
||||
{
|
||||
*p = cp_build_parm_decl (NULL_TREE, TREE_VALUE (parm));
|
||||
*p = cp_build_parm_decl (fn, NULL_TREE, TREE_VALUE (parm));
|
||||
retrofit_lang_decl (*p);
|
||||
DECL_PARM_LEVEL (*p) = 1;
|
||||
DECL_PARM_INDEX (*p) = index++;
|
||||
DECL_CONTEXT (*p) = fn;
|
||||
p = &DECL_CHAIN (*p);
|
||||
}
|
||||
SET_DECL_INHERITED_CTOR (fn, inherited_ctor);
|
||||
|
@ -2103,7 +2102,7 @@ implicitly_declare_fn (special_function_kind kind, tree type,
|
|||
constexpr_p = DECL_DECLARED_CONSTEXPR_P (inherited_ctor);
|
||||
}
|
||||
/* Add the "this" parameter. */
|
||||
this_parm = build_this_parm (fn_type, TYPE_UNQUALIFIED);
|
||||
this_parm = build_this_parm (fn, fn_type, TYPE_UNQUALIFIED);
|
||||
DECL_CHAIN (this_parm) = DECL_ARGUMENTS (fn);
|
||||
DECL_ARGUMENTS (fn) = this_parm;
|
||||
|
||||
|
|
|
@ -20451,7 +20451,7 @@ inject_this_parameter (tree ctype, cp_cv_quals quals)
|
|||
return;
|
||||
}
|
||||
|
||||
this_parm = build_this_parm (ctype, quals);
|
||||
this_parm = build_this_parm (NULL_TREE, ctype, quals);
|
||||
/* Clear this first to avoid shortcut in cp_build_indirect_ref. */
|
||||
current_class_ptr = NULL_TREE;
|
||||
current_class_ref
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2017-06-16 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
* libcp1plugin.cc (plugin_build_decl): Adjust parm building.
|
||||
|
||||
2017-05-26 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
* libcp1plugin.cc (plugin_make_namespace_inline): Push onto linees.
|
||||
|
|
|
@ -1366,7 +1366,7 @@ plugin_build_decl (cc1_plugin::connection *self,
|
|||
overloading. */
|
||||
SET_DECL_LANGUAGE (decl, lang_cplusplus);
|
||||
if (TREE_CODE (sym_type) == METHOD_TYPE)
|
||||
DECL_ARGUMENTS (decl) = build_this_parm (current_class_type,
|
||||
DECL_ARGUMENTS (decl) = build_this_parm (decl, current_class_type,
|
||||
cp_type_quals (sym_type));
|
||||
for (tree arg = TREE_CODE (sym_type) == METHOD_TYPE
|
||||
? TREE_CHAIN (TYPE_ARG_TYPES (sym_type))
|
||||
|
@ -1374,7 +1374,7 @@ plugin_build_decl (cc1_plugin::connection *self,
|
|||
arg && arg != void_list_node;
|
||||
arg = TREE_CHAIN (arg))
|
||||
{
|
||||
tree parm = cp_build_parm_decl (NULL_TREE, TREE_VALUE (arg));
|
||||
tree parm = cp_build_parm_decl (decl, NULL_TREE, TREE_VALUE (arg));
|
||||
DECL_CHAIN (parm) = DECL_ARGUMENTS (decl);
|
||||
DECL_ARGUMENTS (decl) = parm;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue