aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/method.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/method.c')
-rw-r--r--gcc/cp/method.c130
1 files changed, 9 insertions, 121 deletions
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index e1ffaad3769..52770042bee 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -88,119 +88,6 @@ set_mangled_name_for_decl (tree decl)
}
-/* This function takes an identifier, ID, and attempts to figure out what
- it means. There are a number of possible scenarios, presented in increasing
- order of hair:
-
- 1) not in a class's scope
- 2) in class's scope, member name of the class's method
- 3) in class's scope, but not a member name of the class
- 4) in class's scope, member name of a class's variable
-
- NAME is $1 from the bison rule. It is an IDENTIFIER_NODE.
- VALUE is $$ from the bison rule. It is the value returned by lookup_name ($1)
-
- As a last ditch, try to look up the name as a label and return that
- address.
-
- Values which are declared as being of REFERENCE_TYPE are
- automatically dereferenced here (as a hack to make the
- compiler faster). */
-
-tree
-hack_identifier (tree value, tree name)
-{
- tree type;
-
- if (value == error_mark_node)
- return error_mark_node;
-
- type = TREE_TYPE (value);
- if (TREE_CODE (value) == FIELD_DECL)
- value = finish_non_static_data_member (value,
- /*qualifying_scope=*/NULL_TREE);
- else if ((TREE_CODE (value) == FUNCTION_DECL
- && DECL_FUNCTION_MEMBER_P (value))
- || (TREE_CODE (value) == OVERLOAD
- && DECL_FUNCTION_MEMBER_P (OVL_CURRENT (value))))
- {
- tree decl;
-
- if (TREE_CODE (value) == OVERLOAD)
- value = OVL_CURRENT (value);
-
- decl = maybe_dummy_object (DECL_CONTEXT (value), 0);
- value = finish_class_member_access_expr (decl, name);
- }
- else if (really_overloaded_fn (value))
- ;
- else if (TREE_CODE (value) == OVERLOAD)
- /* not really overloaded function */
- mark_used (OVL_FUNCTION (value));
- else if (TREE_CODE (value) == TREE_LIST)
- {
- /* Ambiguous reference to base members, possibly other cases?. */
- tree t = value;
- while (t && TREE_CODE (t) == TREE_LIST)
- {
- mark_used (TREE_VALUE (t));
- t = TREE_CHAIN (t);
- }
- }
- else if (TREE_CODE (value) == NAMESPACE_DECL)
- {
- error ("use of namespace `%D' as expression", value);
- return error_mark_node;
- }
- else if (DECL_CLASS_TEMPLATE_P (value))
- {
- error ("use of class template `%T' as expression", value);
- return error_mark_node;
- }
- else
- mark_used (value);
-
- if (TREE_CODE (value) == VAR_DECL || TREE_CODE (value) == PARM_DECL
- || TREE_CODE (value) == RESULT_DECL)
- {
- tree context = decl_function_context (value);
- if (context != NULL_TREE && context != current_function_decl
- && ! TREE_STATIC (value))
- {
- error ("use of %s from containing function",
- (TREE_CODE (value) == VAR_DECL
- ? "`auto' variable" : "parameter"));
- cp_error_at (" `%#D' declared here", value);
- value = error_mark_node;
- }
- }
-
- if (DECL_P (value) && DECL_NONLOCAL (value))
- {
- if (DECL_CLASS_SCOPE_P (value)
- && DECL_CONTEXT (value) != current_class_type)
- {
- tree path;
- path = currently_open_derived_class (DECL_CONTEXT (value));
- perform_or_defer_access_check (TYPE_BINFO (path), value);
- }
- }
- else if (TREE_CODE (value) == TREE_LIST
- && TREE_TYPE (value) == error_mark_node)
- {
- error ("\
-request for member `%D' is ambiguous in multiple inheritance lattice",
- name);
- print_candidates (value);
- return error_mark_node;
- }
-
- if (! processing_template_decl)
- value = convert_from_reference (value);
- return value;
-}
-
-
/* Return a this or result adjusting thunk to FUNCTION. THIS_ADJUSTING
indicates whether it is a this or result adjusting thunk.
FIXED_OFFSET and VIRTUAL_OFFSET indicate how to do the adjustment
@@ -436,7 +323,7 @@ use_thunk (tree thunk_fndecl, bool emit_p)
this translation unit. */
TREE_ADDRESSABLE (function) = 1;
mark_used (function);
- TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (function)) = 1;
+ mark_referenced (DECL_ASSEMBLER_NAME (function));
if (!emit_p)
return;
@@ -539,6 +426,7 @@ use_thunk (tree thunk_fndecl, bool emit_p)
tree x = copy_node (a);
TREE_CHAIN (x) = t;
DECL_CONTEXT (x) = thunk_fndecl;
+ SET_DECL_RTL (x, NULL_RTX);
t = x;
}
a = nreverse (t);
@@ -573,7 +461,7 @@ use_thunk (tree thunk_fndecl, bool emit_p)
/* Since we want to emit the thunk, we explicitly mark its name as
referenced. */
- TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (thunk_fndecl)) = 1;
+ mark_referenced (DECL_ASSEMBLER_NAME (thunk_fndecl));
/* But we don't want debugging information about it. */
DECL_IGNORED_P (thunk_fndecl) = 1;
@@ -581,7 +469,7 @@ use_thunk (tree thunk_fndecl, bool emit_p)
/* Re-enable access control. */
pop_deferring_access_checks ();
- expand_or_defer_fn (finish_function (0));
+ expand_body (finish_function (0));
}
pop_from_top_level ();
@@ -700,7 +588,7 @@ do_build_assign_ref (tree fndecl)
tree parm = TREE_CHAIN (DECL_ARGUMENTS (fndecl));
tree compound_stmt;
- compound_stmt = begin_compound_stmt (/*has_no_scope=*/0);
+ compound_stmt = begin_compound_stmt (/*has_no_scope=*/false);
parm = convert_from_reference (parm);
if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type)
@@ -718,7 +606,7 @@ do_build_assign_ref (tree fndecl)
int cvquals = cp_type_quals (TREE_TYPE (parm));
int i;
- /* Assign to each of thedirect base classes. */
+ /* Assign to each of the direct base classes. */
for (i = 0; i < CLASSTYPE_N_BASECLASSES (current_class_type); ++i)
{
tree binfo;
@@ -793,7 +681,7 @@ do_build_assign_ref (tree fndecl)
}
}
finish_return_stmt (current_class_ref);
- finish_compound_stmt (/*has_no_scope=*/0, compound_stmt);
+ finish_compound_stmt (compound_stmt);
}
void
@@ -857,8 +745,8 @@ synthesize_method (tree fndecl)
if (need_body)
{
tree compound_stmt;
- compound_stmt = begin_compound_stmt (/*has_no_scope=*/0);
- finish_compound_stmt (/*has_no_scope=*/0, compound_stmt);
+ compound_stmt = begin_compound_stmt (/*has_no_scope=*/false);
+ finish_compound_stmt (compound_stmt);
}
finish_function_body (stmt);