Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gcc-cobol
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
COBOLworx
gcc-cobol
Commits
4086ef7d
Commit
4086ef7d
authored
7 years ago
by
Nathan Sidwell
Committed by
Nathan Sidwell
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
* pt.c (tsubst_baselink): Fix & clarify formatting.
From-SVN: r249273
parent
56960fd6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gcc/cp/ChangeLog
+2
-0
2 additions, 0 deletions
gcc/cp/ChangeLog
gcc/cp/pt.c
+72
-76
72 additions, 76 deletions
gcc/cp/pt.c
with
74 additions
and
76 deletions
gcc/cp/ChangeLog
+
2
−
0
View file @
4086ef7d
2017-06-16 Nathan Sidwell <nathan@acm.org>
2017-06-16 Nathan Sidwell <nathan@acm.org>
* pt.c (tsubst_baselink): Fix & clarify formatting.
* cp-tree.h (build_this_parm, cp_build_parm_decl,
* cp-tree.h (build_this_parm, cp_build_parm_decl,
build_artificial_parm): Add FN parm.
build_artificial_parm): Add FN parm.
* decl.c (start_cleanup_fn): Adjust.
* decl.c (start_cleanup_fn): Adjust.
...
...
This diff is collapsed.
Click to expand it.
gcc/cp/pt.c
+
72
−
76
View file @
4086ef7d
...
@@ -14215,93 +14215,89 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
...
@@ -14215,93 +14215,89 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
}
}
}
}
/* Like tsubst_expr for a BASELINK. OBJECT_TYPE, if non-NULL, is the
/* tsubst a BASELINK. OBJECT_TYPE, if non-NULL, is the type of the
type of the expression on the left-hand side of the "." or "->"
expression on the left-hand side of the "." or "->" operator. A
operator. */
baselink indicates a function from a base class. Both the
BASELINK_ACCESS_BINFO and the base class referenced may indicate
bases of the template class, rather than the instantiated class.
In addition, lookups that were not ambiguous before may be
ambiguous now. Therefore, we perform the lookup again. */
static tree
static tree
tsubst_baselink (tree baselink, tree object_type,
tsubst_baselink (tree baselink, tree object_type,
tree args, tsubst_flags_t complain, tree in_decl)
tree args, tsubst_flags_t complain, tree in_decl)
{
{
tree name;
bool qualified = BASELINK_QUALIFIED_P (baselink);
tree qualifying_scope;
tree fns;
tree qualifying_scope = BINFO_TYPE (BASELINK_ACCESS_BINFO (baselink));
tree optype;
qualifying_scope = tsubst (qualifying_scope, args, complain, in_decl);
tree template_args = 0;
bool template_id_p = false;
tree optype = BASELINK_OPTYPE (baselink);
bool qualified = BASELINK_QUALIFIED_P (baselink);
optype = tsubst (optype, args, complain, in_decl);
/* A baselink indicates a function from a base class. Both the
tree template_args = NULL_TREE;
BASELINK_ACCESS_BINFO and the base class referenced may
bool template_id_p = false;
indicate bases of the template class, rather than the
tree fns = BASELINK_FUNCTIONS (baselink);
instantiated class. In addition, lookups that were not
if (TREE_CODE (fns) == TEMPLATE_ID_EXPR)
ambiguous before may be ambiguous now. Therefore, we perform
{
the lookup again. */
template_id_p = true;
qualifying_scope = BINFO_TYPE (BASELINK_ACCESS_BINFO (baselink));
template_args = TREE_OPERAND (fns, 1);
qualifying_scope = tsubst (qualifying_scope, args,
fns = TREE_OPERAND (fns, 0);
complain, in_decl);
if (template_args)
fns = BASELINK_FUNCTIONS (baselink);
template_args = tsubst_template_args (template_args, args,
optype = tsubst (BASELINK_OPTYPE (baselink), args, complain, in_decl);
complain, in_decl);
if (TREE_CODE (fns) == TEMPLATE_ID_EXPR)
}
{
template_id_p = true;
template_args = TREE_OPERAND (fns, 1);
fns = TREE_OPERAND (fns, 0);
if (template_args)
template_args = tsubst_template_args (template_args, args,
complain, in_decl);
}
name = OVL_NAME (fns);
if (IDENTIFIER_TYPENAME_P (name))
name = mangle_conv_op_name_for_type (optype);
baselink = lookup_fnfields (qualifying_scope, name, /*protect=*/1);
if (!baselink)
{
if (constructor_name_p (name, qualifying_scope))
{
if (complain & tf_error)
error ("cannot call constructor %<%T::%D%> directly",
qualifying_scope, name);
}
return error_mark_node;
}
/* If lookup found a single function, mark it as used at this
tree name = OVL_NAME (fns);
point. (If it lookup found multiple functions the one selected
if (IDENTIFIER_TYPENAME_P (name))
later by overload resolution will be marked as used at that
name = mangle_conv_op_name_for_type (optype);
point.) */
if (BASELINK_P (baselink))
baselink = lookup_fnfields (qualifying_scope, name, /*protect=*/1);
fns = BASELINK_FUNCTIONS (baselink);
if (!baselink)
if (!template_id_p && !really_overloaded_fn (fns)
{
&& !mark_used (OVL_FIRST (fns), complain) && !(complain & tf_error))
if ((complain & tf_error) && constructor_name_p (name, qualifying_scope))
error ("cannot call constructor %<%T::%D%> directly",
qualifying_scope, name);
return error_mark_node;
return error_mark_node;
}
/* If lookup found a single function, mark it as used at this point.
(If it lookup found multiple functions the one selected later by
overload resolution will be marked as used at that point.) */
if (BASELINK_P (baselink))
fns = BASELINK_FUNCTIONS (baselink);
if (!template_id_p && !really_overloaded_fn (fns)
&& !mark_used (OVL_FIRST (fns), complain) && !(complain & tf_error))
return error_mark_node;
/* Add back the template arguments, if present. */
if (BASELINK_P (baselink))
if (BASELINK_P (baselink) && template_id_p)
{
BASELINK_FUNCTIONS (baselink)
/* Add back the template arguments, if present. */
= build2 (TEMPLATE_ID_EXPR,
if (template_id_p)
unknown_type_node,
BASELINK_FUNCTIONS (baselink)
BASELINK_FUNCTIONS (baselink)
,
= build2 (TEMPLATE_ID_EXPR, unknown_type_node
,
template_args);
BASELINK_FUNCTIONS (baselink),
template_args);
/* Update the conversion operator type. */
if (BASELINK_P (baselink))
/* Update the conversion operator type. */
BASELINK_OPTYPE (baselink) = optype;
BASELINK_OPTYPE (baselink) = optype;
}
if (!object_type)
if (!object_type)
object_type = current_class_type;
object_type = current_class_type;
if (qualified || name == complete_dtor_identifier)
if (qualified || name == complete_dtor_identifier)
{
{
baselink = adjust_result_of_qualified_name_lookup (baselink,
baselink = adjust_result_of_qualified_name_lookup (baselink,
qualifying_scope,
qualifying_scope,
object_type);
object_type);
if (!qualified)
if (!qualified)
/* We need to call adjust_result_of_qualified_name_lookup in case the
/* We need to call adjust_result_of_qualified_name_lookup in case the
destructor names a base class, but we unset BASELINK_QUALIFIED_P
destructor names a base class, but we unset BASELINK_QUALIFIED_P
so that we still get virtual function binding. */
so that we still get virtual function binding. */
BASELINK_QUALIFIED_P (baselink) = false;
BASELINK_QUALIFIED_P (baselink) = false;
}
}
return baselink;
return baselink;
}
}
/* Like tsubst_expr for a SCOPE_REF, given by QUALIFIED_ID. DONE is
/* Like tsubst_expr for a SCOPE_REF, given by QUALIFIED_ID. DONE is
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment