From 5951f637bc7086189b9702766068fb5f319039ad Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 19 Nov 1997 23:07:26 -0500 Subject: [PATCH] decl.c (make_implicit_typename): Handle case where t is not actually from context. * decl.c (make_implicit_typename): Handle case where t is not actually from context. * tree.c (get_type_decl): Lose identifier case. * spew.c (yylex): Lose useless call to identifer_typedecl_value. * parse.y (nonnested_type): Just use lookup_name. (complex_type_name): Just use IDENTIFIER_GLOBAL_VALUE. Wed Nov 19 11:45:07 1997 Michael Tiemann * error.c (dump_function_name): Test DECL_LANG_SPECIFIC in case T was built in C language context (for example, by output_func_start_profiler). From-SVN: r16589 --- gcc/cp/ChangeLog | 15 +++++++++++++++ gcc/cp/decl.c | 8 ++++++-- gcc/cp/error.c | 3 ++- gcc/cp/parse.y | 9 +++------ gcc/cp/spew.c | 4 +--- gcc/cp/tree.c | 2 -- 6 files changed, 27 insertions(+), 14 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index efdf9a769e6..f10aea4a7b4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,18 @@ +Wed Nov 19 18:24:14 1997 Jason Merrill + + * decl.c (make_implicit_typename): Handle case where t is not + actually from context. + * tree.c (get_type_decl): Lose identifier case. + * spew.c (yylex): Lose useless call to identifer_typedecl_value. + * parse.y (nonnested_type): Just use lookup_name. + (complex_type_name): Just use IDENTIFIER_GLOBAL_VALUE. + +Wed Nov 19 11:45:07 1997 Michael Tiemann + + * error.c (dump_function_name): Test DECL_LANG_SPECIFIC in case + T was built in C language context (for example, by + output_func_start_profiler). + Wed Nov 19 10:39:27 1997 Jason Merrill * decl.c (make_implicit_typename): New fn. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e0158162e9d..3aa8201200a 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4389,7 +4389,7 @@ make_implicit_typename (context, t) && DECL_CONTEXT (t) != context) { tree binfo = get_binfo (DECL_CONTEXT (t), context, 0); - for (;;) + while (binfo) { tree next = BINFO_INHERITANCE_CHAIN (binfo); if (! uses_template_parms (BINFO_TYPE (next)) @@ -4397,7 +4397,11 @@ make_implicit_typename (context, t) break; binfo = next; } - retval = make_typename_type (BINFO_TYPE (binfo), DECL_NAME (t)); + if (binfo) + retval = make_typename_type (BINFO_TYPE (binfo), DECL_NAME (t)); + else + /* FIXME: find the enclosing class whose base t comes from. */ + retval = make_typename_type (DECL_CONTEXT (t), DECL_NAME (t)); } else retval = make_typename_type (context, DECL_NAME (t)); diff --git a/gcc/cp/error.c b/gcc/cp/error.c index d6c6586b9dd..50421267ba0 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -925,7 +925,8 @@ dump_function_name (t) else dump_decl (name, 0); - if ((DECL_TEMPLATE_SPECIALIZATION (t) || DECL_IMPLICIT_INSTANTIATION (t)) + if (DECL_LANG_SPECIFIC (t) + && (DECL_TEMPLATE_SPECIALIZATION (t) || DECL_IMPLICIT_INSTANTIATION (t)) && (DECL_CLASS_CONTEXT (t) == NULL_TREE || is_member_template (t))) { tree args = DECL_TEMPLATE_INFO (t) diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 0906947b731..18d4aa74a9f 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -3017,18 +3017,15 @@ nonnested_type: { if (TREE_CODE ($1) == IDENTIFIER_NODE) { + $$ = lookup_name ($1, 1); if (current_class_type && TYPE_BEING_DEFINED (current_class_type) && ! IDENTIFIER_CLASS_VALUE ($1)) { - /* Be sure to get an inherited typedef. */ - $$ = lookup_name ($1, 1); /* Remember that this name has been used in the class definition, as per [class.scope0] */ pushdecl_class_level ($$); } - else - $$ = identifier_typedecl_value ($1); } else $$ = $1; @@ -3036,7 +3033,7 @@ nonnested_type: | global_scope type_name { if (TREE_CODE ($2) == IDENTIFIER_NODE) - $$ = identifier_typedecl_value ($2); + $$ = IDENTIFIER_GLOBAL_VALUE ($2); else $$ = $2; got_scope = NULL_TREE; @@ -3285,7 +3282,7 @@ complex_type_name: global_scope type_name { if (TREE_CODE ($2) == IDENTIFIER_NODE) - $$ = identifier_typedecl_value ($2); + $$ = IDENTIFIER_GLOBAL_VALUE ($2); else $$ = $2; got_scope = NULL_TREE; diff --git a/gcc/cp/spew.c b/gcc/cp/spew.c index ce884def14a..a6fe404bbe0 100644 --- a/gcc/cp/spew.c +++ b/gcc/cp/spew.c @@ -312,9 +312,7 @@ yylex () { case TYPENAME: case SELFNAME: - lastiddecl = identifier_typedecl_value (tmp_token.yylval.ttype); - if (lastiddecl != trrr) - lastiddecl = trrr; + lastiddecl = trrr; if (got_scope) tmp_token.yylval.ttype = trrr; break; diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index e94fd554057..98b1a6d3b77 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1866,8 +1866,6 @@ tree get_type_decl (t) tree t; { - if (TREE_CODE (t) == IDENTIFIER_NODE) - return identifier_typedecl_value (t); if (TREE_CODE (t) == TYPE_DECL) return t; if (TREE_CODE_CLASS (TREE_CODE (t)) == 't') -- 2.30.2