From 4bd98e886012817fcfd40aa4c8329fa48f69b0a9 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 10 May 2010 17:43:18 +0000 Subject: Improved -ast-print-xml for C++, from Sebastien Binet! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103412 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/DocumentXML.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'lib/Frontend/DocumentXML.cpp') diff --git a/lib/Frontend/DocumentXML.cpp b/lib/Frontend/DocumentXML.cpp index 0263c30bfd..894f230216 100644 --- a/lib/Frontend/DocumentXML.cpp +++ b/lib/Frontend/DocumentXML.cpp @@ -198,6 +198,35 @@ void DocumentXML::addPtrAttribute(const char* pAttributeName, addAttribute(pAttributeName, getPrefixedId(BasicTypes[pType], ID_NORMAL)); } +//--------------------------------------------------------- +void DocumentXML::addPtrAttribute(const char* pAttributeName, + const NestedNameSpecifier* pNNS) { + switch (pNNS->getKind()) { + case NestedNameSpecifier::Identifier: { + IdentifierInfo *ii = pNNS->getAsIdentifier(); + // FIXME how should we handle those ? + addPtrAttribute(pAttributeName, ii->getName().data()); + break; + } + case NestedNameSpecifier::Namespace: { + addPtrAttribute(pAttributeName, pNNS->getAsNamespace()); + break; + } + case NestedNameSpecifier::TypeSpec: { + addPtrAttribute(pAttributeName, pNNS->getAsType()); + break; + } + case NestedNameSpecifier::TypeSpecWithTemplate: { + addPtrAttribute(pAttributeName, pNNS->getAsType()); + break; + } + case NestedNameSpecifier::Global: { + addPtrAttribute(pAttributeName, "::"); + break; + } + } +} + //--------------------------------------------------------- void DocumentXML::addTypeRecursively(const QualType& pType) { -- cgit v1.2.3-18-g5258