From c785d1821c39fb02fb394d65af4d6065a594391b Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 11 Apr 2014 13:24:34 -0400 Subject: 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. --- src/Output.cxx | 7 ++++++- test/CMakeLists.txt | 2 ++ ...y.Class-partial-template-member-Typedef.xml.txt | 22 ++++++++++++++++++++++ ...amespace-Class-partial-template-members.xml.txt | 5 +++++ .../Class-partial-template-member-Typedef.cxx | 7 +++++++ .../Namespace-Class-partial-template-members.cxx | 7 +++++++ 6 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 test/expect/gccxml.any.Class-partial-template-member-Typedef.xml.txt create mode 100644 test/expect/gccxml.any.Namespace-Class-partial-template-members.xml.txt create mode 100644 test/input/Class-partial-template-member-Typedef.cxx create mode 100644 test/input/Namespace-Class-partial-template-members.cxx 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(tdc)) { - if(tdx->getDescribedClassTemplate()) { + if(tdx->getDescribedClassTemplate() || + clang::isa(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(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"\?> +]*> + + + + + + + + + + + + + + + + + + + +$ 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"\?> +]*> + + +$ 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 class start; +template class start { + typedef int Int; +public: + int method(Int); +}; +template class start; 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 class A; + template class A { + static int data; + }; + template int A::data; +} -- cgit v0.12