summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Output.cxx6
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/expect/gccxml.any.Namespace-repeat-start.xml.txt9
-rw-r--r--test/expect/gccxml.any.Namespace-repeat.xml.txt10
-rw-r--r--test/input/Namespace-repeat-start.cxx6
-rw-r--r--test/input/Namespace-repeat.cxx8
6 files changed, 40 insertions, 1 deletions
diff --git a/src/Output.cxx b/src/Output.cxx
index 0d4931b..6299cb8 100644
--- a/src/Output.cxx
+++ b/src/Output.cxx
@@ -1239,7 +1239,11 @@ void ASTVisitor::OutputNamespaceDecl(
this->PrintNameAttribute(d->getName().str());
this->PrintContextAttribute(d);
if(dn->Complete) {
- this->PrintMembersAttribute(d);
+ std::set<unsigned int> emitted;
+ for (clang::NamespaceDecl const* r: d->redecls()) {
+ this->AddDeclContextMembers(r, emitted);
+ }
+ this->PrintMembersAttribute(emitted);
}
this->OS << "/>\n";
}
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 9febe91..aa0a2fa 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -191,6 +191,8 @@ castxml_test_gccxml(Namespace-Class-template-members)
castxml_test_gccxml(Namespace-Function-template-members)
castxml_test_gccxml(Namespace-empty)
castxml_test_gccxml(Namespace-extern-C-members)
+castxml_test_gccxml(Namespace-repeat)
+castxml_test_gccxml(Namespace-repeat-start)
castxml_test_gccxml(OffsetType)
castxml_test_gccxml(OffsetType-cv)
castxml_test_gccxml(OperatorFunction)
diff --git a/test/expect/gccxml.any.Namespace-repeat-start.xml.txt b/test/expect/gccxml.any.Namespace-repeat-start.xml.txt
new file mode 100644
index 0000000..7ead3fe
--- /dev/null
+++ b/test/expect/gccxml.any.Namespace-repeat-start.xml.txt
@@ -0,0 +1,9 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Namespace id="_1" name="start" context="_2" members="_3 _4"/>
+ <Function id="_3" name="f1" returns="_5" context="_1" location="f1:2" file="f1" line="2"/>
+ <Function id="_4" name="f2" returns="_5" context="_1" location="f1:5" file="f1" line="5"/>
+ <FundamentalType id="_5" name="void"/>
+ <Namespace id="_2" name="::"/>
+ <File id="f1" name=".*/test/input/Namespace-repeat-start.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Namespace-repeat.xml.txt b/test/expect/gccxml.any.Namespace-repeat.xml.txt
new file mode 100644
index 0000000..0468c7b
--- /dev/null
+++ b/test/expect/gccxml.any.Namespace-repeat.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Namespace id="_1" name="start" context="_2" members="_3"/>
+ <Namespace id="_3" name="ns" context="_1" members="_4 _5"/>
+ <Function id="_4" name="f1" returns="_6" context="_3" location="f1:3" file="f1" line="3"/>
+ <Function id="_5" name="f2" returns="_6" context="_3" location="f1:6" file="f1" line="6"/>
+ <FundamentalType id="_6" name="void"/>
+ <Namespace id="_2" name="::"/>
+ <File id="f1" name=".*/test/input/Namespace-repeat.cxx"/>
+</GCC_XML>$
diff --git a/test/input/Namespace-repeat-start.cxx b/test/input/Namespace-repeat-start.cxx
new file mode 100644
index 0000000..feb9d5c
--- /dev/null
+++ b/test/input/Namespace-repeat-start.cxx
@@ -0,0 +1,6 @@
+namespace start {
+ void f1();
+}
+namespace start {
+ void f2();
+}
diff --git a/test/input/Namespace-repeat.cxx b/test/input/Namespace-repeat.cxx
new file mode 100644
index 0000000..00f3d38
--- /dev/null
+++ b/test/input/Namespace-repeat.cxx
@@ -0,0 +1,8 @@
+namespace start {
+ namespace ns {
+ void f1();
+ }
+ namespace ns {
+ void f2();
+ }
+}