summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-02-18 15:56:53 (GMT)
committerBrad King <brad.king@kitware.com>2014-03-21 18:40:41 (GMT)
commit8894bed3e516fcabd82a349a61fce237570aa85e (patch)
tree0de8f1ff6a68b409349e98bed2b33c642f76048b
parent0a33a962a82a66794cd6ca9fc79d1260d3a781c4 (diff)
downloadCastXML-8894bed3e516fcabd82a349a61fce237570aa85e.zip
CastXML-8894bed3e516fcabd82a349a61fce237570aa85e.tar.gz
CastXML-8894bed3e516fcabd82a349a61fce237570aa85e.tar.bz2
Output: Generate ReferenceType elements
Implement the OutputLValueReferenceType method to generate the RefernceType element. Report the type="" of the pointee and queue it.
-rw-r--r--src/Output.cxx12
-rw-r--r--test/CMakeLists.txt1
-rw-r--r--test/expect/gccxml.ReferenceType-xml.txt8
-rw-r--r--test/input/ReferenceType.cxx1
4 files changed, 22 insertions, 0 deletions
diff --git a/src/Output.cxx b/src/Output.cxx
index 25e52e4..e47a445 100644
--- a/src/Output.cxx
+++ b/src/Output.cxx
@@ -217,6 +217,8 @@ class ASTVisitor: public ASTVisitorBase
// Type node output methods.
void OutputBuiltinType(clang::BuiltinType const* t, DumpNode const* dn);
+ void OutputLValueReferenceType(clang::LValueReferenceType const* t,
+ DumpNode const* dn);
void OutputPointerType(clang::PointerType const* t, DumpNode const* dn);
/** Queue declarations matching given qualified name in given context. */
@@ -679,6 +681,16 @@ void ASTVisitor::OutputBuiltinType(clang::BuiltinType const* t,
}
//----------------------------------------------------------------------------
+void ASTVisitor::OutputLValueReferenceType(clang::LValueReferenceType const* t,
+ DumpNode const* dn)
+{
+ this->OS << " <ReferenceType";
+ this->PrintIdAttribute(dn);
+ this->PrintTypeAttribute(t->getPointeeType(), false);
+ this->OS << "/>\n";
+}
+
+//----------------------------------------------------------------------------
void ASTVisitor::OutputPointerType(clang::PointerType const* t,
DumpNode const* dn)
{
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index f0fe95d..b47f528 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -57,3 +57,4 @@ castxml_test_gccxml(CvQualifiedType)
castxml_test_gccxml(FundamentalType)
castxml_test_gccxml(Namespace)
castxml_test_gccxml(PointerType)
+castxml_test_gccxml(ReferenceType)
diff --git a/test/expect/gccxml.ReferenceType-xml.txt b/test/expect/gccxml.ReferenceType-xml.txt
new file mode 100644
index 0000000..ec38243
--- /dev/null
+++ b/test/expect/gccxml.ReferenceType-xml.txt
@@ -0,0 +1,8 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/>
+ <ReferenceType id="_2" type="_4"/>
+ <Namespace id="_3" name="::"/>
+ <FundamentalType id="_4" name="int"/>
+ <File id="f1" name=".*/test/input/ReferenceType.cxx"/>
+</GCC_XML>$
diff --git a/test/input/ReferenceType.cxx b/test/input/ReferenceType.cxx
new file mode 100644
index 0000000..6cfa692
--- /dev/null
+++ b/test/input/ReferenceType.cxx
@@ -0,0 +1 @@
+typedef int &start;