aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 7b44ad6..c1c6719 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1385,6 +1385,30 @@ decl_namespace_context (tree decl)
}
}
+/* Returns true if decl is within an anonymous namespace, however deeply
+ nested, or false otherwise. */
+
+bool
+decl_anon_ns_mem_p (tree decl)
+{
+ while (1)
+ {
+ if (decl == NULL_TREE)
+ return false;
+ if (TREE_CODE (decl) == NAMESPACE_DECL
+ && DECL_NAME (decl) == NULL_TREE)
+ return true;
+ /* Classes and namespaces inside anonymous namespaces have
+ TREE_PUBLIC == 0, so we can shortcut the search. */
+ else if (TYPE_P (decl))
+ return (TREE_PUBLIC (TYPE_NAME (decl)) == 0);
+ else if (TREE_CODE (decl) == NAMESPACE_DECL)
+ return (TREE_PUBLIC (decl) == 0);
+ else
+ decl = DECL_CONTEXT (decl);
+ }
+}
+
/* Return truthvalue of whether T1 is the same tree structure as T2.
Return 1 if they are the same. Return 0 if they are different. */
@@ -2181,7 +2205,8 @@ decl_linkage (tree decl)
template instantiations have internal linkage (in the object
file), but the symbols should still be treated as having external
linkage from the point of view of the language. */
- if (TREE_CODE (decl) != TYPE_DECL && DECL_LANG_SPECIFIC (decl) && DECL_COMDAT (decl))
+ if (TREE_CODE (decl) != TYPE_DECL && DECL_LANG_SPECIFIC (decl)
+ && DECL_COMDAT (decl))
return lk_external;
/* Things in local scope do not have linkage, if they don't have