summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Output.cxx16
-rw-r--r--test/expect/gccxml.any.Class-member-template-access.xml.txt40
-rw-r--r--test/input/Class-member-template-access.cxx2
3 files changed, 30 insertions, 28 deletions
diff --git a/src/Output.cxx b/src/Output.cxx
index ebd0b17..13812d0 100644
--- a/src/Output.cxx
+++ b/src/Output.cxx
@@ -1647,15 +1647,13 @@ void ASTVisitor::OutputRecordDecl(clang::RecordDecl const* d,
this->PrintNameAttribute(rso.str());
}
clang::AccessSpecifier access = clang::AS_none;
- if (dx) {
- // If this is a template instantiation then get the access of the original
+ if (clang::ClassTemplateSpecializationDecl const* dxts =
+ clang::dyn_cast<clang::ClassTemplateSpecializationDecl>(d)) {
+ // This is a template instantiation so get the access of the original
// template. Access of the instantiation itself has no meaning.
- if (clang::CXXRecordDecl const* dxp =
- dx->getTemplateInstantiationPattern()) {
- if (clang::ClassTemplateDecl const* dxpt =
- dxp->getDescribedClassTemplate()) {
- access = dxpt->getAccess();
- }
+ if (clang::ClassTemplateDecl const* dxt =
+ dxts->getSpecializedTemplate()) {
+ access = dxt->getAccess();
}
}
this->PrintContextAttribute(d, access);
@@ -2104,7 +2102,7 @@ void ASTVisitor::HandleTranslationUnit(clang::TranslationUnitDecl const* tu)
// Start dump with gccxml-compatible format.
this->OS <<
"<?xml version=\"1.0\"?>\n"
- "<GCC_XML version=\"0.9.0\" cvs_revision=\"1.138\">\n"
+ "<GCC_XML version=\"0.9.0\" cvs_revision=\"1.139\">\n"
;
// Dump the complete nodes.
diff --git a/test/expect/gccxml.any.Class-member-template-access.xml.txt b/test/expect/gccxml.any.Class-member-template-access.xml.txt
index e2c0cd7..4c2a0fc 100644
--- a/test/expect/gccxml.any.Class-member-template-access.xml.txt
+++ b/test/expect/gccxml.any.Class-member-template-access.xml.txt
@@ -1,29 +1,31 @@
^<\?xml version="1.0"\?>
<GCC_XML[^>]*>
- <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
- <Class id="_3" name="member&lt;int&gt;" context="_1" access="private" location="f1:4" file="f1" line="4" members="_8 _9 _10 _11" size="[0-9]+" align="[0-9]+"/>
- <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
- <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
- <Argument type="_12" location="f1:1" file="f1" line="1"/>
+ <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7 _8 _9" size="[0-9]+" align="[0-9]+"/>
+ <Class id="_3" name="member&lt;char&gt;" context="_1" access="private" location="f1:2" file="f1" line="2" incomplete="1"/>
+ <Class id="_4" name="member&lt;int&gt;" context="_1" access="private" location="f1:6" file="f1" line="6" members="_10 _11 _12 _13" size="[0-9]+" align="[0-9]+"/>
+ <Typedef id="_5" name="member_char" type="_3" context="_1" access="public" location="f1:4" file="f1" line="4"/>
+ <Constructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+ <Constructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
+ <Argument type="_14" location="f1:1" file="f1" line="1"/>
</Constructor>
- <OperatorMethod id="_6" name="=" returns="_13" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
- <Argument type="_12" location="f1:1" file="f1" line="1"/>
+ <OperatorMethod id="_8" name="=" returns="_15" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+ <Argument type="_14" location="f1:1" file="f1" line="1"/>
</OperatorMethod>
- <Destructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
- <Constructor id="_8" name="member" context="_3" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
- <Constructor id="_9" name="member" context="_3" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?>
- <Argument type="_14" location="f1:4" file="f1" line="4"/>
+ <Destructor id="_9" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+ <Constructor id="_10" name="member" context="_4" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+ <Constructor id="_11" name="member" context="_4" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
+ <Argument type="_16" location="f1:6" file="f1" line="6"/>
</Constructor>
- <OperatorMethod id="_10" name="=" returns="_15" context="_3" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")? mangled="[^"]+">
- <Argument type="_14" location="f1:4" file="f1" line="4"/>
+ <OperatorMethod id="_12" name="=" returns="_17" context="_4" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+ <Argument type="_16" location="f1:6" file="f1" line="6"/>
</OperatorMethod>
- <Destructor id="_11" name="member" context="_3" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
- <ReferenceType id="_12" type="_1c"/>
+ <Destructor id="_13" name="member" context="_4" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+ <ReferenceType id="_14" type="_1c"/>
<CvQualifiedType id="_1c" type="_1" const="1"/>
- <ReferenceType id="_13" type="_1"/>
- <ReferenceType id="_14" type="_3c"/>
- <CvQualifiedType id="_3c" type="_3" const="1"/>
- <ReferenceType id="_15" type="_3"/>
+ <ReferenceType id="_15" type="_1"/>
+ <ReferenceType id="_16" type="_4c"/>
+ <CvQualifiedType id="_4c" type="_4" const="1"/>
+ <ReferenceType id="_17" type="_4"/>
<Namespace id="_2" name="::"/>
<File id="f1" name=".*/test/input/Class-member-template-access.cxx"/>
</GCC_XML>$
diff --git a/test/input/Class-member-template-access.cxx b/test/input/Class-member-template-access.cxx
index d05fe4b..1bcead7 100644
--- a/test/input/Class-member-template-access.cxx
+++ b/test/input/Class-member-template-access.cxx
@@ -1,4 +1,6 @@
class start {
template <typename> class member {};
+public:
+ typedef member<char> member_char; // incomplete
};
template class start::member<int>; // instantiation