+2004-01-27 Devang Patel <dpatel@apple.com>
+
+ * Makefile.in (dwarf2out.o): Depend on input.h
+ * dbxout.c (dbx_debug_hooks): Add new empty hook for
+ imported_module_or_decl.
+ (xcoff_debug_hooks): Same.
+ * sdbout.c (sdb_debug_hooks): Same.
+ * vmsdbgout.c (vmsdbg_debug_hooks): Same.
+ * debug.c (do_nothing_debug_hooks): Same.
+ (debug_nothing_tree_tree): New function.
+ * debug.h (gcc_debug_hooks): New hook, imported_module_or_decl.
+ * dwarf2out.c: Include input.h.
+ (dwarf2_debug_hooks): Add new hook for imported_module_or_decl.
+ (remove_child_TAG): New function.
+ (dwarf_tag_name): Handle DW_TAG_imported_module.
+ (gen_subprogram_die): Equate decl number to declaration die. Do not
+ remove all children dies while reusing declaration die for definition.
+ Instead, selectively remove only formal parameters.
+ (gen_variable_die): Equate variable decl to declaration die.
+ (gen_field_die): Equate field decl to line number.
+ (force_namespace_die): Replace it with ...
+ (force_decl_die): ... this.
+ (force_type_die): New function.
+ (setup_namespace_context): Replace use of force_namespace_die() with
+ force_decl_die().
+ (gen_namespace_die): Same.
+ (dwarf2out_imported_module_or_decl): New function.
+
2004-01-27 Bob Wilson <bob.wilson@acm.org>
* config/xtensa/xtensa.c (xtensa_copy_incoming_a7): Remove SUBREG
output.h $(DIAGNOSTIC_H) real.h hard-reg-set.h $(REGS_H) $(EXPR_H) \
libfuncs.h toplev.h dwarf2out.h varray.h $(GGC_H) except.h dwarf2asm.h \
$(TM_P_H) langhooks.h $(HASHTAB_H) gt-dwarf2out.h $(TARGET_H) cgraph.h \
- $(MD5_H)
+ $(MD5_H) input.h
dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) flags.h $(RTL_H) \
$(TREE_H) output.h dwarf2asm.h $(TM_P_H) $(GGC_H) gt-dwarf2asm.h
vmsdbgout.o : vmsdbgout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
+2004-01-27 Devang Patel <dpatel@apple.com>
+
+ * name-lookup.c: Include "debug.h"
+ (do_namespace_alias): Invoke debug_hooks to emit debug info
+ for namespace alias.
+ (do_local_using_decl): Invoke debug_hooks to emit debug info
+ for using decl.
+ (do_class_using_decl): Same.
+ (do_toplevel_using_decl): Same.
+ (do_using_directive): Same.
+ (cp_emit_debug_info_for_using): New function.
+ * Make-lang.in (cp/parser.o): Depend on debug.h
+ (cp/name-lookup.o): Same.
+
2004-01-26 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cp-tree.h (language_function, lang_type_header): Use
input.h $(PARAMS_H) debug.h tree-inline.h
cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) toplev.h real.h gt-cp-mangle.h $(TM_P_H)
-cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) diagnostic.h gt-cp-parser.h output.h
+cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) diagnostic.h gt-cp-parser.h \
+ output.h
cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(CXX_TREE_H) timevar.h gt-cp-name-lookup.h toplev.h \
- $(DIAGNOSTIC_H) flags.h
+ $(DIAGNOSTIC_H) flags.h debug.h
cp/cxx-pretty-print.o: cp/cxx-pretty-print.c $(CXX_PRETTY_PRINT_H) \
$(CONFIG_H) $(SYSTEM_H) $(TM_H) coretypes.h $(CXX_TREE_H)
#include "timevar.h"
#include "toplev.h"
#include "diagnostic.h"
+#include "debug.h"
static cxx_scope *innermost_nonclass_level (void);
static tree select_decl (cxx_binding *, int);
static bool qualified_lookup_using_namespace (tree, tree, cxx_binding *, int);
static tree lookup_type_current_level (tree);
static tree push_using_directive (tree);
-
+static void cp_emit_debug_info_for_using (tree, tree);
/* The :: namespace. */
do_local_using_decl (tree decl, tree scope, tree name)
{
tree oldval, oldtype, newval, newtype;
+ tree orig_decl = decl;
decl = validate_nonmember_using_decl (decl, scope, name);
if (decl == NULL_TREE)
}
if (newtype)
set_identifier_type_value (name, newtype);
+
+ /* Emit debug info. */
+ if (!processing_template_decl)
+ cp_emit_debug_info_for_using (orig_decl, current_scope());
}
/* Return the type that should be used when TYPE's name is preceded
type = dependent_type_p (scope) ? NULL_TREE : void_type_node;
value = build_lang_decl (USING_DECL, name, type);
DECL_INITIAL (value) = scope;
+
+ if (scope && !processing_template_decl)
+ {
+ tree r;
+
+ r = lookup_qualified_name (scope, name, false, false);
+ if (r && TREE_CODE (r) != ERROR_MARK)
+ cp_emit_debug_info_for_using (r, scope);
+ }
return value;
}
DECL_NAMESPACE_ALIAS (alias) = namespace;
DECL_EXTERNAL (alias) = 1;
pushdecl (alias);
+
+ /* Emit debug info for namespace alias. */
+ (*debug_hooks->global_decl) (alias);
}
/* Like pushdecl, only it places X in the current namespace,
do_toplevel_using_decl (tree decl, tree scope, tree name)
{
tree oldval, oldtype, newval, newtype;
+ tree orig_decl = decl;
cxx_binding *binding;
decl = validate_nonmember_using_decl (decl, scope, name);
do_nonmember_using_decl (scope, name, oldval, oldtype, &newval, &newtype);
+ /* Emit debug info. */
+ if (!processing_template_decl)
+ cp_emit_debug_info_for_using (orig_decl, current_namespace);
+
/* Copy declarations found. */
if (newval)
binding->value = newval;
void
do_using_directive (tree namespace)
{
+ tree context = NULL_TREE;
+
if (building_stmt_tree ())
add_stmt (build_stmt (USING_STMT, namespace));
}
namespace = ORIGINAL_NAMESPACE (namespace);
if (!toplevel_bindings_p ())
- push_using_directive (namespace);
+ {
+ push_using_directive (namespace);
+ context = current_scope ();
+ }
else
- /* direct usage */
- add_using_namespace (current_namespace, namespace, 0);
+ {
+ /* direct usage */
+ add_using_namespace (current_namespace, namespace, 0);
+ if (current_namespace != global_namespace)
+ context = current_namespace;
+ }
+
+ /* Emit debugging info. */
+ if (!processing_template_decl)
+ (*debug_hooks->imported_module_or_decl) (namespace, context);
}
/* Deal with a using-directive seen by the parser. Currently we only
verbatim ("XXX leaving pop_everything ()\n");
}
+/* Emit debugging information for using declarations and directives.
+ If input tree is overloaded fn then emit debug info for all
+ candidates. */
+
+static void
+cp_emit_debug_info_for_using (tree t, tree context)
+{
+ /* Ignore this FUNCTION_DECL if it refers to a builtin declaration
+ of a builtin function. */
+ if (TREE_CODE (t) == FUNCTION_DECL
+ && DECL_EXTERNAL (t)
+ && DECL_BUILT_IN (t))
+ return;
+
+ /* Do not supply context to imported_module_or_decl, if
+ it is a global namespace. */
+ if (context == global_namespace)
+ context = NULL_TREE;
+
+ if (BASELINK_P (t))
+ t = BASELINK_FUNCTIONS (t);
+
+ /* FIXME: Handle TEMPLATE_DECLs. */
+ for (t = OVL_CURRENT (t); t; t = OVL_NEXT (t))
+ if (TREE_CODE (t) != TEMPLATE_DECL)
+ (*debug_hooks->imported_module_or_decl) (t, context);
+ }
+
#include "gt-cp-name-lookup.h"
dbxout_end_source_file,
dbxout_begin_block,
dbxout_end_block,
- debug_true_tree, /* ignore_block */
- dbxout_source_line, /* source_line */
- dbxout_source_line, /* begin_prologue: just output line info */
- debug_nothing_int_charstar, /* end_prologue */
- debug_nothing_int_charstar, /* end_epilogue */
+ debug_true_tree, /* ignore_block */
+ dbxout_source_line, /* source_line */
+ dbxout_source_line, /* begin_prologue: just output
+ line info */
+ debug_nothing_int_charstar, /* end_prologue */
+ debug_nothing_int_charstar, /* end_epilogue */
#ifdef DBX_FUNCTION_FIRST
dbxout_begin_function,
#else
- debug_nothing_tree, /* begin_function */
+ debug_nothing_tree, /* begin_function */
#endif
- debug_nothing_int, /* end_function */
+ debug_nothing_int, /* end_function */
dbxout_function_decl,
- dbxout_global_decl, /* global_decl */
- debug_nothing_tree, /* deferred_inline_function */
- debug_nothing_tree, /* outlining_inline_function */
- debug_nothing_rtx, /* label */
- dbxout_handle_pch /* handle_pch */
+ dbxout_global_decl, /* global_decl */
+ debug_nothing_tree_tree, /* imported_module_or_decl */
+ debug_nothing_tree, /* deferred_inline_function */
+ debug_nothing_tree, /* outlining_inline_function */
+ debug_nothing_rtx, /* label */
+ dbxout_handle_pch /* handle_pch */
};
#endif /* DBX_DEBUGGING_INFO */
dbxout_end_source_file,
xcoffout_begin_block,
xcoffout_end_block,
- debug_true_tree, /* ignore_block */
+ debug_true_tree, /* ignore_block */
xcoffout_source_line,
- xcoffout_begin_prologue, /* begin_prologue */
- debug_nothing_int_charstar, /* end_prologue */
+ xcoffout_begin_prologue, /* begin_prologue */
+ debug_nothing_int_charstar, /* end_prologue */
xcoffout_end_epilogue,
- debug_nothing_tree, /* begin_function */
+ debug_nothing_tree, /* begin_function */
xcoffout_end_function,
- debug_nothing_tree, /* function_decl */
- dbxout_global_decl, /* global_decl */
- debug_nothing_tree, /* deferred_inline_function */
- debug_nothing_tree, /* outlining_inline_function */
- debug_nothing_rtx, /* label */
- dbxout_handle_pch /* handle_pch */
+ debug_nothing_tree, /* function_decl */
+ dbxout_global_decl, /* global_decl */
+ debug_nothing_tree_tree, /* imported_module_or_decl */
+ debug_nothing_tree, /* deferred_inline_function */
+ debug_nothing_tree, /* outlining_inline_function */
+ debug_nothing_rtx, /* label */
+ dbxout_handle_pch /* handle_pch */
};
#endif /* XCOFF_DEBUGGING_INFO */
\f
debug_nothing_int_charstar,
debug_nothing_int_charstar,
debug_nothing_int,
- debug_nothing_int_int, /* begin_block */
- debug_nothing_int_int, /* end_block */
- debug_true_tree, /* ignore_block */
- debug_nothing_int_charstar, /* source_line */
- debug_nothing_int_charstar, /* begin_prologue */
- debug_nothing_int_charstar, /* end_prologue */
- debug_nothing_int_charstar, /* end_epilogue */
- debug_nothing_tree, /* begin_function */
- debug_nothing_int, /* end_function */
- debug_nothing_tree, /* function_decl */
- debug_nothing_tree, /* global_decl */
- debug_nothing_tree, /* deferred_inline_function */
- debug_nothing_tree, /* outlining_inline_function */
- debug_nothing_rtx, /* label */
- debug_nothing_int /* handle_pch */
+ debug_nothing_int_int, /* begin_block */
+ debug_nothing_int_int, /* end_block */
+ debug_true_tree, /* ignore_block */
+ debug_nothing_int_charstar, /* source_line */
+ debug_nothing_int_charstar, /* begin_prologue */
+ debug_nothing_int_charstar, /* end_prologue */
+ debug_nothing_int_charstar, /* end_epilogue */
+ debug_nothing_tree, /* begin_function */
+ debug_nothing_int, /* end_function */
+ debug_nothing_tree, /* function_decl */
+ debug_nothing_tree, /* global_decl */
+ debug_nothing_tree_tree, /* imported_module_or_decl */
+ debug_nothing_tree, /* deferred_inline_function */
+ debug_nothing_tree, /* outlining_inline_function */
+ debug_nothing_rtx, /* label */
+ debug_nothing_int /* handle_pch */
};
/* This file contains implementations of each debug hook that do
{
}
+void
+debug_nothing_tree_tree (tree t1 ATTRIBUTE_UNUSED,
+ tree t2 ATTRIBUTE_UNUSED)
+{
+}
+
bool
debug_true_tree (tree block ATTRIBUTE_UNUSED)
{
compilation proper has finished. */
void (* global_decl) (tree decl);
+ /* Debug information for imported modules and declarations. */
+ void (* imported_module_or_decl) (tree decl, tree context);
+
/* DECL is an inline function, whose body is present, but which is
not being output at this point. */
void (* deferred_inline_function) (tree decl);
extern void debug_nothing_int (unsigned int);
extern void debug_nothing_int_int (unsigned int, unsigned int);
extern void debug_nothing_tree (tree);
+extern void debug_nothing_tree_tree (tree, tree);
extern bool debug_true_tree (tree);
extern void debug_nothing_rtx (rtx);
#include "langhooks.h"
#include "hashtab.h"
#include "cgraph.h"
+#include "input.h"
#ifdef DWARF2_DEBUGGING_INFO
static void dwarf2out_source_line (unsigned int, const char *);
static void dwarf2out_end_block (unsigned, unsigned);
static bool dwarf2out_ignore_block (tree);
static void dwarf2out_global_decl (tree);
+static void dwarf2out_imported_module_or_decl (tree, tree);
static void dwarf2out_abstract_function (tree);
/* The debug hooks structure. */
debug_nothing_int, /* end_function */
dwarf2out_decl, /* function_decl */
dwarf2out_global_decl,
+ dwarf2out_imported_module_or_decl,
debug_nothing_tree, /* deferred_inline_function */
/* The DWARF 2 backend tries to reduce debugging bloat by not
emitting the abstract description of inline functions until
static bool is_fortran (void);
static bool is_ada (void);
static void remove_AT (dw_die_ref, enum dwarf_attribute);
+static void remove_child_TAG (dw_die_ref, enum dwarf_tag);
static inline void free_die (dw_die_ref);
static void remove_children (dw_die_ref);
static void add_child_die (dw_die_ref, dw_die_ref);
static int is_redundant_typedef (tree);
static void gen_namespace_die (tree);
static void gen_decl_die (tree, dw_die_ref);
-static dw_die_ref force_namespace_die (tree);
+static dw_die_ref force_decl_die (tree);
+static dw_die_ref force_type_die (tree);
static dw_die_ref setup_namespace_context (tree, dw_die_ref);
static void declare_in_namespace (tree, dw_die_ref);
static unsigned lookup_filename (const char *);
return "DW_TAG_variable";
case DW_TAG_volatile_type:
return "DW_TAG_volatile_type";
+ case DW_TAG_imported_module:
+ return "DW_TAG_imported_module";
case DW_TAG_MIPS_loop:
return "DW_TAG_MIPS_loop";
case DW_TAG_format_label:
}
}
+/* Remove child die whose die_tag is specified tag. */
+
+static void
+remove_child_TAG (dw_die_ref die, enum dwarf_tag tag)
+{
+ dw_die_ref current, prev, next;
+ current = die->die_child;
+ prev = NULL;
+ while (current != NULL)
+ {
+ if (current->die_tag == tag)
+ {
+ next = current->die_sib;
+ if (prev == NULL)
+ die->die_child = next;
+ else
+ prev->die_sib = next;
+ free_die (current);
+ current = next;
+ }
+ else
+ {
+ prev = current;
+ current = current->die_sib;
+ }
+ }
+}
+
/* Free up the memory used by DIE. */
static inline void
{
subr_die = old_die;
- /* Clear out the declaration attribute and the parm types. */
+ /* Clear out the declaration attribute and the formal parameters.
+ Do not remove all children, because it is possible that this
+ declaration die was forced using force_decl_die(). In such
+ cases die that forced declaration die (e.g. TAG_imported_module)
+ is one of the children that we do not want to remove. */
remove_AT (subr_die, DW_AT_declaration);
- remove_children (subr_die);
+ remove_child_TAG (subr_die, DW_TAG_formal_parameter);
}
else
{
/* The first time we see a member function, it is in the context of
the class to which it belongs. We make sure of this by emitting
the class first. The next time is the definition, which is
- handled above. The two may come from the same source text. */
- if (DECL_CONTEXT (decl) || DECL_ABSTRACT (decl))
+ handled above. The two may come from the same source text.
+
+ Note that force_decl_die() forces function declaration die. It is
+ later reused to represent definition. */
equate_decl_number_to_die (decl, subr_die);
}
}
if (declaration)
add_AT_flag (var_die, DW_AT_declaration, 1);
- if (class_or_namespace_scope_p (context_die) || DECL_ABSTRACT (decl))
+ if (DECL_ABSTRACT (decl) || declaration)
equate_decl_number_to_die (decl, var_die);
if (! declaration && ! DECL_ABSTRACT (decl))
add_AT_unsigned (decl_die, DW_AT_accessibility, DW_ACCESS_protected);
else if (TREE_PRIVATE (decl))
add_AT_unsigned (decl_die, DW_AT_accessibility, DW_ACCESS_private);
+
+ /* Equate decl number to die, so that we can look up this decl later on. */
+ equate_decl_number_to_die (decl, decl_die);
}
#if 0
return 0;
}
-/* Returns the DIE for namespace NS or aborts.
+/* Returns the DIE for decl or aborts. */
- Note that namespaces don't really have a lexical context, so there's no
- need to pass in a context_die. They always go inside their containing
- namespace, or comp_unit_die if none. */
+static dw_die_ref
+force_decl_die (tree decl)
+{
+ dw_die_ref decl_die;
+ unsigned saved_external_flag;
+ tree save_fn = NULL_TREE;
+ decl_die = lookup_decl_die (decl);
+ if (!decl_die)
+ {
+ dw_die_ref context_die;
+ tree decl_context = DECL_CONTEXT (decl);
+ if (decl_context)
+ {
+ /* Find die that represents this context. */
+ if (TYPE_P (decl_context))
+ context_die = force_type_die (decl_context);
+ else
+ context_die = force_decl_die (decl_context);
+ }
+ else
+ context_die = comp_unit_die;
+
+ switch (TREE_CODE (decl))
+ {
+ case FUNCTION_DECL:
+ /* Clear current_function_decl, so that gen_subprogram_die thinks
+ that this is a declaration. At this point, we just want to force
+ declaration die. */
+ save_fn = current_function_decl;
+ current_function_decl = NULL_TREE;
+ gen_subprogram_die (decl, context_die);
+ current_function_decl = save_fn;
+ break;
+
+ case VAR_DECL:
+ /* Set external flag to force declaration die. Restore it after
+ gen_decl_die() call. */
+ saved_external_flag = DECL_EXTERNAL (decl);
+ DECL_EXTERNAL (decl) = 1;
+ gen_decl_die (decl, context_die);
+ DECL_EXTERNAL (decl) = saved_external_flag;
+ break;
+
+ case NAMESPACE_DECL:
+ dwarf2out_decl (decl);
+ break;
+
+ default:
+ abort ();
+ }
+
+ /* See if we can find the die for this deci now.
+ If not then abort. */
+ if (!decl_die)
+ decl_die = lookup_decl_die (decl);
+ if (!decl_die)
+ abort ();
+ }
+
+ return decl_die;
+}
+
+/* Returns the DIE for decl or aborts. */
static dw_die_ref
-force_namespace_die (tree ns)
+force_type_die (tree type)
{
- dw_die_ref ns_die;
+ dw_die_ref type_die;
- dwarf2out_decl (ns);
- ns_die = lookup_decl_die (ns);
- if (!ns_die)
- abort();
+ type_die = lookup_type_die (root_type (type));
+ if (!type_die)
+ {
+ dw_die_ref context_die;
+ if (TYPE_CONTEXT (type))
+ if (TYPE_P (TYPE_CONTEXT (type)))
+ context_die = force_type_die (TYPE_CONTEXT (type));
+ else
+ context_die = force_decl_die (TYPE_CONTEXT (type));
+ else
+ context_die = comp_unit_die;
- return ns_die;
+ gen_type_die (type, context_die);
+ type_die = lookup_type_die (root_type (type));
+ if (!type_die)
+ abort();
+ }
+ return type_die;
}
/* Force out any required namespaces to be able to output DECL,
tree context = DECL_P (thing) ? DECL_CONTEXT (thing) : TYPE_CONTEXT (thing);
if (context && TREE_CODE (context) == NAMESPACE_DECL)
/* Force out the namespace. */
- context_die = force_namespace_die (context);
+ context_die = force_decl_die (context);
return context_die;
}
/* Force out the namespace we are an alias of, if necessary. */
dw_die_ref origin_die
- = force_namespace_die (DECL_ABSTRACT_ORIGIN (decl));
+ = force_decl_die (DECL_ABSTRACT_ORIGIN (decl));
/* Now create the namespace alias DIE. */
dw_die_ref namespace_die
dwarf2out_decl (decl);
}
+/* Output debug information for imported module or decl. */
+
+static void
+dwarf2out_imported_module_or_decl (tree decl, tree context)
+{
+ dw_die_ref imported_die, at_import_die;
+ dw_die_ref scope_die;
+ unsigned file_index;
+
+ if (debug_info_level <= DINFO_LEVEL_TERSE)
+ return;
+
+ if (!decl)
+ abort ();
+
+ /* To emit DW_TAG_imported_module or DW_TAG_imported_decl, we need two DIEs.
+ We need decl DIE for reference and scope die. First, get DIE for the decl
+ itself. */
+
+ /* Get the scope die for decl context. Use comp_unit_die for global module
+ or decl. If die is not found for non globals, force new die. */
+ if (!context)
+ scope_die = comp_unit_die;
+ else if (TYPE_P (context))
+ scope_die = force_type_die (context);
+ else
+ scope_die = force_decl_die (context);
+
+ /* For TYPE_DECL, lookup TREE_TYPE. */
+ if (TREE_CODE (decl) == TYPE_DECL)
+ at_import_die = force_type_die (TREE_TYPE (decl));
+ else
+ at_import_die = force_decl_die (decl);
+
+ /* OK, now we have DIEs for decl as well as scope. Emit imported die. */
+ if (TREE_CODE (decl) == NAMESPACE_DECL)
+ imported_die = new_die (DW_TAG_imported_module, scope_die, context);
+ else
+ imported_die = new_die (DW_TAG_imported_declaration, scope_die, context);
+
+ file_index = lookup_filename (input_filename);
+ add_AT_unsigned (imported_die, DW_AT_decl_file, file_index);
+ add_AT_unsigned (imported_die, DW_AT_decl_line, input_line);
+ add_AT_die_ref (imported_die, DW_AT_import, at_import_die);
+}
+
/* Write the debugging output for DECL. */
void
/* The debug hooks structure. */
const struct gcc_debug_hooks sdb_debug_hooks =
{
- sdbout_init, /* init */
- sdbout_finish, /* finish */
- debug_nothing_int_charstar, /* define */
- debug_nothing_int_charstar, /* undef */
- sdbout_start_source_file, /* start_source_file */
- sdbout_end_source_file, /* end_source_file */
- sdbout_begin_block, /* begin_block */
- sdbout_end_block, /* end_block */
- debug_true_tree, /* ignore_block */
- sdbout_source_line, /* source_line */
+ sdbout_init, /* init */
+ sdbout_finish, /* finish */
+ debug_nothing_int_charstar, /* define */
+ debug_nothing_int_charstar, /* undef */
+ sdbout_start_source_file, /* start_source_file */
+ sdbout_end_source_file, /* end_source_file */
+ sdbout_begin_block, /* begin_block */
+ sdbout_end_block, /* end_block */
+ debug_true_tree, /* ignore_block */
+ sdbout_source_line, /* source_line */
#ifdef MIPS_DEBUGGING_INFO
/* Defer on MIPS systems so that parameter descriptions follow
function entry. */
- debug_nothing_int_charstar, /* begin_prologue */
- sdbout_end_prologue, /* end_prologue */
+ debug_nothing_int_charstar, /* begin_prologue */
+ sdbout_end_prologue, /* end_prologue */
#else
- sdbout_begin_prologue, /* begin_prologue */
- debug_nothing_int_charstar, /* end_prologue */
+ sdbout_begin_prologue, /* begin_prologue */
+ debug_nothing_int_charstar, /* end_prologue */
#endif
- sdbout_end_epilogue, /* end_epilogue */
- sdbout_begin_function, /* begin_function */
- sdbout_end_function, /* end_function */
- debug_nothing_tree, /* function_decl */
- sdbout_global_decl, /* global_decl */
- debug_nothing_tree, /* deferred_inline_function */
- debug_nothing_tree, /* outlining_inline_function */
- sdbout_label, /* label */
- debug_nothing_int /* handle_pch */
+ sdbout_end_epilogue, /* end_epilogue */
+ sdbout_begin_function, /* begin_function */
+ sdbout_end_function, /* end_function */
+ debug_nothing_tree, /* function_decl */
+ sdbout_global_decl, /* global_decl */
+ debug_nothing_tree_tree, /* imported_module_or_decl */
+ debug_nothing_tree, /* deferred_inline_function */
+ debug_nothing_tree, /* outlining_inline_function */
+ sdbout_label, /* label */
+ debug_nothing_int /* handle_pch */
};
/* Return a unique string to name an anonymous type. */
+2004-01-27 Devang Patel <dpatel@apple.com>
+
+ * g++.dg/debug/namespace1.C: New test.
+
2004-01-27 Ian Lance Taylor <ian@wasabisystems.com>
* gcc.dg/const-elim-1.c: Add xfail for strongarm-*-* and
--- /dev/null
+/* Test DWARF namespace support.
+ This test case is based on GDB testsuite test case. */
+/* { dg-do compile } */
+
+namespace AAA {
+ char c;
+ int i;
+ int A_xyzq (int);
+ char xyzq (char);
+ class inA {
+ public:
+ int xx;
+ int fum (int);
+ };
+};
+
+int AAA::inA::fum (int i)
+{
+ return 10 + i;
+}
+
+namespace BBB {
+ char c;
+ int i;
+ int B_xyzq (int);
+ char xyzq (char);
+
+ namespace CCC {
+ char xyzq (char);
+ };
+
+ class Class {
+ public:
+ char xyzq (char);
+ int dummy;
+ };
+};
+
+int AAA::A_xyzq (int x)
+{
+ return 2 * x;
+}
+
+char AAA::xyzq (char c)
+{
+ return 'a';
+}
+
+
+int BBB::B_xyzq (int x)
+{
+ return 3 * x;
+}
+
+char BBB::xyzq (char c)
+{
+ return 'b';
+}
+
+char BBB::CCC::xyzq (char c)
+{
+ return 'z';
+}
+
+char BBB::Class::xyzq (char c)
+{
+ return 'o';
+}
+
+void marker1(void)
+{
+ return;
+}
+
+namespace
+{
+ int X = 9;
+
+ namespace G
+ {
+ int Xg = 10;
+
+ namespace
+ {
+ int XgX = 11;
+ }
+ }
+}
+
+namespace H
+{
+ int h = 14;
+}
+
+namespace I = H;
+
+namespace J
+{
+ int j = 15;
+}
+
+using namespace J;
+
+namespace K
+{
+ int k = 16;
+}
+
+namespace L
+{
+ using namespace K;
+}
+
+namespace O
+{
+ int o = 18;
+}
+
+namespace P
+{
+ using namespace O;
+}
+
+namespace Q
+{
+ using namespace P;
+}
+
+namespace R
+{
+ int r1 = 19;
+ int r2 = 20;
+}
+
+using R::r1;
+
+namespace C
+{
+ int c = 1;
+ int shadow = 12;
+
+ class CClass {
+ public:
+ int x;
+ class NestedClass {
+ public:
+ int y;
+ };
+ };
+
+ namespace
+ {
+ int cX = 6;
+
+ namespace F
+ {
+ int cXf = 7;
+
+ namespace
+ {
+ int cXfX = 8;
+ }
+ }
+ }
+
+ namespace C
+ {
+ int cc = 2;
+ }
+
+ namespace E
+ {
+ int ce = 4;
+ }
+
+ namespace D
+ {
+ int cd = 3;
+ int shadow = 13;
+
+ namespace E
+ {
+ int cde = 5;
+ }
+
+ namespace M
+ {
+ int cdm = 17;
+ }
+
+ using namespace M;
+
+ void marker2 (void)
+ {
+ // NOTE: carlton/2003-04-23: I'm listing the expressions that I
+ // plan to have GDB try to print out, just to make sure that the
+ // compiler and I agree which ones should be legal! It's easy
+ // to screw up when testing the boundaries of namespace stuff.
+ c;
+ //cc;
+ C::cc;
+ cd;
+ //C::D::cd;
+ E::cde;
+ shadow;
+ //E::ce;
+ cX;
+ F::cXf;
+ F::cXfX;
+ X;
+ G::Xg;
+ //cXOtherFile;
+ //XOtherFile;
+ G::XgX;
+ I::h;
+ j;
+ L::k;
+ //k;
+ cdm;
+ Q::o;
+ //o;
+ r1;
+ //r2;
+
+ return;
+ }
+
+ }
+}
+
+int main ()
+{
+ using AAA::inA;
+ char c1;
+
+ using namespace BBB;
+
+ c1 = xyzq ('x');
+ c1 = AAA::xyzq ('x');
+ c1 = BBB::CCC::xyzq ('m');
+
+ inA ina;
+
+ ina.xx = 33;
+
+ int y;
+
+ y = AAA::A_xyzq (33);
+ y += B_xyzq (44);
+
+ BBB::Class cl;
+
+ c1 = cl.xyzq('e');
+
+ marker1();
+
+ C::D::marker2 ();
+}
vmsdbgout_end_function,
vmsdbgout_decl,
vmsdbgout_global_decl,
- debug_nothing_tree, /* deferred_inline_function */
+ debug_nothing_tree_tree, /* imported_module_or_decl */
+ debug_nothing_tree, /* deferred_inline_function */
vmsdbgout_abstract_function,
- debug_nothing_rtx, /* label */
- debug_nothing_int /* handle_pch */
+ debug_nothing_rtx, /* label */
+ debug_nothing_int /* handle_pch */
};
/* Definitions of defaults for assembler-dependent names of various