aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Frontend/ASTConsumers.cpp34
-rw-r--r--lib/Frontend/CMakeLists.txt4
-rw-r--r--lib/Frontend/CompilerInvocation.cpp3
-rw-r--r--lib/Frontend/DeclXML.cpp183
-rw-r--r--lib/Frontend/DocumentXML.cpp381
-rw-r--r--lib/Frontend/FrontendActions.cpp7
-rw-r--r--lib/Frontend/StmtXML.cpp123
-rw-r--r--lib/Frontend/TypeXML.cpp119
-rw-r--r--lib/FrontendTool/ExecuteCompilerInvocation.cpp1
9 files changed, 0 insertions, 855 deletions
diff --git a/lib/Frontend/ASTConsumers.cpp b/lib/Frontend/ASTConsumers.cpp
index 92fb1e8cbe..f198d955e8 100644
--- a/lib/Frontend/ASTConsumers.cpp
+++ b/lib/Frontend/ASTConsumers.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "clang/Frontend/ASTConsumers.h"
-#include "clang/Frontend/DocumentXML.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/FileManager.h"
@@ -51,39 +50,6 @@ ASTConsumer *clang::CreateASTPrinter(llvm::raw_ostream* out) {
return new ASTPrinter(out);
}
-//===----------------------------------------------------------------------===//
-/// ASTPrinterXML - XML-printer of ASTs
-
-namespace {
- class ASTPrinterXML : public ASTConsumer {
- DocumentXML Doc;
-
- public:
- ASTPrinterXML(llvm::raw_ostream& o) : Doc("CLANG_XML", o) {}
-
- void Initialize(ASTContext &Context) {
- Doc.initialize(Context);
- }
-
- virtual void HandleTranslationUnit(ASTContext &Ctx) {
- Doc.addSubNode("TranslationUnit");
- for (DeclContext::decl_iterator
- D = Ctx.getTranslationUnitDecl()->decls_begin(),
- DEnd = Ctx.getTranslationUnitDecl()->decls_end();
- D != DEnd;
- ++D)
- Doc.PrintDecl(*D);
- Doc.toParent();
- Doc.finalize();
- }
- };
-} // end anonymous namespace
-
-
-ASTConsumer *clang::CreateASTPrinterXML(llvm::raw_ostream* out) {
- return new ASTPrinterXML(out ? *out : llvm::outs());
-}
-
ASTConsumer *clang::CreateASTDumper() {
return new ASTPrinter(0, true);
}
diff --git a/lib/Frontend/CMakeLists.txt b/lib/Frontend/CMakeLists.txt
index 9f197b4f87..91c3a68dea 100644
--- a/lib/Frontend/CMakeLists.txt
+++ b/lib/Frontend/CMakeLists.txt
@@ -16,10 +16,8 @@ add_clang_library(clangFrontend
CacheTokens.cpp
CompilerInstance.cpp
CompilerInvocation.cpp
- DeclXML.cpp
DependencyFile.cpp
DiagChecker.cpp
- DocumentXML.cpp
FrontendAction.cpp
FrontendActions.cpp
FrontendOptions.cpp
@@ -29,10 +27,8 @@ add_clang_library(clangFrontend
LangStandards.cpp
MultiplexConsumer.cpp
PrintPreprocessedOutput.cpp
- StmtXML.cpp
TextDiagnosticBuffer.cpp
TextDiagnosticPrinter.cpp
- TypeXML.cpp
VerifyDiagnosticsClient.cpp
Warnings.cpp
)
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index bf4d6cd86a..8f99403923 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -322,7 +322,6 @@ static const char *getActionName(frontend::ActionKind Kind) {
case frontend::ASTDump: return "-ast-dump";
case frontend::ASTDumpXML: return "-ast-dump-xml";
case frontend::ASTPrint: return "-ast-print";
- case frontend::ASTPrintXML: return "-ast-print-xml";
case frontend::ASTView: return "-ast-view";
case frontend::BoostCon: return "-boostcon";
case frontend::CreateModule: return "-create-module";
@@ -1039,8 +1038,6 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
Opts.ProgramAction = frontend::ASTDumpXML; break;
case OPT_ast_print:
Opts.ProgramAction = frontend::ASTPrint; break;
- case OPT_ast_print_xml:
- Opts.ProgramAction = frontend::ASTPrintXML; break;
case OPT_ast_view:
Opts.ProgramAction = frontend::ASTView; break;
case OPT_boostcon:
diff --git a/lib/Frontend/DeclXML.cpp b/lib/Frontend/DeclXML.cpp
deleted file mode 100644
index 8d3d225a4b..0000000000
--- a/lib/Frontend/DeclXML.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-//===--- DeclXML.cpp - XML implementation for Decl ASTs -------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the XML document class, which provides the means to
-// dump out the AST in a XML form that exposes type details and other fields.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Frontend/DocumentXML.h"
-#include "clang/AST/DeclVisitor.h"
-#include "clang/AST/Expr.h"
-
-namespace clang {
-
-//---------------------------------------------------------
-class DocumentXML::DeclPrinter : public DeclVisitor<DocumentXML::DeclPrinter> {
- DocumentXML& Doc;
-
- void addSubNodes(FunctionDecl* FD) {
- for (unsigned i = 0, e = FD->getNumParams(); i != e; ++i) {
- Visit(FD->getParamDecl(i));
- Doc.toParent();
- }
- }
-
- void addFunctionBody(FunctionDecl* FD) {
- if (FD->isThisDeclarationADefinition()) {
- Doc.addSubNode("Body");
- Doc.PrintStmt(FD->getBody());
- Doc.toParent();
- }
- }
-
- void addSubNodes(RecordDecl* RD) {
- for (RecordDecl::decl_iterator i = RD->decls_begin(),
- e = RD->decls_end(); i != e; ++i) {
- if (!(*i)->isImplicit()) {
- Visit(*i);
- Doc.toParent();
- }
- }
- }
-
- void addSubNodes(CXXRecordDecl* RD) {
- addSubNodes(cast<RecordDecl>(RD));
-
- if (RD->isDefinition()) {
- // FIXME: This breaks XML generation
- //Doc.addAttribute("num_bases", RD->getNumBases());
-
- for (CXXRecordDecl::base_class_iterator
- base = RD->bases_begin(),
- bend = RD->bases_end();
- base != bend;
- ++base) {
- Doc.addSubNode("Base");
- Doc.addAttribute("id", base->getType());
- AccessSpecifier as = base->getAccessSpecifierAsWritten();
- const char* as_name = "";
- switch(as) {
- case AS_none: as_name = ""; break;
- case AS_public: as_name = "public"; break;
- case AS_protected: as_name = "protected"; break;
- case AS_private: as_name = "private"; break;
- }
- Doc.addAttributeOptional("access", as_name);
- Doc.addAttribute("is_virtual", base->isVirtual());
- Doc.toParent();
- }
- }
- }
-
- void addSubNodes(EnumDecl* ED) {
- for (EnumDecl::enumerator_iterator i = ED->enumerator_begin(),
- e = ED->enumerator_end(); i != e; ++i) {
- Visit(*i);
- Doc.toParent();
- }
- }
-
- void addSubNodes(EnumConstantDecl* ECD) {
- if (ECD->getInitExpr())
- Doc.PrintStmt(ECD->getInitExpr());
- }
-
- void addSubNodes(FieldDecl* FdD) {
- if (FdD->isBitField())
- Doc.PrintStmt(FdD->getBitWidth());
- }
-
- void addSubNodes(VarDecl* V) {
- if (V->getInit())
- Doc.PrintStmt(V->getInit());
- }
-
- void addSubNodes(ParmVarDecl* argDecl) {
- if (argDecl->getDefaultArg())
- Doc.PrintStmt(argDecl->getDefaultArg());
- }
-
- void addSubNodes(DeclContext* ns) {
-
- for (DeclContext::decl_iterator
- d = ns->decls_begin(),
- dend = ns->decls_end();
- d != dend;
- ++d) {
- Visit(*d);
- Doc.toParent();
- }
- }
-
- void addSpecialAttribute(const char* pName, EnumDecl* ED) {
- const QualType& enumType = ED->getIntegerType();
- if (!enumType.isNull())
- Doc.addAttribute(pName, enumType);
- }
-
- void addIdAttribute(LinkageSpecDecl* ED) {
- Doc.addAttribute("id", ED);
- }
-
- void addIdAttribute(NamedDecl* ND) {
- Doc.addAttribute("id", ND);
- }
-
-public:
- DeclPrinter(DocumentXML& doc) : Doc(doc) {}
-
-#define NODE_XML( CLASS, NAME ) \
- void Visit##CLASS(CLASS* T) \
- { \
- Doc.addSubNode(NAME);
-
-#define ID_ATTRIBUTE_XML addIdAttribute(T);
-#define ATTRIBUTE_XML( FN, NAME ) Doc.addAttribute(NAME, T->FN);
-#define ATTRIBUTE_OPT_XML( FN, NAME ) Doc.addAttributeOptional(NAME, T->FN);
-#define ATTRIBUTE_FILE_LOCATION_XML Doc.addLocation(T->getLocation());
-#define ATTRIBUTE_SPECIAL_XML( FN, NAME ) addSpecialAttribute(NAME, T);
-
-#define ATTRIBUTE_ENUM_XML( FN, NAME ) \
- { \
- const char* pAttributeName = NAME; \
- const bool optional = false; \
- switch (T->FN) { \
- default: assert(0 && "unknown enum value");
-
-#define ATTRIBUTE_ENUM_OPT_XML( FN, NAME ) \
- { \
- const char* pAttributeName = NAME; \
- const bool optional = true; \
- switch (T->FN) { \
- default: assert(0 && "unknown enum value");
-
-#define ENUM_XML( VALUE, NAME ) case VALUE: if ((!optional) || NAME[0]) Doc.addAttribute(pAttributeName, NAME); break;
-#define END_ENUM_XML } }
-#define END_NODE_XML }
-
-#define SUB_NODE_XML( CLASS ) addSubNodes(T);
-#define SUB_NODE_SEQUENCE_XML( CLASS ) addSubNodes(T);
-#define SUB_NODE_OPT_XML( CLASS ) addSubNodes(T);
-
-#define SUB_NODE_FN_BODY_XML addFunctionBody(T);
-
-#include "clang/Frontend/DeclXML.def"
-};
-
-
-//---------------------------------------------------------
-void DocumentXML::writeDeclToXML(Decl *D) {
- DeclPrinter(*this).Visit(D);
- toParent();
-}
-
-//---------------------------------------------------------
-} // NS clang
-
diff --git a/lib/Frontend/DocumentXML.cpp b/lib/Frontend/DocumentXML.cpp
deleted file mode 100644
index a09db0be47..0000000000
--- a/lib/Frontend/DocumentXML.cpp
+++ /dev/null
@@ -1,381 +0,0 @@
-//===--- DocumentXML.cpp - XML document for ASTs --------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the XML document class, which provides the means to
-// dump out the AST in a XML form that exposes type details and other fields.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Frontend/DocumentXML.h"
-#include "clang/AST/Decl.h"
-#include "clang/AST/DeclCXX.h"
-#include "clang/AST/ASTContext.h"
-#include "clang/Basic/SourceManager.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/Config/config.h"
-#include <cstdio>
-
-namespace clang {
-
-//---------------------------------------------------------
-DocumentXML::DocumentXML(const std::string& rootName, llvm::raw_ostream& out) :
- Out(out),
- Ctx(0),
- HasCurrentNodeSubNodes(false) {
- NodeStack.push(rootName);
- Out << "<?xml version=\"1.0\"?>\n<" << rootName;
-}
-
-//---------------------------------------------------------
-DocumentXML& DocumentXML::addSubNode(const std::string& name) {
- if (!HasCurrentNodeSubNodes)
- Out << ">\n";
- NodeStack.push(name);
- HasCurrentNodeSubNodes = false;
- Indent();
- Out << "<" << NodeStack.top();
- return *this;
-}
-
-//---------------------------------------------------------
-void DocumentXML::Indent() {
- for (size_t i = 0, e = (NodeStack.size() - 1) * 2; i < e; ++i)
- Out << ' ';
-}
-
-//---------------------------------------------------------
-DocumentXML& DocumentXML::toParent() {
- assert(NodeStack.size() > 1 && "too much backtracking");
-
- if (HasCurrentNodeSubNodes) {
- Indent();
- Out << "</" << NodeStack.top() << ">\n";
- } else
- Out << "/>\n";
- NodeStack.pop();
- HasCurrentNodeSubNodes = true;
- return *this;
-}
-
-//---------------------------------------------------------
-namespace {
-
-enum tIdType { ID_NORMAL, ID_FILE, ID_LABEL, ID_LAST };
-
-unsigned getNewId(tIdType idType) {
- static unsigned int idCounts[ID_LAST] = { 0 };
- return ++idCounts[idType];
-}
-
-//---------------------------------------------------------
-inline std::string getPrefixedId(unsigned uId, tIdType idType) {
- static const char idPrefix[ID_LAST] = { '_', 'f', 'l' };
- char buffer[20];
- char* BufPtr = llvm::utohex_buffer(uId, buffer + 20);
- *--BufPtr = idPrefix[idType];
- return BufPtr;
-}
-
-//---------------------------------------------------------
-template<class T, class V>
-bool addToMap(T& idMap, const V& value, tIdType idType = ID_NORMAL) {
- typename T::iterator i = idMap.find(value);
- bool toAdd = i == idMap.end();
- if (toAdd)
- idMap.insert(typename T::value_type(value, getNewId(idType)));
- return toAdd;
-}
-
-} // anon NS
-
-
-//---------------------------------------------------------
-std::string DocumentXML::escapeString(const char* pStr,
- std::string::size_type len) {
- std::string value;
- value.reserve(len + 1);
- char buffer[16];
- for (unsigned i = 0; i < len; ++i) {
- switch (char C = pStr[i]) {
- default:
- if (isprint(C))
- value += C;
- else {
-#ifdef LLVM_ON_WIN32
- sprintf(buffer, "\\%03o", C);
-#else
- snprintf(buffer, sizeof(buffer), "\\%03o", C);
-#endif
- value += buffer;
- }
- break;
-
- case '\n': value += "\\n"; break;
- case '\t': value += "\\t"; break;
- case '\a': value += "\\a"; break;
- case '\b': value += "\\b"; break;
- case '\r': value += "\\r"; break;
-
- case '&': value += "&amp;"; break;
- case '<': value += "&lt;"; break;
- case '>': value += "&gt;"; break;
- case '"': value += "&quot;"; break;
- case '\'': value += "&apos;"; break;
-
- }
- }
- return value;
-}
-
-//---------------------------------------------------------
-void DocumentXML::finalize() {
- assert(NodeStack.size() == 1 && "not completely backtracked");
-
- addSubNode("ReferenceSection");
- addSubNode("Types");
-
- for (XML::IdMap<QualType>::iterator i = Types.begin(), e = Types.end();
- i != e; ++i) {
- if (i->first.hasLocalQualifiers()) {
- writeTypeToXML(i->first);
- addAttribute("id", getPrefixedId(i->second, ID_NORMAL));
- toParent();
- }
- }
-
- for (XML::IdMap<const Type*>::iterator i = BasicTypes.begin(),
- e = BasicTypes.end(); i != e; ++i) {
- writeTypeToXML(i->first);
- addAttribute("id", getPrefixedId(i->second, ID_NORMAL));
- toParent();
- }
-
-
- toParent().addSubNode("Contexts");
-
- for (XML::IdMap<const DeclContext*>::iterator i = Contexts.begin(),
- e = Contexts.end(); i != e; ++i) {
- addSubNode(i->first->getDeclKindName());
- addAttribute("id", getPrefixedId(i->second, ID_NORMAL));
- if (const NamedDecl *ND = dyn_cast<NamedDecl>(i->first))
- addAttribute("name", ND->getNameAsString());
- if (const TagDecl *TD = dyn_cast<TagDecl>(i->first))
- addAttribute("type", getPrefixedId(BasicTypes[TD->getTypeForDecl()], ID_NORMAL));
- else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(i->first))
- addAttribute("type", getPrefixedId(BasicTypes[FD->getType()->getAs<FunctionType>()], ID_NORMAL));
-
- if (const DeclContext* parent = i->first->getParent())
- addAttribute("context", parent);
- toParent();
- }
-
- toParent().addSubNode("Files");
-
- for (XML::IdMap<std::string>::iterator i = SourceFiles.begin(),
- e = SourceFiles.end(); i != e; ++i) {
- addSubNode("File");
- addAttribute("id", getPrefixedId(i->second, ID_FILE));
- addAttribute("name", escapeString(i->first.c_str(), i->first.size()));
- toParent();
- }
-
- toParent().toParent();
-
- // write the root closing node (which has always subnodes)
- Out << "</" << NodeStack.top() << ">\n";
-}
-
-//---------------------------------------------------------
-void DocumentXML::addAttribute(const char* pAttributeName,
- const QualType& pType) {
- addTypeRecursively(pType);
- addAttribute(pAttributeName, getPrefixedId(Types[pType], ID_NORMAL));
-}
-
-//---------------------------------------------------------
-void DocumentXML::addPtrAttribute(const char* pAttributeName,
- const Type* pType) {
- addTypeRecursively(pType);
- 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::NamespaceAlias: {
- addPtrAttribute(pAttributeName, pNNS->getAsNamespaceAlias());
- 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)
-{
- if (addToMap(Types, pType))
- {
- addTypeRecursively(pType.getTypePtr());
- // beautifier: a non-qualified type shall be transparent
- if (!pType.hasLocalQualifiers())
- {
- Types[pType] = BasicTypes[pType.getTypePtr()];
- }
- }
-}
-
-//---------------------------------------------------------
-void DocumentXML::addTypeRecursively(const Type* pType)
-{
- if (addToMap(BasicTypes, pType))
- {
- addParentTypes(pType);
-/*
- // FIXME: doesn't work in the immediate streaming approach
- if (const VariableArrayType *VAT = dyn_cast<VariableArrayType>(pType))
- {
- addSubNode("VariableArraySizeExpression");
- PrintStmt(VAT->getSizeExpr());
- toParent();
- }
-*/
- }
-}
-
-//---------------------------------------------------------
-void DocumentXML::addPtrAttribute(const char* pName, const DeclContext* DC)
-{
- addContextsRecursively(DC);
- addAttribute(pName, getPrefixedId(Contexts[DC], ID_NORMAL));
-}
-
-//---------------------------------------------------------
-void DocumentXML::addPtrAttribute(const char* pAttributeName, const NamedDecl* D)
-{
- if (const DeclContext* DC = dyn_cast<DeclContext>(D))
- {
- addContextsRecursively(DC);
- addAttribute(pAttributeName, getPrefixedId(Contexts[DC], ID_NORMAL));
- }
- else
- {
- addToMap(Decls, D);
- addAttribute(pAttributeName, getPrefixedId(Decls[D], ID_NORMAL));
- }
-}
-
-//---------------------------------------------------------
-void DocumentXML::addPtrAttribute(const char* pName, const NamespaceDecl* D)
-{
- addPtrAttribute(pName, static_cast<const DeclContext*>(D));
-}
-
-//---------------------------------------------------------
-void DocumentXML::addContextsRecursively(const DeclContext *DC)
-{
- if (DC != 0 && addToMap(Contexts, DC))
- {
- addContextsRecursively(DC->getParent());
- }
-}
-
-//---------------------------------------------------------
-void DocumentXML::addSourceFileAttribute(const std::string& fileName)
-{
- addToMap(SourceFiles, fileName, ID_FILE);
- addAttribute("file", getPrefixedId(SourceFiles[fileName], ID_FILE));
-}
-
-
-//---------------------------------------------------------
-void DocumentXML::addPtrAttribute(const char* pName, const LabelStmt* L)
-{
- addToMap(Labels, L, ID_LABEL);
- addAttribute(pName, getPrefixedId(Labels[L], ID_LABEL));
-}
-
-
-//---------------------------------------------------------
-PresumedLoc DocumentXML::addLocation(const SourceLocation& Loc)
-{
- SourceManager& SM = Ctx->getSourceManager();
- SourceLocation SpellingLoc = SM.getSpellingLoc(Loc);
- PresumedLoc PLoc;
- if (!SpellingLoc.isInvalid())
- {
- PLoc = SM.getPresumedLoc(SpellingLoc);
- if (PLoc.isValid()) {
- addSourceFileAttribute(PLoc.getFilename());
- addAttribute("line", PLoc.getLine());
- addAttribute("col", PLoc.getColumn());
- }
- }
- // else there is no error in some cases (eg. CXXThisExpr)
- return PLoc;
-}
-
-//---------------------------------------------------------
-void DocumentXML::addLocationRange(const SourceRange& R)
-{
- PresumedLoc PStartLoc = addLocation(R.getBegin());
- if (R.getBegin() != R.getEnd())
- {
- SourceManager& SM = Ctx->getSourceManager();
- SourceLocation SpellingLoc = SM.getSpellingLoc(R.getEnd());
- if (!SpellingLoc.isInvalid())
- {
- PresumedLoc PLoc = SM.getPresumedLoc(SpellingLoc);
- if (PLoc.isInvalid()) {
- } else if (PStartLoc.isInvalid() ||
- strcmp(PLoc.getFilename(), PStartLoc.getFilename()) != 0) {
- addToMap(SourceFiles, PLoc.getFilename(), ID_FILE);
- addAttribute("endfile", PLoc.getFilename());
- addAttribute("endline", PLoc.getLine());
- addAttribute("endcol", PLoc.getColumn());
- } else if (PLoc.getLine() != PStartLoc.getLine()) {
- addAttribute("endline", PLoc.getLine());
- addAttribute("endcol", PLoc.getColumn());
- } else {
- addAttribute("endcol", PLoc.getColumn());
- }
- }
- }
-}
-
-//---------------------------------------------------------
-void DocumentXML::PrintDecl(Decl *D)
-{
- writeDeclToXML(D);
-}
-
-//---------------------------------------------------------
-} // NS clang
-
diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp
index d8e7d29045..7b06c7e49a 100644
--- a/lib/Frontend/FrontendActions.cpp
+++ b/lib/Frontend/FrontendActions.cpp
@@ -47,13 +47,6 @@ ASTConsumer *ASTPrintAction::CreateASTConsumer(CompilerInstance &CI,
return 0;
}
-ASTConsumer *ASTPrintXMLAction::CreateASTConsumer(CompilerInstance &CI,
- llvm::StringRef InFile) {
- if (llvm::raw_ostream *OS = CI.createDefaultOutputFile(false, InFile, "xml"))
- return CreateASTPrinterXML(OS);
- return 0;
-}
-
ASTConsumer *ASTDumpAction::CreateASTConsumer(CompilerInstance &CI,
llvm::StringRef InFile) {
return CreateASTDumper();
diff --git a/lib/Frontend/StmtXML.cpp b/lib/Frontend/StmtXML.cpp
deleted file mode 100644
index 257c1ccb00..0000000000
--- a/lib/Frontend/StmtXML.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-//===--- StmtXML.cpp - XML implementation for Stmt ASTs ------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the Stmt::dumpXML methods, which dump out the
-// AST to an XML document.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Frontend/DocumentXML.h"
-#include "clang/AST/StmtVisitor.h"
-#include "clang/AST/DeclObjC.h"
-#include "clang/AST/DeclCXX.h"
-#include "clang/Basic/SourceManager.h"
-using namespace clang;
-
-//===----------------------------------------------------------------------===//
-// StmtXML Visitor
-//===----------------------------------------------------------------------===//
-
-namespace {
- class StmtXML : public StmtVisitor<StmtXML> {
- DocumentXML& Doc;
-
- //static const char *getOpcodeStr(UnaryOperator::Opcode Op);
- //static const char *getOpcodeStr(BinaryOperator::Opcode Op);
-
-
- void addSpecialAttribute(const char* pName, StringLiteral* Str) {
- Doc.addAttribute(pName, Doc.escapeString(Str->getString().data(),
- Str->getString().size()));
- }
-
- void addSpecialAttribute(const char* pName, SizeOfAlignOfExpr* S) {
- if (S->isArgumentType())
- Doc.addAttribute(pName, S->getArgumentType());
- }
-
- void addSpecialAttribute(const char* pName, CXXTypeidExpr* S) {
- if (S->isTypeOperand())
- Doc.addAttribute(pName, S->getTypeOperand());
- }
-
-
- public:
- StmtXML(DocumentXML& doc)
- : Doc(doc) {
- }
-
- void DumpSubTree(Stmt *S) {
- if (S) {
- Visit(S);
- if (DeclStmt* DS = dyn_cast<DeclStmt>(S)) {
- for (DeclStmt::decl_iterator DI = DS->decl_begin(),
- DE = DS->decl_end(); DI != DE; ++DI) {
- Doc.PrintDecl(*DI);
- }
- } else {
- for (Stmt::child_range i = S->children(); i; ++i)
- DumpSubTree(*i);
- }
- Doc.toParent();
- } else {
- Doc.addSubNode("NULL").toParent();
- }
- }
-
-
-#define NODE_XML( CLASS, NAME ) \
- void Visit##CLASS(CLASS* S) \
- { \
- typedef CLASS tStmtType; \
- Doc.addSubNode(NAME);
-
-#define ATTRIBUTE_XML( FN, NAME ) Doc.addAttribute(NAME, S->FN);
-#define TYPE_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "type")
-#define ATTRIBUTE_OPT_XML( FN, NAME ) Doc.addAttributeOptional(NAME, S->FN);
-#define ATTRIBUTE_SPECIAL_XML( FN, NAME ) addSpecialAttribute(NAME, S);
-#define ATTRIBUTE_FILE_LOCATION_XML Doc.addLocationRange(S->getSourceRange());
-
-
-#define ATTRIBUTE_ENUM_XML( FN, NAME ) \
- { \
- const char* pAttributeName = NAME; \
- const bool optional = false; \
- switch (S->FN) { \
- default: assert(0 && "unknown enum value");
-
-#define ATTRIBUTE_ENUM_OPT_XML( FN, NAME ) \
- { \
- const char* pAttributeName = NAME; \
- const bool optional = true; \
- switch (S->FN) { \
- default: assert(0 && "unknown enum value");
-
-#define ENUM_XML( VALUE, NAME ) case VALUE: if ((!optional) || NAME[0]) Doc.addAttribute(pAttributeName, NAME); break;
-#define END_ENUM_XML } }
-#define END_NODE_XML }
-
-#define ID_ATTRIBUTE_XML Doc.addAttribute("id", S);
-#define SUB_NODE_XML( CLASS )
-#define SUB_NODE_SEQUENCE_XML( CLASS )
-#define SUB_NODE_OPT_XML( CLASS )
-
-#include "clang/Frontend/StmtXML.def"
- };
-}
-
-//===----------------------------------------------------------------------===//
-// Stmt method implementations
-//===----------------------------------------------------------------------===//
-
-/// dumpAll - This does a dump of the specified AST fragment and all subtrees.
-void DocumentXML::PrintStmt(const Stmt *S) {
- StmtXML P(*this);
- P.DumpSubTree(const_cast<Stmt*>(S));
-}
-
diff --git a/lib/Frontend/TypeXML.cpp b/lib/Frontend/TypeXML.cpp
deleted file mode 100644
index a8c8f75d4b..0000000000
--- a/lib/Frontend/TypeXML.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-//===--- DocumentXML.cpp - XML document for ASTs --------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the XML document class, which provides the means to
-// dump out the AST in a XML form that exposes type details and other fields.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Frontend/DocumentXML.h"
-#include "clang/AST/TypeVisitor.h"
-#include "clang/AST/Type.h"
-#include "clang/AST/Decl.h"
-
-namespace clang {
- namespace XML {
- namespace {
-
-//---------------------------------------------------------
-class TypeWriter : public TypeVisitor<TypeWriter> {
- DocumentXML& Doc;
-
-public:
- TypeWriter(DocumentXML& doc) : Doc(doc) {}
-
-#define NODE_XML( CLASS, NAME ) \
- void Visit##CLASS(const CLASS* T) { \
- Doc.addSubNode(NAME);
-
-#define ID_ATTRIBUTE_XML // done by the Document class itself
-#define ATTRIBUTE_XML( FN, NAME ) Doc.addAttribute(NAME, T->FN);
-#define TYPE_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "type")
-#define CONTEXT_ATTRIBUTE_XML( FN ) ATTRIBUTE_XML(FN, "context")
-#define ATTRIBUTE_OPT_XML( FN, NAME ) Doc.addAttributeOptional(NAME, T->FN);
-
-#define ATTRIBUTE_ENUM_XML( FN, NAME ) \
- { \
- const char* pAttributeName = NAME; \
- const bool optional = false; \
- switch (T->FN) { \
- default: assert(0 && "unknown enum value");
-
-#define ATTRIBUTE_ENUM_OPT_XML( FN, NAME ) \
- { \
- const char* pAttributeName = NAME; \
- const bool optional = true; \
- switch (T->FN) { \
- default: assert(0 && "unknown enum value");
-
-#define ENUM_XML( VALUE, NAME ) case VALUE: if ((!optional) || NAME[0]) Doc.addAttribute(pAttributeName, NAME); break;
-#define END_ENUM_XML } }
-#define END_NODE_XML }
-
-#include "clang/Frontend/TypeXML.def"
-
-};
-
-//---------------------------------------------------------
- } // anon clang
- } // NS XML
-
-//---------------------------------------------------------
-class DocumentXML::TypeAdder : public TypeVisitor<DocumentXML::TypeAdder> {
- DocumentXML& Doc;
-
- void addIfType(const Type* pType) {
- Doc.addTypeRecursively(pType);
- }
-
- void addIfType(const QualType& pType) {
- Doc.addTypeRecursively(pType);
- }
-
- template<class T> void addIfType(T) {}
-
-public:
- TypeAdder(DocumentXML& doc) : Doc(doc) {}
-
-#define NODE_XML( CLASS, NAME ) \
- void Visit##CLASS(const CLASS* T) \
- {
-
-#define ID_ATTRIBUTE_XML
-#define TYPE_ATTRIBUTE_XML( FN ) Doc.addTypeRecursively(T->FN);
-#define CONTEXT_ATTRIBUTE_XML( FN )
-#define ATTRIBUTE_XML( FN, NAME ) addIfType(T->FN);
-#define ATTRIBUTE_OPT_XML( FN, NAME )
-#define ATTRIBUTE_ENUM_XML( FN, NAME )
-#define ATTRIBUTE_ENUM_OPT_XML( FN, NAME )
-#define ENUM_XML( VALUE, NAME )
-#define END_ENUM_XML
-#define END_NODE_XML }
-
-#include "clang/Frontend/TypeXML.def"
-};
-
-//---------------------------------------------------------
-void DocumentXML::addParentTypes(const Type* pType) {
- TypeAdder(*this).Visit(pType);
-}
-
-//---------------------------------------------------------
-void DocumentXML::writeTypeToXML(const Type* pType) {
- XML::TypeWriter(*this).Visit(const_cast<Type*>(pType));
-}
-
-//---------------------------------------------------------
-void DocumentXML::writeTypeToXML(const QualType& pType) {
- XML::TypeWriter(*this).VisitQualType(const_cast<QualType*>(&pType));
-}
-
-//---------------------------------------------------------
-} // NS clang
-
diff --git a/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/lib/FrontendTool/ExecuteCompilerInvocation.cpp
index 65fad6da51..664b53351d 100644
--- a/lib/FrontendTool/ExecuteCompilerInvocation.cpp
+++ b/lib/FrontendTool/ExecuteCompilerInvocation.cpp
@@ -37,7 +37,6 @@ static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) {
case ASTDump: return new ASTDumpAction();
case ASTDumpXML: return new ASTDumpXMLAction();
case ASTPrint: return new ASTPrintAction();
- case ASTPrintXML: return new ASTPrintXMLAction();
case ASTView: return new ASTViewAction();
case BoostCon: return new BoostConAction();
case CreateModule: return 0;