This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [C++/DWARF] Add 'using' support - take 3


On Thu, 22 Jan 2004 16:13:29 -0800, Devang Patel <dpatel@apple.com> wrote:

> - Instead of emitting abstract or half backed definition now force_decl_die()
>   forces declaration dies for functions and variables. Related changes are

>    1) Remove checks that allowed definition die reuse
>    2) Selectively remove child dies while using subprogram declaration die as
>       definition die
>    3) Equate declaration die to line number

You mean decl number, right?

> + /* Enum to distinguish imported modules vs. decls.  */
> + enum dbg_module_or_decl
> +   {
> +     DBG_IMPORTED_MODULE,
> +     DBG_IMPORTED_DECL
> +   };

Why did we need this, again?  It seems to me that we should be able to tell
which it is based on the decl passed.  Sorry I didn't mention this before;
I thought of it when reviewing your last patch, but looking back over my
mail I don't see it.

> *************** gen_subprogram_die (tree decl, dw_die_re
> ! 	  remove_children (subr_die);
> --- 10748,10757 ----
> ! 	  remove_child_TAG (subr_die, DW_TAG_formal_parameter);

What other children will there be?

> ! force_decl_die (tree decl)
> ! {
...
> ! 	case FIELD_DECL:
> ! 	case VAR_DECL:
> ! 	  /* Set external flag to force declaration die. Restore it after
> ! 	   gen_decl_die() call.  */

Does this work for fields?

> + dwarf2out_imported_module_or_decl (tree decl, tree context, 
> + 				   enum dbg_module_or_decl tag)
> + {
...
> +   /* Ignore this FUNCTION_DECL if it refers to a builtin declaration 
> +      of a builtin function.  */
> +   if (TREE_CODE (decl) == FUNCTION_DECL 
> +       && DECL_EXTERNAL (decl) 
> +       && DECL_BUILT_IN (decl))
> +     return;

Ignore builtins in the front end, not in dwarf2out.

> +   /* OK, now we have DIEs for decl as well as scope. Emit imported die.  */ 
> +   if (tag == DBG_IMPORTED_MODULE)
> +     imported_die = new_die (DW_TAG_imported_module, scope_die, context);
> +   else if (tag == DBG_IMPORTED_DECL)
> +     imported_die = new_die (DW_TAG_imported_declaration, scope_die, context);
> +   else
> +     abort ();

So if we drop the enum, this would just check 
TREE_CODE (decl) == NAMESPACE_DECL.

> *************** do_local_using_decl (tree decl, tree sco
> +   /* Emit debug info.  */
> +   cp_emit_debug_info_for_using (orig_decl, current_scope());

I would expect this to need !processing_template_decl, too.

> *************** do_using_directive (tree namespace)
> *** 3289,3294 ****
> --- 3312,3324 ----
>     else
>       /* direct usage */
>       add_using_namespace (current_namespace, namespace, 0);
> + 
> +   /* Emit debugging info.  */
> +   if (current_namespace != global_namespace)
> +     context = current_namespace;
> +   (*debug_hooks->imported_module_or_decl) (namespace,
> + 					   current_scope (),
> + 					   DBG_IMPORTED_MODULE);
>   }

I should have been more clear.  If toplevel_bindings_p(), use
current_namespace.  Otherwise, use current_scope().  Conveniently, this is
the same condition tested by the if/else immediately above this patch.

This code should also check !processing_template_decl.

This patch is looking a lot better.  One more round, and it should be
ready to go in.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]