Commit 6097b0c3 by Devang Patel Committed by Devang Patel

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
parent e6aecf8e
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
......
......@@ -1599,7 +1599,7 @@ dwarf2out.o : dwarf2out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
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
......
......@@ -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)
......@@ -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);
context = current_scope ();
}
else
{
/* 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"
......@@ -384,7 +384,8 @@ const struct gcc_debug_hooks dbx_debug_hooks =
dbxout_end_block,
debug_true_tree, /* ignore_block */
dbxout_source_line, /* source_line */
dbxout_source_line, /* begin_prologue: just output line info */
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
......@@ -395,6 +396,7 @@ const struct gcc_debug_hooks dbx_debug_hooks =
debug_nothing_int, /* end_function */
dbxout_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 */
......@@ -422,6 +424,7 @@ const struct gcc_debug_hooks xcoff_debug_hooks =
xcoffout_end_function,
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 */
......
......@@ -41,6 +41,7 @@ const struct gcc_debug_hooks do_nothing_debug_hooks =
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 */
......@@ -60,6 +61,12 @@ debug_nothing_tree (tree decl ATTRIBUTE_UNUSED)
{
}
void
debug_nothing_tree_tree (tree t1 ATTRIBUTE_UNUSED,
tree t2 ATTRIBUTE_UNUSED)
{
}
bool
debug_true_tree (tree block ATTRIBUTE_UNUSED)
{
......
......@@ -89,6 +89,9 @@ struct gcc_debug_hooks
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);
......@@ -116,6 +119,7 @@ extern void debug_nothing_int_charstar (unsigned int, const char *);
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);
......
......@@ -331,6 +331,7 @@ const struct gcc_debug_hooks sdb_debug_hooks =
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 */
......
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
......
/* 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 ();
}
......@@ -186,6 +186,7 @@ const struct gcc_debug_hooks vmsdbg_debug_hooks
vmsdbgout_end_function,
vmsdbgout_decl,
vmsdbgout_global_decl,
debug_nothing_tree_tree, /* imported_module_or_decl */
debug_nothing_tree, /* deferred_inline_function */
vmsdbgout_abstract_function,
debug_nothing_rtx, /* label */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment