tree.h (get_containing_scope): Declare it.
* tree.h (get_containing_scope): Declare it. * tree.c (get_containing_scope): New fucntion. (decl_function_context): Use it. * toplev.c (rest_of_compilation): Use get_containing_scope. From-SVN: r30449
This commit is contained in:
parent
8f4f2f295a
commit
140b60b42e
|
@ -1,4 +1,11 @@
|
|||
Mon Nov 8 03:03:07 1999 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
|
||||
Mon Nov 8 07:25:37 1999 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* tree.h (get_containing_scope): Declare it.
|
||||
* tree.c (get_containing_scope): New fucntion.
|
||||
(decl_function_context): Use it.
|
||||
* toplev.c (rest_of_compilation): Use get_containing_scope.
|
||||
|
||||
aMon Nov 8 03:03:07 1999 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
|
||||
|
||||
* Makefile.in (rtl.o): Depend on toplev.h.
|
||||
|
||||
|
|
|
@ -3594,7 +3594,8 @@ rest_of_compilation (decl)
|
|||
generating code for this one is not only not necessary but will
|
||||
confuse some debugging output writers. */
|
||||
for (parent = DECL_CONTEXT (current_function_decl);
|
||||
parent != 0; parent = DECL_CONTEXT (parent))
|
||||
parent != NULL_TREE;
|
||||
parent = get_containing_scope (parent))
|
||||
if (TREE_CODE (parent) == FUNCTION_DECL
|
||||
&& DECL_INLINE (parent) && DECL_EXTERNAL (parent))
|
||||
{
|
||||
|
|
21
gcc/tree.c
21
gcc/tree.c
|
@ -4772,6 +4772,16 @@ int_fits_type_p (c, type)
|
|||
&& TREE_UNSIGNED (TREE_TYPE (c))));
|
||||
}
|
||||
|
||||
/* Given a DECL or TYPE, return the scope in which it was declared, or
|
||||
NUL_TREE if there is no containing scope. */
|
||||
|
||||
tree
|
||||
get_containing_scope (t)
|
||||
tree t;
|
||||
{
|
||||
return (TYPE_P (t) ? TYPE_CONTEXT (t) : DECL_CONTEXT (t));
|
||||
}
|
||||
|
||||
/* Return the innermost context enclosing DECL that is
|
||||
a FUNCTION_DECL, or zero if none. */
|
||||
|
||||
|
@ -4791,15 +4801,10 @@ decl_function_context (decl)
|
|||
|
||||
while (context && TREE_CODE (context) != FUNCTION_DECL)
|
||||
{
|
||||
if (TREE_CODE_CLASS (TREE_CODE (context)) == 't')
|
||||
context = TYPE_CONTEXT (context);
|
||||
else if (TREE_CODE_CLASS (TREE_CODE (context)) == 'd')
|
||||
context = DECL_CONTEXT (context);
|
||||
else if (TREE_CODE (context) == BLOCK)
|
||||
if (TREE_CODE (context) == BLOCK)
|
||||
context = BLOCK_SUPERCONTEXT (context);
|
||||
else
|
||||
/* Unhandled CONTEXT !? */
|
||||
abort ();
|
||||
else
|
||||
context = get_containing_scope (context);
|
||||
}
|
||||
|
||||
return context;
|
||||
|
|
|
@ -1950,6 +1950,11 @@ extern tree get_inner_reference PROTO((tree, int *, int *, tree *,
|
|||
enum machine_mode *, int *,
|
||||
int *, int *));
|
||||
|
||||
/* Given a DECL or TYPE, return the scope in which it was declared, or
|
||||
NUL_TREE if there is no containing scope. */
|
||||
|
||||
extern tree get_containing_scope PROTO((tree));
|
||||
|
||||
/* Return the FUNCTION_DECL which provides this _DECL with its context,
|
||||
or zero if none. */
|
||||
extern tree decl_function_context PROTO((tree));
|
||||
|
|
Loading…
Reference in New Issue