summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-03-21 15:28:05 (GMT)
committerBrad King <brad.king@kitware.com>2016-03-21 15:50:17 (GMT)
commit1604e1a7ac8d417509c656135eff489ea970e4d2 (patch)
tree0623c1a652cbb4ada9d4a9d3b274af0064071682 /test
parent5a90589770fd53510981f943844cb488eb58bd91 (diff)
downloadCastXML-1604e1a7ac8d417509c656135eff489ea970e4d2.zip
CastXML-1604e1a7ac8d417509c656135eff489ea970e4d2.tar.gz
CastXML-1604e1a7ac8d417509c656135eff489ea970e4d2.tar.bz2
Output: Fix unnamed enum value references in default arguments
In code like namespace ns { enum { E = 0 }; void f(int = E); } we use `clang::NamedDecl::printQualifiedName` to print the fully qualified name of the enum constant `E`. However, the method produces `ns::::E` when the enumeration type itself is not named. Work around this problem by removing one of the `::` from the result. GitHub-Issue: CastXML/CastXML#52
Diffstat (limited to 'test')
-rw-r--r--test/expect/gccxml.any.Function-Argument-default-ns.xml.txt18
-rw-r--r--test/input/Function-Argument-default-ns.cxx3
2 files changed, 13 insertions, 8 deletions
diff --git a/test/expect/gccxml.any.Function-Argument-default-ns.xml.txt b/test/expect/gccxml.any.Function-Argument-default-ns.xml.txt
index ed41250..c6a3282 100644
--- a/test/expect/gccxml.any.Function-Argument-default-ns.xml.txt
+++ b/test/expect/gccxml.any.Function-Argument-default-ns.xml.txt
@@ -1,13 +1,17 @@
^<\?xml version="1.0"\?>
<GCC_XML[^>]*>
- <Namespace id="_1" name="start" context="_2" members="_3 _4"/>
- <Variable id="_3" name="C" type="_5c" init="0" context="_1" location="f1:2" file="f1" line="2" static="1" mangled="[^"]+"/>
- <Function id="_4" name="f" returns="_6" context="_1" location="f1:3" file="f1" line="3" mangled="[^"]+">
- <Argument type="_5" location="f1:3" file="f1" line="3" default="start::C"/>
+ <Namespace id="_1" name="start" context="_2" members="_3 _4 _5"/>
+ <Variable id="_3" name="C" type="_6c" init="0" context="_1" location="f1:2" file="f1" line="2" static="1" mangled="[^"]+"/>
+ <Enumeration id="_4" name="" context="_1" location="f1:3" file="f1" line="3">
+ <EnumValue name="E" init="0"/>
+ </Enumeration>
+ <Function id="_5" name="f" returns="_7" context="_1" location="f1:4" file="f1" line="4" mangled="[^"]+">
+ <Argument type="_6" location="f1:4" file="f1" line="4" default="start::C"/>
+ <Argument type="_6" location="f1:4" file="f1" line="4" default="start::E"/>
</Function>
- <FundamentalType id="_5" name="int" size="[0-9]+" align="[0-9]+"/>
- <CvQualifiedType id="_5c" type="_5" const="1"/>
- <FundamentalType id="_6" name="void" size="[0-9]+" align="[0-9]+"/>
+ <FundamentalType id="_6" name="int" size="[0-9]+" align="[0-9]+"/>
+ <CvQualifiedType id="_6c" type="_6" const="1"/>
+ <FundamentalType id="_7" name="void" size="[0-9]+" align="[0-9]+"/>
<Namespace id="_2" name="::"/>
<File id="f1" name=".*/test/input/Function-Argument-default-ns.cxx"/>
</GCC_XML>$
diff --git a/test/input/Function-Argument-default-ns.cxx b/test/input/Function-Argument-default-ns.cxx
index 72a7941..b2fc53e 100644
--- a/test/input/Function-Argument-default-ns.cxx
+++ b/test/input/Function-Argument-default-ns.cxx
@@ -1,4 +1,5 @@
namespace start {
static int const C = 0;
- void f(int = C);
+ enum { E = 0 };
+ void f(int = C, int = E);
}