diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-06-02 11:02:26 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-06-02 11:02:26 +0000 |
commit | f7564df45462679c3b0b82f2942f5fb50b640113 (patch) | |
tree | 403d78b8f25ea4a6278b4ce5e2c98da1d4a2562f /gcc/cp/decl2.c | |
parent | d2a7c9b9d37899fb653f99de95ac2a401877f8de (diff) | |
download | gcc-f7564df45462679c3b0b82f2942f5fb50b640113.tar.gz |
* name-lookup.h (cp_binding_level): Lose namespaces field.
* name-lookup.c (add_decl_to_level): Chain namespaces on the names
list.
(suggest_alternatives_for): Adjust for namespace list. Do
breadth-first search.
* decl2.c (collect_source_refs): Namespaces are on the regulr
list.
(collect_ada_namespace): Likewise.
* g++.dg/pr45330.C: Adjust. Check breadth-firstness.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248821 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index a095901be09..16454375ffd 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4052,21 +4052,14 @@ cpp_check (tree t, cpp_operation op) static void collect_source_refs (tree namespc) { - tree t; - - if (!namespc) - return; - /* Iterate over names in this name space. */ - for (t = NAMESPACE_LEVEL (namespc)->names; t; t = TREE_CHAIN (t)) - if (!DECL_IS_BUILTIN (t) ) + for (tree t = NAMESPACE_LEVEL (namespc)->names; t; t = TREE_CHAIN (t)) + if (DECL_IS_BUILTIN (t)) + ; + else if (TREE_CODE (t) == NAMESPACE_DECL && !DECL_NAMESPACE_ALIAS (t)) + collect_source_refs (t); + else collect_source_ref (DECL_SOURCE_FILE (t)); - - /* Dump siblings, if any */ - collect_source_refs (TREE_CHAIN (namespc)); - - /* Dump children, if any */ - collect_source_refs (NAMESPACE_LEVEL (namespc)->namespaces); } /* Collect decls relevant to SOURCE_FILE from all namespaces recursively, @@ -4075,17 +4068,16 @@ collect_source_refs (tree namespc) static void collect_ada_namespace (tree namespc, const char *source_file) { - if (!namespc) - return; - - /* Collect decls from this namespace */ - collect_ada_nodes (NAMESPACE_LEVEL (namespc)->names, source_file); + tree decl = NAMESPACE_LEVEL (namespc)->names; - /* Collect siblings, if any */ - collect_ada_namespace (TREE_CHAIN (namespc), source_file); + /* Collect decls from this namespace. This will skip + NAMESPACE_DECLs (both aliases and regular, it cannot tell). */ + collect_ada_nodes (decl, source_file); - /* Collect children, if any */ - collect_ada_namespace (NAMESPACE_LEVEL (namespc)->namespaces, source_file); + /* Now scan for namespace children, and dump them. */ + for (; decl; decl = TREE_CHAIN (decl)) + if (TREE_CODE (decl) == NAMESPACE_DECL && !DECL_NAMESPACE_ALIAS (decl)) + collect_ada_namespace (decl, source_file); } /* Returns true iff there is a definition available for variable or |