This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] [C++/DWARF] Add 'using' support - take 3
On Jan 23, 2004, at 12:50 PM, Jason Merrill wrote:
On Thu, 22 Jan 2004 16:13:29 -0800, Devang Patel <firstname.lastname@example.org>
- Instead of emitting abstract or half backed definition now
forces declaration dies for functions and variables. Related
1) Remove checks that allowed definition die reuse
2) Selectively remove child dies while using subprogram
declaration die as
3) Equate declaration die to line number
You mean decl number, right?
+ /* Enum to distinguish imported modules vs. decls. */
+ enum dbg_module_or_decl
Why did we need this, again? It seems to me that we should be able to
which it is based on the decl passed. Sorry I didn't mention this
I thought of it when reviewing your last patch, but looking back over
mail I don't see it.
I want to use same debug hook (I'll rename it appropriately later) to
DW_AT_Friend, DW_TAG_Try_Block, DW_TAG_Catch_Block, DW_TAG_Thrown_Type
so I need some one enum.
*************** 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?
At least newly added DW_TAG_Imported_Module or Decl die.
! 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?
hmm.. now I realize that we do not need to force field_decls. If
force entire type earlier.
+ 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))
Ignore builtins in the front end, not in dwarf2out.
+ /* OK, now we have DIEs for decl as well as scope. Emit imported
+ if (tag == DBG_IMPORTED_MODULE)
+ imported_die = new_die (DW_TAG_imported_module, scope_die,
+ else if (tag == DBG_IMPORTED_DECL)
+ imported_die = new_die (DW_TAG_imported_declaration, scope_die,
+ 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 ----
/* 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 (),
I should have been more clear. If toplevel_bindings_p(), use
current_namespace. Otherwise, use current_scope(). Conveniently,
the same condition tested by the if/else immediately above this patch.
Well, I was dense here :-). T tried to get correct context, but without
toplevel_bindings_p(), earlier. When you asked question about it last
couldn't myself decode my own logic, so I gave up and blindly followed
This code should also check !processing_template_decl.
I will send updated patch soon.