From de2acaa079cbf6bcb1db8fecd956789360d9dd5c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 15 Nov 2010 12:34:44 +0200 Subject: Maintain GCC tree node for all semantic graph nodes --- odb/parser.cxx | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'odb/parser.cxx') diff --git a/odb/parser.cxx b/odb/parser.cxx index 528b55b..0598444 100644 --- a/odb/parser.cxx +++ b/odb/parser.cxx @@ -408,7 +408,7 @@ emit_class (tree c, path const& file, size_t line, size_t clmn, bool stub) type& type_node (emit_type (t, file, line, clmn)); data_member& member_node ( - unit_->new_node (file, line, clmn)); + unit_->new_node (file, line, clmn, d)); unit_->new_edge (*c_node, member_node, name, a); belongs& edge (unit_->new_edge (member_node, type_node)); @@ -561,7 +561,7 @@ emit_union (tree u, path const& file, size_t line, size_t clmn, bool stub) type& type_node (emit_type (t, file, line, clmn)); data_member& member_node ( - unit_->new_node (file, line, clmn)); + unit_->new_node (file, line, clmn, d)); unit_->new_edge (*u_node, member_node, name, a); belongs& edge (unit_->new_edge (member_node, type_node)); @@ -772,9 +772,14 @@ emit () << DECL_SOURCE_LINE (decl) << endl; // Use the declarations's file, line, and column as an - // approximation for this namespace origin. + // approximation for this namespace origin. Also resolve + // the tree node for this namespace. // - namespace_& node (unit_->new_node (f, l, c)); + namespace_& node ( + unit_->new_node ( + f, l, c, + namespace_binding ( + get_identifier (n.c_str ()), scope_->tree_node ()))); unit_->new_edge (*scope_, node, n); scope_ = &node; @@ -1034,6 +1039,7 @@ emit_class_template (tree t, bool stub) // See if there is a stub already for this template. // class_template* ct_node (0); + tree c (TREE_TYPE (DECL_TEMPLATE_RESULT (t))); if (node* n = unit_->find (t)) { @@ -1042,15 +1048,13 @@ emit_class_template (tree t, bool stub) else { path f (DECL_SOURCE_FILE (t)); - size_t l (DECL_SOURCE_LINE (t)); - size_t c (DECL_SOURCE_COLUMN (t)); + size_t ln (DECL_SOURCE_LINE (t)); + size_t cl (DECL_SOURCE_COLUMN (t)); - ct_node = &unit_->new_node (f, l, c); + ct_node = &unit_->new_node (f, ln, cl, c); unit_->insert (t, *ct_node); } - tree c (TREE_TYPE (DECL_TEMPLATE_RESULT (t))); - if (stub || !COMPLETE_TYPE_P (c)) return *ct_node; @@ -1118,6 +1122,7 @@ emit_union_template (tree t, bool stub) // See if there is a stub already for this template. // union_template* ut_node (0); + tree u (TREE_TYPE (DECL_TEMPLATE_RESULT (t))); if (node* n = unit_->find (t)) { @@ -1129,12 +1134,10 @@ emit_union_template (tree t, bool stub) size_t l (DECL_SOURCE_LINE (t)); size_t c (DECL_SOURCE_COLUMN (t)); - ut_node = &unit_->new_node (f, l, c); + ut_node = &unit_->new_node (f, l, c, u); unit_->insert (t, *ut_node); } - tree u (TREE_TYPE (DECL_TEMPLATE_RESULT (t))); - if (stub || !COMPLETE_TYPE_P (u)) return *ut_node; @@ -1227,7 +1230,7 @@ emit_enum (tree e, path const& file, size_t line, size_t clmn, bool stub) // There doesn't seem to be a way to get the proper position for // each enumerator. // - enumerator& er_node = unit_->new_node (file, line, clmn); + enumerator& er_node = unit_->new_node (file, line, clmn, er); unit_->new_edge (*e_node, er_node); if (trace) -- cgit v1.1