aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2004-01-27 12:36:02 -0800
committerDevang Patel <dpatel@gcc.gnu.org>2004-01-27 12:36:02 -0800
commit6097b0c31bc284cd0d68c67807e587596a0fb11d (patch)
tree22e0a88b1266b9aebde90de60d7105699f1310df /gcc/cp
parente6aecf8efdef48bbf70b2712d742ac4a2cb16e02 (diff)
downloadgcc-6097b0c31bc284cd0d68c67807e587596a0fb11d.zip
gcc-6097b0c31bc284cd0d68c67807e587596a0fb11d.tar.gz
gcc-6097b0c31bc284cd0d68c67807e587596a0fb11d.tar.bz2
Makefile.in (dwarf2out.o): Depend on input.h
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. testsuite: * g++.dg/debug/namespace1.C: New test. cp: * 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. From-SVN: r76746
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog14
-rw-r--r--gcc/cp/Make-lang.in5
-rw-r--r--gcc/cp/name-lookup.c72
3 files changed, 85 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 001c992..2bd3883 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,17 @@
+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
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index f4e58d5..3723a9f 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -262,11 +262,12 @@ cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_H) rtl.h integrate.h insn-config
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)
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 14f7b76..30ff8e5 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -30,6 +30,7 @@ Boston, MA 02111-1307, USA. */
#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);
@@ -42,7 +43,7 @@ static bool lookup_using_namespace (tree, cxx_binding *, tree,
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. */
@@ -2226,6 +2227,7 @@ void
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)
@@ -2264,6 +2266,10 @@ do_local_using_decl (tree decl, tree scope, tree name)
}
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
@@ -2829,6 +2835,15 @@ do_class_using_decl (tree decl)
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;
}
@@ -3135,6 +3150,9 @@ do_namespace_alias (tree alias, tree namespace)
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,
@@ -3238,6 +3256,7 @@ void
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);
@@ -3251,6 +3270,10 @@ do_toplevel_using_decl (tree decl, tree scope, tree 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;
@@ -3264,6 +3287,8 @@ do_toplevel_using_decl (tree decl, tree scope, tree name)
void
do_using_directive (tree namespace)
{
+ tree context = NULL_TREE;
+
if (building_stmt_tree ())
add_stmt (build_stmt (USING_STMT, namespace));
@@ -3285,10 +3310,21 @@ do_using_directive (tree 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
@@ -4803,4 +4839,32 @@ pop_everything (void)
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"