Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
4086ef7d
Commit
4086ef7d
authored
Jun 16, 2017
by
Nathan Sidwell
Committed by
Nathan Sidwell
Jun 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* pt.c (tsubst_baselink): Fix & clarify formatting.
From-SVN: r249273
parent
56960fd6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
76 deletions
+74
-76
gcc/cp/ChangeLog
+2
-0
gcc/cp/pt.c
+72
-76
No files found.
gcc/cp/ChangeLog
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.
...
...
gcc/cp/pt.c
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment