summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-04-11 17:24:34 (GMT)
committerBrad King <brad.king@kitware.com>2014-04-11 17:28:04 (GMT)
commitc785d1821c39fb02fb394d65af4d6065a594391b (patch)
treefabfe6474a94eaa79a7596791f7bfafc02ab7b71
parentaeb49468598774f683f1bc8bb50bd0e301a80fa3 (diff)
downloadCastXML-c785d1821c39fb02fb394d65af4d6065a594391b.zip
CastXML-c785d1821c39fb02fb394d65af4d6065a594391b.tar.gz
CastXML-c785d1821c39fb02fb394d65af4d6065a594391b.tar.bz2
Output: Drop class template partial specializations from output
Since gccxml format does not support uninstantiated templates we must not output any partial specializations either. Skip class template partial specializations when traversing context members. Desugar non-dependent typedef members of class template partial specializations.
-rw-r--r--src/Output.cxx7
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/expect/gccxml.any.Class-partial-template-member-Typedef.xml.txt22
-rw-r--r--test/expect/gccxml.any.Namespace-Class-partial-template-members.xml.txt5
-rw-r--r--test/input/Class-partial-template-member-Typedef.cxx7
-rw-r--r--test/input/Namespace-Class-partial-template-members.cxx7
6 files changed, 49 insertions, 1 deletions
diff --git a/src/Output.cxx b/src/Output.cxx
index 91f9705..574de3d 100644
--- a/src/Output.cxx
+++ b/src/Output.cxx
@@ -490,7 +490,9 @@ unsigned int ASTVisitor::AddDumpNode(DumpType dt, bool complete) {
if(clang::DeclContext const* tdc = tdt->getDecl()->getDeclContext()) {
if(clang::CXXRecordDecl const* tdx =
clang::dyn_cast<clang::CXXRecordDecl>(tdc)) {
- if(tdx->getDescribedClassTemplate()) {
+ if(tdx->getDescribedClassTemplate() ||
+ clang::isa<clang::ClassTemplatePartialSpecializationDecl>(tdx)
+ ) {
// This TypedefType refers to a non-dependent
// TypedefDecl member of a class template. Since gccxml
// format does not include uninstantiated templates we
@@ -899,6 +901,9 @@ void ASTVisitor::PrintMembersAttribute(clang::DeclContext const* dc)
static_cast<clang::ClassTemplateDecl const*>(d), &emitted);
continue;
} break;
+ case clang::Decl::ClassTemplatePartialSpecialization: {
+ continue;
+ } break;
case clang::Decl::Empty: {
continue;
} break;
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index a1f7c45..40d05e8 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -130,6 +130,7 @@ castxml_test_gccxml(Class-implicit-members)
castxml_test_gccxml(Class-incomplete)
castxml_test_gccxml(Class-incomplete-twice)
castxml_test_gccxml(Class-member-template)
+castxml_test_gccxml(Class-partial-template-member-Typedef)
castxml_test_gccxml(Class-template)
castxml_test_gccxml(Class-template-Method-Argument-default)
castxml_test_gccxml(Class-template-bases)
@@ -157,6 +158,7 @@ castxml_test_gccxml(MethodType)
castxml_test_gccxml(MethodType-cv)
castxml_test_gccxml(Namespace)
castxml_test_gccxml(Namespace-Class-members)
+castxml_test_gccxml(Namespace-Class-partial-template-members)
castxml_test_gccxml(Namespace-Class-template-members)
castxml_test_gccxml(Namespace-Function-template-members)
castxml_test_gccxml(Namespace-empty)
diff --git a/test/expect/gccxml.any.Class-partial-template-member-Typedef.xml.txt b/test/expect/gccxml.any.Class-partial-template-member-Typedef.xml.txt
new file mode 100644
index 0000000..e158f42
--- /dev/null
+++ b/test/expect/gccxml.any.Class-partial-template-member-Typedef.xml.txt
@@ -0,0 +1,22 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Class id="_1" name="start&lt;int &amp;&gt;" context="_2" location="f1:7" file="f1" line="7" members="_3 _4 _5 _6 _7 _8"/>
+ <Typedef id="_3" name="Int" type="_9" context="_1" access="private" location="f1:3" file="f1" line="3"/>
+ <Method id="_4" name="method" returns="_9" context="_1" access="public" location="f1:5" file="f1" line="5">
+ <Argument type="_9" location="f1:5" file="f1" line="5"/>
+ </Method>
+ <Constructor id="_5" name="start" context="_1" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"/>
+ <Constructor id="_6" name="start" context="_1" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1">
+ <Argument type="_10" location="f1:7" file="f1" line="7"/>
+ </Constructor>
+ <OperatorMethod id="_7" name="=" returns="_11" context="_1" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1">
+ <Argument type="_10" location="f1:7" file="f1" line="7"/>
+ </OperatorMethod>
+ <Destructor id="_8" name="start" context="_1" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"/>
+ <FundamentalType id="_9" name="int"/>
+ <ReferenceType id="_10" type="_1c"/>
+ <ReferenceType id="_11" type="_1"/>
+ <Namespace id="_2" name="::"/>
+ <CvQualifiedType id="_1c" type="_1" const="1"/>
+ <File id="f1" name=".*/test/input/Class-partial-template-member-Typedef.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Namespace-Class-partial-template-members.xml.txt b/test/expect/gccxml.any.Namespace-Class-partial-template-members.xml.txt
new file mode 100644
index 0000000..763161e
--- /dev/null
+++ b/test/expect/gccxml.any.Namespace-Class-partial-template-members.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Namespace id="_1" name="start" context="_2"/>
+ <Namespace id="_2" name="::"/>
+</GCC_XML>$
diff --git a/test/input/Class-partial-template-member-Typedef.cxx b/test/input/Class-partial-template-member-Typedef.cxx
new file mode 100644
index 0000000..ad72b49
--- /dev/null
+++ b/test/input/Class-partial-template-member-Typedef.cxx
@@ -0,0 +1,7 @@
+template <typename T> class start;
+template <typename T> class start<T&> {
+ typedef int Int;
+public:
+ int method(Int);
+};
+template class start<int&>;
diff --git a/test/input/Namespace-Class-partial-template-members.cxx b/test/input/Namespace-Class-partial-template-members.cxx
new file mode 100644
index 0000000..0c220c9
--- /dev/null
+++ b/test/input/Namespace-Class-partial-template-members.cxx
@@ -0,0 +1,7 @@
+namespace start {
+ template <typename T> class A;
+ template <typename T> class A<T&> {
+ static int data;
+ };
+ template <typename T> int A<T&>::data;
+}