summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-09-21 13:44:48 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-09-21 13:47:01 +0200
commitdc466fcb04c0c9a5510676b3e896ed7b590e8842 (patch)
treeb4b9f8eb05adc902e2f5fcc8b5040b430cf094e6
parentcb8ee37ec0437f135d6c64102dae231f431b9ff5 (diff)
Skip declarations inside anonymous namespaces
There could be nothing of interest to us inside but they wreck havoc with our attempts to sort declarations into namespaces.
-rw-r--r--odb/parser.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/odb/parser.cxx b/odb/parser.cxx
index 719a3d2..d02de78 100644
--- a/odb/parser.cxx
+++ b/odb/parser.cxx
@@ -942,9 +942,10 @@ collect (tree ns)
if (!DECL_IS_BUILTIN (decl) || DECL_NAMESPACE_STD_P (decl))
{
+ tree dn (DECL_NAME (decl));
+
if (trace)
{
- tree dn (DECL_NAME (decl));
char const* name (dn ? IDENTIFIER_POINTER (dn) : "<anonymous>");
ts << "namespace " << name << " at "
@@ -952,7 +953,12 @@ collect (tree ns)
<< DECL_SOURCE_LINE (decl) << endl;
}
- collect (decl);
+ // Skip anonymous namespaces (there could be nothing of interest to us
+ // inside but they wreck havoc with our attempts to sort declarations
+ // into namespaces).
+ //
+ if (dn != 0)
+ collect (decl);
}
}
}