summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-02-27 21:44:10 (GMT)
committerBrad King <brad.king@kitware.com>2014-03-21 21:08:13 (GMT)
commit4f01341b13d21eafd476a700632fe6d941bea57c (patch)
tree88ead4f226696bb397e3d763df242a47607480ab /test
parent9759bb5b42be2b6e08a137c89f98c0e3e56d0d3f (diff)
downloadCastXML-4f01341b13d21eafd476a700632fe6d941bea57c.zip
CastXML-4f01341b13d21eafd476a700632fe6d941bea57c.tar.gz
CastXML-4f01341b13d21eafd476a700632fe6d941bea57c.tar.bz2
Output: Generate MethodType and OffsetType elements
Implement the OutputMemberPointerType method. If a type is a pointer to a data member, call a new OutputOffsetType method to generate an OffsetType element representing it directly. If a type is a pointer to a function member, queue a DumpType node that holds the pointee function type and the containing class. Teach the main OutputType method to recognize this case and dispatch to a new OutputMethodType method to generate a MethodType element.
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt4
-rw-r--r--test/expect/gccxml.MethodType-cv-xml.txt13
-rw-r--r--test/expect/gccxml.MethodType-xml.txt12
-rw-r--r--test/expect/gccxml.OffsetType-cv-xml.txt11
-rw-r--r--test/expect/gccxml.OffsetType-xml.txt9
-rw-r--r--test/input/MethodType-cv.cxx2
-rw-r--r--test/input/MethodType.cxx2
-rw-r--r--test/input/OffsetType-cv.cxx2
-rw-r--r--test/input/OffsetType.cxx2
9 files changed, 57 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 66ec112..51f1fb7 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -80,7 +80,11 @@ castxml_test_gccxml(FunctionType)
castxml_test_gccxml(FunctionType-variadic)
castxml_test_gccxml(FundamentalType)
castxml_test_gccxml(Method)
+castxml_test_gccxml(MethodType)
+castxml_test_gccxml(MethodType-cv)
castxml_test_gccxml(Namespace)
+castxml_test_gccxml(OffsetType)
+castxml_test_gccxml(OffsetType-cv)
castxml_test_gccxml(OperatorFunction)
castxml_test_gccxml(OperatorMethod)
castxml_test_gccxml(PointerType)
diff --git a/test/expect/gccxml.MethodType-cv-xml.txt b/test/expect/gccxml.MethodType-cv-xml.txt
new file mode 100644
index 0000000..eaa84ca
--- /dev/null
+++ b/test/expect/gccxml.MethodType-cv-xml.txt
@@ -0,0 +1,13 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Typedef id="_1" name="start" type="_3cv" context="_4" location="f1:2" file="f1" line="2"/>
+ <CvQualifiedType id="_3cv" type="_3" const="1" volatile="1"/>
+ <PointerType id="_3" type="_5"/>
+ <Namespace id="_4" name="::"/>
+ <MethodType id="_5" basetype="_6" returns="_7" const="1" volatile="1">
+ <Argument type="_7"/>
+ </MethodType>
+ <Class id="_6" name="A" context="_4" location="f1:1" file="f1" line="1" incomplete="1"/>
+ <FundamentalType id="_7" name="int"/>
+ <File id="f1" name=".*/test/input/MethodType-cv.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.MethodType-xml.txt b/test/expect/gccxml.MethodType-xml.txt
new file mode 100644
index 0000000..dae67b0
--- /dev/null
+++ b/test/expect/gccxml.MethodType-xml.txt
@@ -0,0 +1,12 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Typedef id="_1" name="start" type="_2" context="_3" location="f1:2" file="f1" line="2"/>
+ <PointerType id="_2" type="_4"/>
+ <Namespace id="_3" name="::"/>
+ <MethodType id="_4" basetype="_5" returns="_6">
+ <Argument type="_6"/>
+ </MethodType>
+ <Class id="_5" name="A" context="_3" location="f1:1" file="f1" line="1" incomplete="1"/>
+ <FundamentalType id="_6" name="int"/>
+ <File id="f1" name=".*/test/input/MethodType.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.OffsetType-cv-xml.txt b/test/expect/gccxml.OffsetType-cv-xml.txt
new file mode 100644
index 0000000..7b849dc
--- /dev/null
+++ b/test/expect/gccxml.OffsetType-cv-xml.txt
@@ -0,0 +1,11 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Typedef id="_1" name="start" type="_3cv" context="_4" location="f1:2" file="f1" line="2"/>
+ <CvQualifiedType id="_3cv" type="_3" const="1" volatile="1"/>
+ <OffsetType id="_3" basetype="_5" type="_7cv"/>
+ <Class id="_5" name="A" context="_4" location="f1:1" file="f1" line="1" incomplete="1"/>
+ <CvQualifiedType id="_7cv" type="_7" const="1" volatile="1"/>
+ <FundamentalType id="_7" name="int"/>
+ <Namespace id="_4" name="::"/>
+ <File id="f1" name=".*/test/input/OffsetType-cv.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.OffsetType-xml.txt b/test/expect/gccxml.OffsetType-xml.txt
new file mode 100644
index 0000000..5a4c63e
--- /dev/null
+++ b/test/expect/gccxml.OffsetType-xml.txt
@@ -0,0 +1,9 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Typedef id="_1" name="start" type="_2" context="_3" location="f1:2" file="f1" line="2"/>
+ <OffsetType id="_2" basetype="_4" type="_5"/>
+ <Class id="_4" name="A" context="_3" location="f1:1" file="f1" line="1" incomplete="1"/>
+ <FundamentalType id="_5" name="int"/>
+ <Namespace id="_3" name="::"/>
+ <File id="f1" name=".*/test/input/OffsetType.cxx"/>
+</GCC_XML>$
diff --git a/test/input/MethodType-cv.cxx b/test/input/MethodType-cv.cxx
new file mode 100644
index 0000000..1ab435d
--- /dev/null
+++ b/test/input/MethodType-cv.cxx
@@ -0,0 +1,2 @@
+class A;
+typedef int (A::* const volatile start)(int) const volatile;
diff --git a/test/input/MethodType.cxx b/test/input/MethodType.cxx
new file mode 100644
index 0000000..2f9e67c
--- /dev/null
+++ b/test/input/MethodType.cxx
@@ -0,0 +1,2 @@
+class A;
+typedef int (A::* start)(int);
diff --git a/test/input/OffsetType-cv.cxx b/test/input/OffsetType-cv.cxx
new file mode 100644
index 0000000..efbc605
--- /dev/null
+++ b/test/input/OffsetType-cv.cxx
@@ -0,0 +1,2 @@
+class A;
+typedef int const volatile A::* const volatile start;
diff --git a/test/input/OffsetType.cxx b/test/input/OffsetType.cxx
new file mode 100644
index 0000000..5a030d5
--- /dev/null
+++ b/test/input/OffsetType.cxx
@@ -0,0 +1,2 @@
+class A;
+typedef int A::* start;